baseid_wallet_core/
presenter.rs

1//! Credential presentation operations.
2
3/// Trait for wallet credential presentation.
4#[allow(async_fn_in_trait)]
5pub trait WalletPresenter: Send + Sync {
6    /// Select credentials matching a presentation request.
7    async fn select_credentials(
8        &self,
9        request: serde_json::Value,
10    ) -> baseid_core::Result<Vec<CredentialMatch>>;
11
12    /// Create a presentation from selected credentials with consent tracking.
13    async fn create_presentation(
14        &self,
15        selected: Vec<CredentialSelection>,
16        consent: baseid_pctf::ConsentRecord,
17    ) -> baseid_core::Result<serde_json::Value>;
18}
19
20/// A credential that matches a presentation request.
21#[derive(Debug, Clone)]
22pub struct CredentialMatch {
23    pub credential_id: baseid_core::types::CredentialId,
24    pub format: baseid_core::types::CredentialFormat,
25    pub matching_fields: Vec<String>,
26}
27
28/// A user's selection of credentials and disclosed fields for presentation.
29#[derive(Debug, Clone)]
30pub struct CredentialSelection {
31    pub credential_id: baseid_core::types::CredentialId,
32    pub disclosed_fields: Vec<String>,
33}