Trait CredentialStore

Source
pub trait CredentialStore {
    type PasskeyItem: TryInto<Passkey> + Send + Sync;

    // Required methods
    fn find_credentials<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ids: Option<&'life1 [PublicKeyCredentialDescriptor]>,
        rp_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::PasskeyItem>, StatusCode>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn save_credential<'life0, 'async_trait>(
        &'life0 mut self,
        cred: Passkey,
        user: PublicKeyCredentialUserEntity,
        rp: PublicKeyCredentialRpEntity,
        options: Options,
    ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_credential<'life0, 'async_trait>(
        &'life0 mut self,
        cred: Passkey,
    ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StoreInfo> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Use this on a type that enables storage and fetching of credentials

Required Associated Types§

Source

type PasskeyItem: TryInto<Passkey> + Send + Sync

Defines the return type of find_credentials(…)

Required Methods§

Source

fn find_credentials<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ids: Option<&'life1 [PublicKeyCredentialDescriptor]>, rp_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::PasskeyItem>, StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Find all credentials matching the given ids and rp_id.

If multiple are found, it is recommended to sort the credentials using their creation date before returning as the algorithm will take the first credential from the list for assertions.

Source

fn save_credential<'life0, 'async_trait>( &'life0 mut self, cred: Passkey, user: PublicKeyCredentialUserEntity, rp: PublicKeyCredentialRpEntity, options: Options, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Save the new credential into your store

Source

fn update_credential<'life0, 'async_trait>( &'life0 mut self, cred: Passkey, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the credential in your store

Source

fn get_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StoreInfo> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get information about the store

Implementations on Foreign Types§

Source§

impl CredentialStore for Option<Passkey>

Source§

type PasskeyItem = Passkey

Source§

fn find_credentials<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: Option<&'life1 [PublicKeyCredentialDescriptor]>, _rp_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::PasskeyItem>, StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn save_credential<'life0, 'async_trait>( &'life0 mut self, cred: Passkey, _user: PublicKeyCredentialUserEntity, _rp: PublicKeyCredentialRpEntity, _options: Options, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn update_credential<'life0, 'async_trait>( &'life0 mut self, cred: Passkey, ) -> Pin<Box<dyn Future<Output = Result<(), StatusCode>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StoreInfo> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§