pub fn require_mode(
envelope: &NotarizationEnvelope,
required: AttestationMode,
) -> Result<(), AphError>Expand description
Refuses an envelope weaker than the caller’s policy demands (§8.3.1 1a).
PrincipalSigned required against a NotaryAttested envelope is
APH_E012. The reverse is fine: a stronger envelope satisfies a weaker
policy. There is no silent downgrade, for the same reason §8.4.6 forbids
downgrading key discovery — an attacker who can defeat the weak path will
always present the weak path.
This reads the DECLARED label, and deliberately so: §8.3.1 puts it at
step 1a precisely so a verifier refuses a too-weak claim before doing
work on unauthenticated input. The label is not evidence on its own, so a
caller MUST also call verify_proof_structure, which is what rejects a
PrincipalSigned label written above a structure that does not support
it. Calling this function alone accepts a forged label.