{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://scrollcase.dev/schema/v2/signed-document.schema.json",
"title": "Signed box document",
"description": "The envelope wrapping every signed document. The payload travels as exact base64-encoded JSON so that verifying a signature means hashing the bytes as transmitted, with no canonical-JSON implementation to keep in sync across languages. Passing this schema means the envelope is well-formed, never that its signature is valid.",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion", "payloadEncoding", "payloadBase64", "payloadSha256", "signatures"],
"properties": {
"schemaVersion": { "const": 2 },
"payloadEncoding": { "const": "base64-json-utf8" },
"payloadBase64": {
"type": "string",
"minLength": 1,
"description": "The document payload: UTF-8 JSON, base64-encoded, signed and hashed exactly as it appears here."
},
"payloadSha256": {
"$ref": "#/$defs/sha256",
"description": "SHA-256 of the decoded payload bytes."
},
"signatures": {
"type": "array",
"minItems": 1,
"description": "Detached signatures over the decoded payload bytes. A verifier accepts the document when any one signature verifies against a trusted key, which is what allows a key to be rotated without reissuing every document.",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["algorithm", "keyId", "signatureBase64"],
"properties": {
"algorithm": { "const": "ed25519" },
"keyId": { "type": "string", "minLength": 1 },
"signatureBase64": { "type": "string", "minLength": 1 }
}
}
}
},
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
}
}
}