{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:proof21:schema:authorization:v1",
  "title": "P21 Action Authorization v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "authorizationId",
    "requestDigest",
    "policyDigest",
    "actionDigest",
    "actionProfile",
    "network",
    "nonce",
    "issuedAt",
    "expiresAt",
    "issuer",
    "signature"
  ],
  "properties": {
    "type": {
      "const": "p21.authorization.v1"
    },
    "authorizationId": {
      "type": "string",
      "minLength": 1
    },
    "requestDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "policyDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "actionDigest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "actionProfile": {
      "type": "string",
      "minLength": 1
    },
    "network": {
      "type": "string",
      "minLength": 1
    },
    "asset": {
      "type": [
        "string",
        "null"
      ]
    },
    "recipient": {
      "type": [
        "string",
        "null"
      ]
    },
    "amountAtomic": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^(0|[1-9][0-9]*)$"
    },
    "nonce": {
      "type": "string",
      "minLength": 1
    },
    "issuedAt": {
      "type": "string",
      "format": "date-time"
    },
    "notBefore": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "issuer": {
      "type": "string",
      "minLength": 1
    },
    "signature": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "algorithm",
        "keyId",
        "value"
      ],
      "properties": {
        "algorithm": {
          "type": "string",
          "minLength": 1
        },
        "keyId": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
