{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thehiveryiq.com/.well-known/schemas/portfolio-exposure-v1.json",
  "title": "Portfolio Exposure Receipt, v1",
  "type": "object",
  "required": [
    "receipt_id",
    "payload_sha256",
    "sig_b64u",
    "key_id",
    "algorithm",
    "ts",
    "signed_body"
  ],
  "additionalProperties": false,
  "properties": {
    "receipt_id": {
      "type": "string",
      "pattern": "^r_portfolio\\.exposure_[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",
        "exposure_id",
        "book_ref",
        "member_count",
        "commitments",
        "concentration",
        "top_share_ratio",
        "evaluated_at",
        "boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "receipt_type": {
          "type": "string",
          "const": "portfolio.exposure"
        },
        "schema": {
          "type": "string",
          "const": "r1.0.0"
        },
        "exposure_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "book_ref": {
          "type": "object",
          "required": [
            "book_digest_sha256",
            "salt_commitment_sha256",
            "as_of"
          ],
          "additionalProperties": false,
          "properties": {
            "book_digest_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "salt_commitment_sha256": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "as_of": {
              "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$"
            }
          }
        },
        "member_count": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100000
        },
        "commitments": {
          "type": "array",
          "maxItems": 500000,
          "items": {
            "type": "object",
            "required": [
              "commitment_hmac_sha256",
              "dimension"
            ],
            "additionalProperties": false,
            "properties": {
              "commitment_hmac_sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "dimension": {
                "type": "string",
                "enum": [
                  "base_model",
                  "inference_provider",
                  "eval_administrator",
                  "data_source",
                  "hosting_region"
                ]
              }
            }
          }
        },
        "concentration": {
          "type": "array",
          "maxItems": 500000,
          "items": {
            "type": "object",
            "required": [
              "dimension",
              "commitment_hmac_sha256",
              "member_count",
              "share_ratio"
            ],
            "additionalProperties": false,
            "properties": {
              "dimension": {
                "type": "string",
                "enum": [
                  "base_model",
                  "inference_provider",
                  "eval_administrator",
                  "data_source",
                  "hosting_region"
                ]
              },
              "commitment_hmac_sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "member_count": {
                "type": "integer",
                "minimum": 0
              },
              "share_ratio": {
                "type": "number"
              }
            }
          }
        },
        "top_share_ratio": {
          "type": "number"
        },
        "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 that concentration counts and share ratios were recomputed by this service over a set of opaque commitments supplied for one book as of a stated time, that no group smaller than five members was reported, and that this service received no insured identity, no dependency name, and no policy term. It does not attest that the commitments are correct, that they were computed honestly, that the book is complete, or that any member is insured at all. Because the commitments are opaque to this service by design, this service cannot detect a member that was omitted, duplicated, or mis committed. It does not measure, price, or opine on risk, does not constitute an actuarial analysis, a capital adequacy assessment, or a reinsurance recommendation, and it does not attest that a concentration reported here would produce a correlated loss."
        }
      }
    }
  }
}
