Skip to main content

Module envelope

Module envelope 

Source
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.
AgentRef
Reference to the agent that produced the communication.
AppleAurAcceptanceClaim
Last-position sibling struct. Carries Apple Foundation Models AUR acceptance per (user_id, device_id, aur_version_hash) tuple. Embedded as Option<AppleAurAcceptanceClaim> on CredentialSubject.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).
AudienceChannelBinding
The delivery coordinates an audience-bound envelope may be spent on (§7.1.13). kind is drawn from the same closed set as the channel block; every OTHER member is channel-shaped and flattened, mirroring ChannelDescriptor.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.
ChannelDescriptor
Delivery channel and its channel-shaped recipient addressing.
CommunicationDescriptor
What was sent: classification plus the hash that binds this credential to a specific message body.
CredentialSubject
The notarized claim: who authorized what, on which channel, under which policy, attested by which notary.
EnvelopeProof
The cryptographic proof block: either a W3C Data Integrity Proof or a detached JWS, per spec §8.2.
HumanPrincipalRef
Reference to the human on whose behalf the agent acted.
LinkedMandate
Cross-protocol links carried alongside the send authorization.
NotarizationEnvelope
Top-level APH envelope. JSON-LD compatible W3C VC 2.0 credential.
NotarizationMetadata
Which notary made the decision, when, and how long it took.
NotaryServiceRef
Identity of the notary service, used for key discovery (spec §8.4).
PolicyDescriptor
The authorization decision and the scope that produced it.
SealedPayload
A payload the envelope authorizes but only SealedReader can 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, bodySha256 MAY bind its raw decoded octets — and none but the reader learns the plaintext.
SealedReader
Who may open a sealed payload: a DID and which of its keyAgreement keys (spec/aph-0.2.md §1, RFC 0008 §2). Signing keys are never converted to encryption keys; the reader publishes a distinct keyAgreement entry through the §8.4 surfaces.
VocabularyRef
A published vocabulary, named and pinned.

Enums§

AttestationMode
Which of the two attestation modes an envelope declares (spec §7.1.7).
ChannelKind
The closed channel-kind vocabulary (§7.1.5), as a TYPE.
ContentClass
The closed content-class vocabulary (§7.1.6), as a TYPE.
EnvelopeProofs
One proof, or a two-element chain (spec §7.1.11).
PolicyDecision
The closed §7.1.7 policy-decision vocabulary, as a type.
RecipientClass
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: sealedPayload is declared by aphVersion 0.2 and 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.