pub fn verify_proof_structure(
envelope: &NotarizationEnvelope,
) -> Result<AttestationMode, AphError>Expand description
Verifies the structural rules of §7.1.11 and returns the mode the envelope is actually in.
This is the check that makes attestationMode mean something. It
enforces, each with its own APH_E013 reason string:
- a chain carries EXACTLY two proofs;
- position 1 has
proofPurpose == "assertionMethod", position 2"authentication"; - both chain proofs carry an
id, and the two ids differ; - the notary proof’s
previousProofequals the principal proof’sid— array position is a hint, this linkage is the binding (§7.1.11); - the principal proof carries NO
previousProof; it is the chain head; - label and structure agree in BOTH directions: a chain MUST be labelled
PrincipalSigned, andPrincipalSignedMUST be a chain. A mismatch is a rejection, never a silent coercion; - the principal proof’s
verificationMethodis a DID URL undercredentialSubject.humanPrincipal.id. This is the rule that closes the forgery §7.1.11 describes, because the notary does not hold that key.
A single-object proof is a notary proof and yields NotaryAttested —
the shape all eight published example envelopes carry.
A successful return says the structure is sound; it says NOTHING about whether either signature verifies. A caller that reports “the human signed this” on the strength of this function alone is reporting a claim no key has backed.