Skip to main content

Verifier

Struct Verifier 

Source
pub struct Verifier<'a> { /* private fields */ }
Expand description

Stateless verifier. Requires a DID resolver to fetch producer keys.

Implementations§

Source§

impl<'a> Verifier<'a>

Source

pub fn new(resolver: &'a WebResolver) -> Self

Source

pub async fn verify_body(&self, body: &Body) -> Result<(), AcdpError>

Full end-to-end verification per RFC-ACDP-0001 §5.11.

Steps:

  1. (Implicit) Check key_id has a #fragment.
  2. Verify key_id DID portion equals body.agent_id.
  3. Resolve the DID document.
  4. Find the verification method by fragment.
  5. Check assertionMethod authorization.
  6. Extract the Ed25519 public key.
  7. Verify the signature over the content_hash ASCII bytes.

(Hash recomputation is step 0, performed first.)

Source

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.

Source

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).

Source

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.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Verifier<'a>

§

impl<'a> !UnwindSafe for Verifier<'a>

§

impl<'a> Freeze for Verifier<'a>

§

impl<'a> Send for Verifier<'a>

§

impl<'a> Sync for Verifier<'a>

§

impl<'a> Unpin for Verifier<'a>

§

impl<'a> UnsafeUnpin for Verifier<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more