{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.sbo3l.dev/x402/v1.json",
  "title": "SBO3L x402 Challenge/Proof Envelope v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "version",
    "challenge_url",
    "method",
    "amount",
    "asset",
    "chain",
    "recipient",
    "expires_at"
  ],
  "properties": {
    "version": {
      "type": "integer",
      "const": 1
    },
    "challenge_url": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048
    },
    "method": {
      "type": "string",
      "enum": [
        "GET",
        "POST",
        "PUT",
        "PATCH",
        "DELETE"
      ]
    },
    "amount": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]{1,18})?$"
    },
    "asset": {
      "type": "string",
      "minLength": 2,
      "maxLength": 32
    },
    "chain": {
      "type": "string",
      "minLength": 2,
      "maxLength": 32
    },
    "recipient": {
      "type": "string",
      "pattern": "^0x[a-fA-F0-9]{40}$"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "resource_hash": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[a-f0-9]{64}$",
      "default": null
    },
    "provider_signature": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 256,
      "default": null
    }
  }
}
