Skip to main content

alibi_core/store/
wallets.rs

1//! Optional SIWE wallet persistence. Wallets are concrete plugin records and do
2//! not add an associated entity to application-owned core schemas.
3
4use crate::{AuthError, AuthResult, CreateWalletAddress, WalletAddress};
5use async_trait::async_trait;
6
7#[async_trait]
8pub trait WalletAddressStore: Send + Sync {
9    /// Return the adapter's first address match, optionally restricted to a
10    /// chain. No expiry filter or implicit chain ordering applies.
11    async fn get_wallet_address(
12        &self,
13        _address: &str,
14        _chain_id: Option<f64>,
15    ) -> AuthResult<Option<WalletAddress>> {
16        Err(AuthError::NotImplemented(
17            "Wallet address lookup is not supported by this store".to_owned(),
18        ))
19    }
20
21    /// Validate that the owner exists and insert the wallet under the same
22    /// transaction/lock. User deletion must remove these owned records under
23    /// its transaction/lock, including application-owned user schemas.
24    async fn create_wallet_address(&self, _data: CreateWalletAddress) -> AuthResult<WalletAddress> {
25        Err(AuthError::NotImplemented(
26            "Wallet address creation is not supported by this store".to_owned(),
27        ))
28    }
29}