Skip to main content

Module operation_context

Module operation_context 

Source
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§

OperationContext
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.
SessionContextInputs
The inputs that identify the session a presentation belongs to, plus the request_hash binding 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 as VerifyOptions.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_digest is 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_hash is exactly 32 bytes — use operation_context_hash to derive it, over an all-empty OperationContext when the deployment has no operation-specific inputs.