pub struct Verifier<'a> { /* private fields */ }Expand description
Stateless verifier. Requires a DID resolver to fetch producer keys.
Implementations§
Source§impl<'a> Verifier<'a>
impl<'a> Verifier<'a>
pub fn new(resolver: &'a WebResolver) -> Self
Sourcepub async fn verify_body(&self, body: &Body) -> Result<(), AcdpError>
pub async fn verify_body(&self, body: &Body) -> Result<(), AcdpError>
Full end-to-end verification per RFC-ACDP-0001 §5.11.
Steps:
- (Implicit) Check
key_idhas a#fragment. - Verify
key_idDID portion equalsbody.agent_id. - Resolve the DID document.
- Find the verification method by fragment.
- Check
assertionMethodauthorization. - Extract the Ed25519 public key.
- Verify the signature over the content_hash ASCII bytes.
(Hash recomputation is step 0, performed first.)
Sourcepub async fn verify_body_signed(&self, body: &Body) -> Result<(), AcdpError>
pub async fn verify_body_signed(&self, body: &Body) -> Result<(), AcdpError>
Verify only the hash recomputation + DID resolution + signature
envelope, assuming structural validation has already been done by
the caller. Use when you want to separate structural failures
from cryptographic ones — e.g. Self::verify_body itself runs
acdp_validation::validate_body first and then delegates the
hash + signature phases to this method, so the two concerns stay
independently testable.
Sourcepub fn verify_body_hash(&self, body: &Body) -> Result<(), AcdpError>
pub fn verify_body_hash(&self, body: &Body) -> Result<(), AcdpError>
Step 0 only — recompute the content_hash over ProducerContent
and compare against body.content_hash. Lets diagnostic
callers record hash-pass/fail independently of the signature
stage (FEAT-05).
Sourcepub async fn verify_body_signature(&self, body: &Body) -> Result<(), AcdpError>
pub async fn verify_body_signature(&self, body: &Body) -> Result<(), AcdpError>
Steps 1–7 only — resolve the producer’s DID, find the signing
key, verify the signature over the (already-stored)
body.content_hash. Assumes Self::verify_body_hash (or an
equivalent check) has already run.