Skip to main content

Authenticator

Trait Authenticator 

Source
pub trait Authenticator:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn accepts(&self, presentation: &Presentation) -> bool;
    fn authenticate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        presentation: &'life1 Presentation,
    ) -> Pin<Box<dyn Future<Output = Result<Authenticated, AuthnRejection>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

One credential kind’s verifier.

Implementations live wherever the verification material does — plexus-idp implements one over its own signing keys, a nostr gateway would implement one over secp256k1 — and are composed by an AuthenticatorChain.

§Contract

  • accepts must be cheap and side-effect free. It is a routing hint; a true from it does not oblige authenticate to succeed.
  • authenticate must return Unsupported if and only if accepts would have returned false. Any other error means the material was this authenticator’s and was rejected.
  • authenticate must not return Authenticated without having verified the material — that is the whole contract of the type.

Required Methods§

Source

fn name(&self) -> &str

A stable, non-secret name for logs, audit records, and capability advertisement.

Source

fn accepts(&self, presentation: &Presentation) -> bool

Does this authenticator handle this presentation?

Source

fn authenticate<'life0, 'life1, 'async_trait>( &'life0 self, presentation: &'life1 Presentation, ) -> Pin<Box<dyn Future<Output = Result<Authenticated, AuthnRejection>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verify the material and name the subject it proves.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§