Skip to main content

TokenVerifier

Trait TokenVerifier 

pub trait TokenVerifier<P>:
    Debug
    + Send
    + Sync
    + 'static
where P: PeerId,
{ // Required method fn verify( &self, token: &str, request: &PeerRequest<P>, ) -> Result<Authorization, Rejection>; }
Expand description

A check of the token a peer presents, which returns what the token authorizes.

A verifier is synchronous, since checking a signature is CPU work. Wrap it in Verify to use it as a Policy.

Required Methods§

fn verify( &self, token: &str, request: &PeerRequest<P>, ) -> Result<Authorization, Rejection>

Verifies token for the request’s peer and returns what it authorizes.

The token is an argument of its own, so a token that does not come from the session’s setup can go through the same verifier.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl<P> TokenVerifier<P> for JwtVerifier
where P: PeerId,

§

impl<P> TokenVerifier<P> for RcanVerifier
where P: PeerId + Borrow<[u8; 32]>,