Skip to main content

alibi_core/store/contracts/
passkey.rs

1use crate::types::UpdatePasskeyAuthentication;
2use crate::{AuthResult, CreatePasskey, Passkey};
3use async_trait::async_trait;
4#[async_trait]
5pub trait PasskeyStore: Send + Sync {
6    async fn create_passkey(&self, input: CreatePasskey) -> AuthResult<Passkey>;
7    async fn get_passkey_by_id(&self, id: &str) -> AuthResult<Option<Passkey>>;
8    async fn get_passkey_by_credential_id(
9        &self,
10        credential_id: &str,
11    ) -> AuthResult<Option<Passkey>>;
12    async fn list_passkeys_by_user(&self, user_id: &str) -> AuthResult<Vec<Passkey>>;
13    /// Update the verified credential, returning `None` if application code removed its row.
14    /// Storage failures remain errors; an absent row does not invalidate completed verification.
15    async fn update_passkey_authentication(
16        &self,
17        id: &str,
18        update: UpdatePasskeyAuthentication,
19    ) -> AuthResult<Option<Passkey>>;
20    async fn update_passkey_name(&self, id: &str, name: &str) -> AuthResult<Passkey>;
21    async fn delete_passkey(&self, id: &str) -> AuthResult<()>;
22}