Skip to main content

Challenger

Trait Challenger 

Source
pub trait Challenger: Send + Sync {
    // Required method
    fn challenge(
        &self,
        request: ChallengeRequest,
    ) -> Result<Challenge, ProviderError>;
}
Expand description

Issues what a method needs before it can be answered: for a passkey, a challenge the signed answer is bound to.

A separate kind because a challenged sign-in is two calls and Authenticator::authenticate is one: appending a method to that kind would refuse every provider already built. The answer goes through authenticate with Attempt::challenge set to what Challenge::challenge said. A consumer builds one instance per kind, so a challenge issued by one instance must be found by the other: a provider keeps it in a table both read, never in memory.

Required Methods§

Source

fn challenge( &self, request: ChallengeRequest, ) -> Result<Challenge, ProviderError>

Makes a challenge for one sign-in. GUATIAO_ERR_UNSUPPORTED for a method the provider does not challenge, GUATIAO_ERR_NOT_FOUND for a named account it cannot challenge, and error::busy when the source holds too many already.

Trait Implementations§

Source§

impl From<Instance<dyn Challenger>> for Box<dyn Challenger>

Source§

fn from(instance: Instance<dyn Challenger>) -> Self

Converts to this type from the input type.
Source§

impl From<Remote<dyn Challenger>> for Box<dyn Challenger>

Source§

fn from(remote: Remote<dyn Challenger>) -> Self

Converts to this type from the input type.
Source§

impl Kind for dyn Challenger

Source§

const NAME: &'static str = "coqui_challenger"

The kind’s name in a descriptor’s kinds and tables.
Source§

const FLOOR: usize

The size of [Kind::Vtable]: every slot. A table declaring less is refused; a larger one has slots appended after these.
Source§

const FLOOR_HASH: u32 = ChallengerVtable::FLOOR_HASH

FNV-1a over the shape and every method’s name and normalised signature, in table order. A table carrying another number was built from a different declaration of this kind. Read more
Source§

const REQUIRED: &'static [(&'static str, usize)]

Every required slot as (method name, one past its end), so a null one is refused by name.
Source§

const OBJECT: bool = false

Whether this is an object kind (#[guatiao::kind(object)]): a handle one caller owns, with a destroy slot first and &mut self methods, never offered by a registry. See [Object]. Read more
Source§

type Vtable = ChallengerVtable

The repr(C) table, which starts with a [KindHeader].
Source§

fn as_dyn(remote: &Remote<Self>) -> &Self

The trait object over a proxy. The macro writes remote, because only it knows the trait.
Source§

fn as_dyn_mut(remote: &mut Remote<Self>) -> &mut Self

The same, mutably — what an [Object] hands out.
Source§

fn boxed(remote: Remote<Self>) -> Box<Self>

The same, boxed.
Source§

fn shared(remote: Remote<Self>) -> Arc<Self> ⓘ

The same, shared.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Challenger for Instance<dyn Challenger>

Source§

fn challenge( &self, request: ChallengeRequest, ) -> Result<Challenge, ProviderError>

Source§

impl Challenger for Remote<dyn Challenger>

Source§

fn challenge( &self, request: ChallengeRequest, ) -> Result<Challenge, ProviderError>

Implementors§