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
acceptsmust be cheap and side-effect free. It is a routing hint; atruefrom it does not obligeauthenticateto succeed.authenticatemust returnUnsupportedif and only ifacceptswould have returnedfalse. Any other error means the material was this authenticator’s and was rejected.authenticatemust not returnAuthenticatedwithout having verified the material — that is the whole contract of the type.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
A stable, non-secret name for logs, audit records, and capability advertisement.
Sourcefn accepts(&self, presentation: &Presentation) -> bool
fn accepts(&self, presentation: &Presentation) -> bool
Does this authenticator handle this presentation?
Sourcefn 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,
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".