{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/secondappraisal-com/json-schema/secondappraisal-com-signature-check-result-schema.json",
  "title": "SignatureCheckResult",
  "description": "What a test credential's signed request looked like to the API: whether its signature verified, the base it was checked over, each check's result and the first that would refuse it.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/secondappraisal-com-openapi.json#/components/schemas/SignatureCheckResult",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "const": "gap.signature_check",
      "x-data-class": "public"
    },
    "verified": {
      "type": "boolean",
      "description": "Whether the request's signature verified with your test credential's public key over the signature base built from the request as received, whatever the other checks found. It is false for a keyid that names no test credential of yours, a revoked one, or one registered with another algorithm than the one the signature names.",
      "x-data-class": "public"
    },
    "signature_base": {
      "description": "The signature base built from the request as received (RFC 9421 section 2.5), to compare byte for byte with the one you signed. Present whenever the request's signature follows the gap-v2 profile, whether or not it verified.",
      "x-data-class": "institution_confidential",
      "type": "string"
    },
    "code": {
      "description": "The first check that would refuse this request on any other operation, whether or not the signature verified, as the code it would be refused with. Absent when every check passes. New values may be added: treat one you don't recognise as unknown, and don't fail.",
      "x-data-class": "public",
      "type": "string",
      "enum": [
        "signature_profile_invalid",
        "signature_expired",
        "target_uri_not_allowed",
        "signature_invalid",
        "environment_mismatch",
        "api_key_expired"
      ]
    },
    "checks": {
      "description": "Each check's result, in the order the API makes them: `pass`, `fail`, or `not_checked` when an earlier step left nothing to check it with.",
      "type": "object",
      "properties": {
        "profile": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "`Signature-Input`, `Signature`, the headers they cover and `X-SA-Environment` follow the gap-v2 profile. When this fails, nothing else is checked. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        },
        "window": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "`created` is within 300 seconds before our clock and 30 after it. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        },
        "host": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "The host you called is one a signed request may name. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        },
        "signature": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "The signature verified with your test credential's public key over `signature_base`. A keyid that names no test credential of yours fails here the same way. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        },
        "content_digest": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "`Content-Digest` matches the body as received. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        },
        "expiry": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "The credential hasn't expired. Checked only once the signature verified. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        },
        "environment": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_checked"
          ],
          "description": "`X-SA-Environment` is `TEST`, as a test credential's must be. Checked only once the signature verified. New values may be added: treat one you don't recognise as unknown, and don't fail.",
          "x-data-class": "public"
        }
      },
      "required": [
        "profile",
        "window",
        "host",
        "signature",
        "content_digest",
        "expiry",
        "environment"
      ]
    }
  },
  "required": [
    "object",
    "verified"
  ]
}