{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://yebo.dev/schema/yac/v1.json",
  "title": "Yebo Authorization Certificate",
  "description": "YAC/1.0 \u2014 A cryptographic proof that a specific human authorized a specific AI action. Signed with ECDSA P-256 over a canonical SHA-256 digest. Immutable once issued.",
  "type": "object",
  "required": [
    "receipt_id",
    "mandate_id",
    "authorized_by",
    "capability",
    "policy_hash",
    "execution_status",
    "authorization_status",
    "timestamp",
    "protocol_version",
    "signer_public_key",
    "key_id",
    "signature"
  ],
  "properties": {
    "receipt_id": {
      "type": "string",
      "description": "Unique identifier for this YAC. Format: yac_{uuid}",
      "pattern": "^yac_[a-zA-Z0-9_-]+$",
      "examples": [
        "yac_7f3a2b9c-1234-5678-abcd-ef0123456789"
      ]
    },
    "mandate_id": {
      "type": "string",
      "description": "The AP2 Mandate this certificate covers. Format: MND-{hex24}",
      "pattern": "^MND-[A-F0-9]{24}$",
      "examples": [
        "MND-7F3A2B9C1234ABCDEF012345"
      ]
    },
    "pai_token": {
      "type": "string",
      "description": "The Proof of Authorized Intent token. Format: PAI.{mandate_id}.{nonce}.{ecdsa_signature_hex}",
      "examples": [
        "PAI.MND-7F3A2B9C.n_8k2mXp.3045022100..."
      ]
    },
    "authorized_by": {
      "type": "string",
      "description": "The identity_id of the human who authorized the action. Derived from SHA-256 of their Secure Enclave public key.",
      "examples": [
        "did:yebo:sha256:a4f2c8b3d1e9f0a1b2c3d4e5f6a7b8c9"
      ]
    },
    "agent_id": {
      "type": "string",
      "description": "The agent_id of the AI agent that proposed the action. Absent if action was directly user-initiated.",
      "examples": [
        "agent_claude_3_opus_enterprise_acme"
      ]
    },
    "capability": {
      "type": "string",
      "description": "The authorized action type.",
      "enum": [
        "payment",
        "approval",
        "data_access",
        "healthcare",
        "procurement",
        "identity_verification",
        "content_publish",
        "system_access",
        "contract",
        "custom"
      ]
    },
    "policy_hash": {
      "type": "string",
      "description": "SHA-256 hash of the enterprise policy active at authorization time. Embedded in the AP2 Mandate at creation. Any policy change invalidates this certificate for future mandates.",
      "pattern": "^[a-f0-9]{64}$",
      "examples": [
        "a4f2c8b3d1e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5"
      ]
    },
    "execution_status": {
      "type": "string",
      "description": "The result of the execution attempt.",
      "enum": [
        "executed",
        "failed",
        "pending",
        "blocked"
      ],
      "examples": [
        "executed"
      ]
    },
    "authorization_status": {
      "type": "string",
      "description": "The human authorization status.",
      "enum": [
        "authorized",
        "denied",
        "expired",
        "revoked"
      ],
      "default": "authorized",
      "examples": [
        "authorized"
      ]
    },
    "integrity_score": {
      "type": "number",
      "description": "Yebo Trust Score of the authorizing identity at time of authorization (0\u2013100).",
      "minimum": 0,
      "maximum": 100,
      "examples": [
        87
      ]
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when this certificate was issued.",
      "examples": [
        "2026-03-26T10:05:32.000Z"
      ]
    },
    "protocol_version": {
      "type": "string",
      "description": "YAC protocol version.",
      "const": "YAC/1.0",
      "examples": [
        "YAC/1.0"
      ]
    },
    "signer_public_key": {
      "type": "string",
      "description": "Base64-encoded ECDSA P-256 public key of the Yebo gateway signer. Rotate via POST /authorization-receipt/keys/rotate.",
      "examples": [
        "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE..."
      ]
    },
    "key_id": {
      "type": "string",
      "description": "Identifier of the signing key used. Useful for key rotation scenarios.",
      "examples": [
        "yebo_signer_2026_q1"
      ]
    },
    "signature": {
      "type": "string",
      "description": "ECDSA P-256 signature over the canonical SHA-256 digest of the signed fields (receipt_id, mandate_id, pai_token, authorized_by, agent_id, capability, policy_hash, execution_status, timestamp, protocol_version, key_id, authorization_status). Encoded as hex.",
      "pattern": "^[a-f0-9]+$",
      "examples": [
        "3045022100a4f2c8..."
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "receipt_id": "yac_7f3a2b9c-1234-5678-abcd-ef0123456789",
      "mandate_id": "MND-7F3A2B9C1234ABCDEF012345",
      "pai_token": "PAI.MND-7F3A2B9C.n_8k2mXp.3045022100abcd1234",
      "authorized_by": "did:yebo:sha256:a4f2c8b3d1e9f0a1b2c3d4e5f6a7b8c9",
      "agent_id": "agent_claude_3_opus_enterprise_acme",
      "capability": "payment",
      "intent": "Q1 vendor invoice payment to Acme Corp",
      "merchant": "vendor_acme_corp",
      "amount": 5000.0,
      "policy_hash": "a4f2c8b3d1e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5",
      "execution_status": "executed",
      "authorization_status": "authorized",
      "settlement_status": "settled",
      "integrity_score": 87,
      "integrity_tier": "trusted",
      "timestamp": "2026-03-26T10:05:32.000Z",
      "protocol_version": "YAC/1.0",
      "signer_public_key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...",
      "key_id": "yebo_signer_2026_q1",
      "signer_id": "gateway.yebo.dev",
      "signature": "3045022100a4f2c8b3d1e9f0a1b2c3d4e5f6a7b8c9"
    }
  ]
}