{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://receiz.com/standards/receiz.trusted-profile.v1.json",
  "title": "Receiz Trusted Verification Profile v1",
  "description": "Hard-fail trusted verification profile layered on top of receiz.schema.v1.",
  "allOf": [
    {
      "$ref": "https://receiz.com/standards/receiz.schema.v1.json"
    },
    {
      "type": "object",
      "required": [
        "groth16Proof",
        "groth16ProofDigest",
        "zkPoseidonHash",
        "artifactSha256Basis",
        "anchorId",
        "signatureV4"
      ],
      "properties": {
        "anchorId": {
          "type": "string",
          "pattern": "^[0-9a-f]{8}$",
          "description": "Lowercase anchor identifier required for trusted verification profile."
        },
        "groth16Proof": {
          "type": "string",
          "pattern": "^g16:[A-Za-z0-9_-]+$",
          "description": "Trusted verification requires real g16 envelope format."
        },
        "signatureV4": {
          "type": "object",
          "additionalProperties": false,
          "required": ["version", "alg", "cert", "sig", "payloadHashSha256", "signedAtMs"],
          "properties": {
            "version": {
              "const": 1
            },
            "alg": {
              "const": "Ed25519"
            },
            "cert": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "version",
                "certType",
                "certId",
                "issuerKid",
                "alg",
                "subjectPublicKeyRawB64u",
                "issuedAtMs",
                "expiresAtMs",
                "sig"
              ],
              "properties": {
                "version": {
                  "const": 1
                },
                "certType": {
                  "const": "receiz.device.v1"
                },
                "certId": {
                  "type": "string",
                  "pattern": "^[0-9a-fA-F]{32}$"
                },
                "issuerKid": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9._:-]{3,64}$"
                },
                "alg": {
                  "const": "Ed25519"
                },
                "subjectPublicKeyRawB64u": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]+$"
                },
                "issuedAtMs": {
                  "type": "integer",
                  "minimum": 0
                },
                "expiresAtMs": {
                  "type": "integer",
                  "minimum": 1
                },
                "sig": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]+$"
                }
              }
            },
            "sig": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+$"
            },
            "payloadHashSha256": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{64}$"
            },
            "signedAtMs": {
              "type": "integer",
              "minimum": 0
            }
          }
        }
      }
    }
  ]
}
