Skip to main content

Verifier

Struct Verifier 

Source
pub struct Verifier { /* private fields */ }
Expand description

Dependency-injected verifier for attestation and chain verification.

Uses Arc<dyn CryptoProvider> and Arc<dyn ClockProvider> for lifetime-free sharing across async tasks and web server handler state.

Usage:

use std::sync::Arc;
use auths_verifier::{Verifier, SystemClock};
use auths_crypto::RingCryptoProvider;

let verifier = Verifier::native();
let result = verifier.verify_with_keys(&att, &pk).await;

Implementations§

Source§

impl Verifier

Source

pub fn new( provider: Arc<dyn CryptoProvider>, clock: Arc<dyn ClockProvider>, ) -> Self

Create a Verifier with the given crypto provider and clock.

Args:

  • provider: Ed25519 crypto backend.
  • clock: Clock provider for expiry checks.
Source

pub fn native() -> Self

Create a Verifier using the native Ring crypto provider and system clock.

Source

pub async fn verify_with_keys( &self, att: &Attestation, issuer_pk_bytes: &[u8], ) -> Result<VerifiedAttestation, AttestationError>

Verify an attestation’s signatures against the issuer’s public key.

Args:

  • att: The attestation to verify.
  • issuer_pk_bytes: Raw Ed25519 public key of the issuer.
Source

pub async fn verify_with_capability( &self, att: &Attestation, required: &Capability, issuer_pk_bytes: &[u8], ) -> Result<VerifiedAttestation, AttestationError>

Verify an attestation and check that it grants a required capability.

Args:

  • att: The attestation to verify.
  • required: The capability that must be present.
  • issuer_pk_bytes: Raw Ed25519 public key of the issuer.
Source

pub async fn verify_at_time( &self, att: &Attestation, issuer_pk_bytes: &[u8], at: DateTime<Utc>, ) -> Result<VerifiedAttestation, AttestationError>

Verify an attestation against a specific point in time (skips clock-skew check).

Args:

  • att: The attestation to verify.
  • issuer_pk_bytes: Raw Ed25519 public key of the issuer.
  • at: The reference timestamp for expiry evaluation.
Source

pub async fn verify_chain( &self, attestations: &[Attestation], root_pk: &[u8], ) -> Result<VerificationReport, AttestationError>

Verify an ordered attestation chain starting from a known root public key.

Args:

  • attestations: Ordered attestation chain (root first).
  • root_pk: Raw Ed25519 public key of the root identity.
Source

pub async fn verify_chain_with_capability( &self, attestations: &[Attestation], required: &Capability, root_pk: &[u8], ) -> Result<VerificationReport, AttestationError>

Verify a chain and assert that all attestations share a required capability.

Args:

  • attestations: Ordered attestation chain (root first).
  • required: The capability that must appear in every link.
  • root_pk: Raw Ed25519 public key of the root identity.
Source

pub async fn verify_chain_with_witnesses( &self, attestations: &[Attestation], root_pk: &[u8], witness_config: &WitnessVerifyConfig<'_>, ) -> Result<VerificationReport, AttestationError>

Verify a chain and additionally validate witness receipts against a quorum threshold.

Args:

  • attestations: Ordered attestation chain (root first).
  • root_pk: Raw Ed25519 public key of the root identity.
  • witness_config: Witness receipts and quorum threshold to validate.
Source

pub async fn verify_device_authorization( &self, identity_did: &str, device_did: &DeviceDID, attestations: &[Attestation], identity_pk: &[u8], ) -> Result<VerificationReport, AttestationError>

Verify that a specific device is authorized under a given identity.

Args:

  • identity_did: The DID of the authorizing identity.
  • device_did: The device DID to check authorization for.
  • attestations: Pool of attestations to search.
  • identity_pk: Raw Ed25519 public key of the identity.

Trait Implementations§

Source§

impl Clone for Verifier

Source§

fn clone(&self) -> Verifier

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.