{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/admission-binding-v1.json",
  "title": "Admission Binding Receipt, v1",
  "description": "Canonical schema for the Hive admission binding receipt, canonical type admission.binding.",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_admission\\.binding_[0-9]{10,}_[0-9a-f]{12}$"
    },
    "payload_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "sig_b64u": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{86}$"
    },
    "key_id": {
      "type": "string",
      "pattern": "^did:(hive|web|key):[A-Za-z0-9._:%-]+$"
    },
    "algorithm": {
      "type": "string",
      "const": "Ed25519"
    },
    "ts": {
      "type": "integer",
      "minimum": 1000000000
    },
    "signed_body": {
      "type": "object",
      "required": [
        "receipt_type",
        "schema",
        "binding_id",
        "tenant_id",
        "admission",
        "conduct",
        "validity",
        "finding",
        "evaluated_at",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "admission.binding"
        },
        "schema": {
          "type": "string",
          "const": "r1.0.0"
        },
        "binding_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:]{0,255}$"
        },
        "tenant_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:]{0,255}$"
        },
        "admission": {
          "type": "object",
          "required": [
            "credential_commitment",
            "subject_commitment",
            "salt_commitment",
            "admission_instant",
            "admission_authority_class",
            "credential_verification_class"
          ],
          "additionalProperties": false,
          "properties": {
            "credential_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "subject_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "salt_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "admission_instant": {
              "type": "string",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
            },
            "admission_authority_class": {
              "type": "string",
              "enum": [
                "network_operator",
                "registry",
                "directory",
                "self_asserted"
              ]
            },
            "credential_verification_class": {
              "type": "string",
              "enum": [
                "signature_verified",
                "structure_verified",
                "acceptor_verified"
              ]
            }
          }
        },
        "conduct": {
          "type": "object",
          "required": [
            "receipt_id",
            "envelope_sha256",
            "receipt_type",
            "actor_subject_commitment",
            "conduct_instant"
          ],
          "additionalProperties": false,
          "properties": {
            "receipt_id": {
              "type": "string",
              "pattern": "^r_[a-z][a-z0-9.]{0,63}_[0-9]{10,}_[0-9a-f]{12}$"
            },
            "envelope_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "receipt_type": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9]{0,31}[.][a-z][a-z0-9]{0,31}$"
            },
            "actor_subject_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "conduct_instant": {
              "type": "string",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
            }
          }
        },
        "validity": {
          "type": "object",
          "required": [
            "maximum_separation_seconds",
            "maximum_separation_commitment"
          ],
          "additionalProperties": false,
          "properties": {
            "maximum_separation_seconds": {
              "type": "integer",
              "minimum": 0,
              "maximum": 604800
            },
            "maximum_separation_commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        },
        "finding": {
          "type": "object",
          "required": [
            "subject_relation",
            "temporal_relation",
            "status"
          ],
          "additionalProperties": false,
          "properties": {
            "subject_relation": {
              "type": "string",
              "const": "same_subject"
            },
            "temporal_relation": {
              "type": "string",
              "const": "conduct_at_or_after_admission_and_within_bound"
            },
            "status": {
              "type": "string",
              "const": "bound"
            }
          }
        },
        "evaluated_at": {
          "type": "string",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,9})?Z$"
        },
        "boundary": {
          "type": "string",
          "const": "This receipt attests only that a supplied admission credential and one supplied conduct receipt yield byte identical subject commitments under one disclosed binding salt that the admission credential already commits to, and that the extracted conduct instant is at or after the stated admission instant and within the signed maximum separation. It does not attest that the admission credential is validly issued, that any admitting party is entitled to admit, that either identifier is true, that the subject is a person or entity of any asserted kind, that the conduct occurred, or that the conduct is authorized. It does not decide authenticity beyond the checked signatures and stated verification class, completeness of records, actual knowledge, intent, fault, fraud, contractual effect, legal effect, regulatory effect, eligibility, title, responsibility, liability, or any dispute. It does not authorize admission, access, conduct, a transaction, credential presentation, disclosure, or reliance by any party. It does not establish that either source artifact is complete, exclusive, current, unrevoked, unaltered before receipt, or truthful. It cannot decide whether an absent conduct receipt exists, whether another admission credential exists, whether the admitting party relied on the credential, whether the conduct service observed all conduct, or whether any party knew of the other artifact."
        }
      }
    }
  }
}
