Expand description
Operation-context and session-context canonical constructions (SPEC §6.4.9).
Both are raw binary, domain-separated, and length-prefixed — NOT JSON.
Length prefixes exist because raw concatenation is ambiguous
("ab" || "c" equals "a" || "bc"); domain tags exist so a hash
computed for one construction can never collide with the other.
Structs§
- Operation
Context - The inputs that identify one specific action a presentation authorizes (SPEC §6.4.9). Which fields are populated is deployment-defined — empty fields encode as zero-length and the construction stays well-defined.
- Session
Context Inputs - The inputs that identify the session a presentation belongs to, plus
the
request_hashbinding the specific operation (SPEC §6.4.9). The Middleware Custody Profile (SPEC §15.2.1) requires all of them; other deployments populate what they have.
Functions§
- build_
session_ context - The 32-byte
session_context: SHA-256 over the SPEC §6.4.9 session-context bytes — what a session-bound deployment passes asVerifyOptions.session_context(and what the agent side includes in the challenge signing bytes, SPEC §6.4.2). Verification receipts and audit records bind this hash, never the preimage. - operation_
context_ bytes - The SPEC §6.4.9 operation-context preimage: the domain tag followed
by every field length-prefixed, in canonical order. Errors if
payload_digestis neither empty nor exactly 32 bytes. - operation_
context_ hash - The 32-byte
request_hash: SHA-256 over the SPEC §6.4.9 operation-context bytes. - session_
context_ bytes - The SPEC §6.4.9 session-context preimage: the domain tag followed by
every field length-prefixed, in canonical order. Errors unless
request_hashis exactly 32 bytes — useoperation_context_hashto derive it, over an all-emptyOperationContextwhen the deployment has no operation-specific inputs.