Expand description
NotarizationEnvelope — the W3C VC 2.0-shaped credential carrying an APH notarization. This is the canonical on-wire shape.
The envelope is a JSON-LD compatible W3C Verifiable Credential 2.0
payload. The @context field carries the JSON-LD contexts; the type
field MUST include "VerifiableCredential" plus
"AgentSendAuthorizationCredential". All struct field names use
snake_case in Rust and camelCase on the wire (via
#[serde(rename_all = "camelCase")]), except @context (JSON-LD
convention) and type (Rust reserved keyword routed through r#type
- explicit
#[serde(rename = "type")]for defense in depth).
This module is shape-only — proof.proof_value is a String; no
cryptographic validation occurs in this module. The STRUCTURAL rules of
spec §7.1.11 (chain length, proof purposes, previousProof linkage,
label/structure agreement) live in crate::verification; signature
checking lives in crate::crypto.
Structs§
- ActClassification
- What a sender says an act MEANS, against vocabularies both parties can resolve independently (RFC 0006).
- ActLabel
- One family-qualified label:
FAMILY/LABEL. - Agent
Ref - Reference to the agent that produced the communication.
- Apple
AurAcceptance Claim - Last-position sibling struct. Carries Apple Foundation Models AUR
acceptance per
(user_id, device_id, aur_version_hash)tuple. Embedded asOption<AppleAurAcceptanceClaim>onCredentialSubject.apple_aur_acceptance. The field is#[serde(default, skip_serializing_if = "...")]so legacy envelopes that predate this claim continue to deserialize cleanly. - Audience
- Who may accept this envelope, and — optionally — on which delivery coordinates (§7.1.13, RFC 0003).
- Audience
Channel Binding - The delivery coordinates an audience-bound envelope may be spent on
(§7.1.13).
kindis drawn from the same closed set as the channel block; every OTHER member is channel-shaped and flattened, mirroringChannelDescriptor.recipient_addressing’s opacity — APH core compares these members for equality against the coordinates of the act being performed and forms no other opinion about them. - Channel
Descriptor - Delivery channel and its channel-shaped recipient addressing.
- Communication
Descriptor - What was sent: classification plus the hash that binds this credential to a specific message body.
- Credential
Subject - The notarized claim: who authorized what, on which channel, under which policy, attested by which notary.
- Envelope
Proof - The cryptographic proof block: either a W3C Data Integrity Proof or a detached JWS, per spec §8.2.
- Human
Principal Ref - Reference to the human on whose behalf the agent acted.
- Linked
Mandate - Cross-protocol links carried alongside the send authorization.
- Notarization
Envelope - Top-level APH envelope. JSON-LD compatible W3C VC 2.0 credential.
- Notarization
Metadata - Which notary made the decision, when, and how long it took.
- Notary
Service Ref - Identity of the notary service, used for key discovery (spec §8.4).
- Policy
Descriptor - The authorization decision and the scope that produced it.
- Sealed
Payload - A payload the envelope authorizes but only
SealedReadercan read (spec/aph-0.2.md §1, RFC 0008): verification and readership as independent capabilities. Every hop runs §8.3 in full — the signature covers this ciphertext,bodySha256MAY bind its raw decoded octets — and none but the reader learns the plaintext. - Sealed
Reader - Who may open a sealed payload: a DID and which of its
keyAgreementkeys (spec/aph-0.2.md §1, RFC 0008 §2). Signing keys are never converted to encryption keys; the reader publishes a distinctkeyAgreemententry through the §8.4 surfaces. - Vocabulary
Ref - A published vocabulary, named and pinned.
Enums§
- Attestation
Mode - Which of the two attestation modes an envelope declares (spec §7.1.7).
- Channel
Kind - The closed channel-kind vocabulary (§7.1.5), as a TYPE.
- Content
Class - The closed content-class vocabulary (§7.1.6), as a TYPE.
- Envelope
Proofs - One proof, or a two-element chain (spec §7.1.11).
- Policy
Decision - The closed §7.1.7 policy-decision vocabulary, as a type.
- Recipient
Class - Who consumes what lands on the channel: the closed recipient-class set (§7.1.5, RFC 0005).
Functions§
- parse_
envelope_ json - THE strict-parse entry every text boundary shares: serde’s
member-strict parse plus the wire-version rules that are strict-parse
CLASS but cross-member — today,
sealed_payload_is_declared. Hoisted here because four bindings each carried an identical local copy of the serde half, and a rule added to one copy is a rule the other three silently lack; the hoist is what makes “strict parse” mean ONE thing at every boundary. - sealed_
payload_ is_ declared - The wire-version rule spec/aph-0.2.md §1 states:
sealedPayloadis declared by aphVersion0.2and NOTHING EARLIER. A v0.1.0 verifier refuses the member at strict parse (its structs never learned it); THIS build’s structs have, so the same refusal must come from somewhere — and it is strict-parse CLASS, a plain message below the error vocabulary, exactly like an unrecognized closed-set value: the wire is malformed for the version it claims, which no protocol code describes.