Skip to content

baseid-wallet-core

The wallet-core crate provides the business logic for a digital identity wallet, handling credential storage, selection, and presentation.

[dependencies]
baseid-wallet-core = "0.1.0-alpha.1"
use baseid_wallet_core::store::InMemoryStore;
use baseid_wallet_core::wallet::Wallet;
let store = InMemoryStore::new();
let wallet = Wallet::new(store, "did:key:z6MkHolder...".into());
wallet.store_credential("my-degree", jwt_bytes)?;
let credentials = wallet.list_credentials()?;
for (id, _cred) in &credentials {
println!("Stored: {id}");
}
let matches = wallet.match_credentials(&presentation_request)?;
// Returns credentials that satisfy the verifier's requirements
BackendUse Case
InMemoryStoreTesting and development
Custom Store implProduction (SQLite, filesystem, secure enclave)

Implement the Store trait to create a custom backend:

pub trait Store {
fn put(&mut self, id: &str, data: &[u8]) -> Result<()>;
fn get(&self, id: &str) -> Result<Option<Vec<u8>>>;
fn list(&self) -> Result<Vec<String>>;
fn delete(&mut self, id: &str) -> Result<()>;
}

Full API Reference