The complete public surface of package:wallet_sdk/wallet_sdk.dart, grouped by module. Each section links to the guide that covers usage in depth.
WalletSdk
Entry point. Initialize once, then use instance members. Guide →
| Member | Signature | Description |
|---|
initialize | static Future<WalletSdk> initialize(WalletSdkOptions options) | Wires all modules and returns the singleton. Idempotent; safe to await concurrently. Throws WalletSdkException on empty baseUrl. |
isInitialized | static bool | Whether initialization has completed. |
options | WalletSdkOptions | The options the SDK was initialized with. |
auth | WalletAuth | Authentication module. |
credentials | WalletCredentials | Credential storage module. |
trust | WalletTrust | Trust network module. |
offerAcceptance | WalletOfferAcceptance | Issuance module (always wired). |
presentation | WalletPresentation | Presentation module (always wired). |
listCredentials | Future<List<VaultCredential>> listCredentials({required String walletExternalId}) | Convenience for credentials.listCredentials. |
getCredential | Future<VaultCredential?> getCredential(String externalId) | Convenience for credentials.getCredential. |
acceptOffer | Future<AcceptOfferResult> acceptOffer(AcceptOfferRequest request) | Full OID4VCI issuance flow. |
present | Future<PresentResult> present(PresentRequest request) | Full OpenID4VP presentation flow. |
handleLink | Future<HandleLinkResult> handleLink(HandleLinkInput input) | Classifies and dispatches an inbound wallet URI. |
resetForTest | static Future<void> resetForTest() | Clears the singleton between tests (@visibleForTesting). |
Configuration
Guide →
| Type | Description |
|---|
WalletSdkOptions | Host-supplied configuration for initialize — required baseUrl and storageEncryptionKeyProvider; optional HTTP clients, prompt handler, trust settings, and port overrides. |
TrustNetworkMode | Enum: off, warn, strict. |
WalletSdkException | Exception with message and optional cause. |
Authentication — WalletAuth
Guide →
| Method | Signature | Description |
|---|
authenticate | Future<AuthResult> authenticate({required String username}) | Passkey sign-in. |
register | Future<AuthResult> register({required String username, bool requiresPasskeyReset}) | Create user + passkey; success carries one-time recovery codes. |
recover | Future<AuthResult> recover({required String code, required RecoveryScenario scenario}) | Recovery-code flow (userNameOnly or fullRecovery). |
generateRecoveryCodes | Future<List<String>> generateRecoveryCodes() | Fresh recovery codes for the signed-in user. |
logout | Future<void> logout({bool authTokenOnly = true}) | Sign out; optionally clear the stored username too. |
restoreSession | Future<AuthSession?> restoreSession() | Restore a persisted session on cold start. |
readStoredCredentials | Future<({String? token, String? username})> readStoredCredentials() | Raw stored token + username. |
readStoredUsername | Future<String?> readStoredUsername() | Stored username only. |
clearStoredSession | Future<void> clearStoredSession({bool authTokenOnly = false}) | Clear local session state without a backend call. |
registeredUserId | Future<String?> registeredUserId(String username) | Registered user id for a username, when known. |
Models: AuthResult (AuthSuccess / UsernameRecovered / AuthFailure), AuthSession (token, username, userId, issuedAt), AuthErrorCode (enum), RecoveryScenario (enum), AuthObserver (interface: onAuthenticated, onLoggedOut, onAuthError).
Credential storage — WalletCredentials
Guide →
| Method | Description |
|---|
listCredentials({required walletExternalId}) | Active credentials in a wallet. |
getCredential(externalId) | One credential by id, or null. |
getCredentialByTypeAndIssuer({...}) | Existing credential with the same type and issuer. |
isDuplicate({credential, walletExternalId}) | Duplicate check. |
saveCredential({credential, walletExternalId, checkDuplicate}) | Persist a credential; returns its id. |
deleteCredential(externalId) | Soft delete. |
ensureWallet({externalId, userId, name}) | Upsert the local wallet record. |
getWalletByUserId(userId) / getWalletByExternalId(externalId) | Wallet lookups → StoredWallet?. |
upsertDid({walletExternalId, did, ...}) | Store/update the holder DID. |
getDidByWalletExternalId(walletExternalId) | DID row for a wallet. |
insertSharingLog(row) / getSharingLogsForCredential(id) / getAllSharingLogs() / getSharingLogById(id) / updateSharingLogStatus(id, status) / deleteSharingLog(id) | Sharing-log audit trail. |
Models: VaultCredential (id, wallet, document, disclosures, format, parsedDocument, addedOn, deletedOn, pending; fromJson/toJson/copyWith), StoredWallet (localId, externalId, userId, name, createdAt, updatedAt).
Issuance — WalletOfferAcceptance
Guide →
| Type | Description |
|---|
WalletOfferAcceptance.acceptOffer(AcceptOfferRequest) | The issuance flow (also on WalletSdk.acceptOffer). |
AcceptOfferRequest | walletExternalId, offer, did, optional placeholder, credentialTypesForTrust. |
AcceptOfferResult | Sealed: AcceptOfferSuccess (credential, resolution, isDuplicate, isIssuerTrusted, issuerTrustWarningMessage) / AcceptOfferDeclined / AcceptOfferFailure (message). |
CredentialOfferResolution | credentialIssuer, credentialConfigurationIds, primaryCredentialType, resolveDisplayName(). |
CredentialOfferExchange | Port: backend exchange override. |
CredentialOfferUriParser | Port: offer deep-link parser override. |
Presentation — WalletPresentation
Guide →
| Method | Description |
|---|
present(PresentRequest) | Full presentation flow (also on WalletSdk.present). |
prepare(PreparePresentationInput) | Resolve a request into a PreparedPresentation without prompting. |
start(StartPresentationRequest) | Returns a PresentationSession; reuses prepared state when provided. |
matchCredentials({walletExternalId, presentationDefinition}) | Credentials satisfying the definition. |
evaluateCandidates({walletExternalId, presentationDefinition}) | Per-credential evaluation → List<PresentationCandidate>. |
extractFields(definition) | Requested fields → List<PresentationField>. |
extractFieldsForDescriptorId(definition, descriptorId) | Fields for one input descriptor. |
extractPurpose(definition) | Verifier-stated purpose. |
extractRawCredentialTypes(definition) | Raw requested credential type strings. |
isSelectiveDisclosure({presentationDefinition, presentationUrl}) | Whether the SD-JWT flow applies. |
credentialJsonForPresentation(vc) | Display JSON for a credential. |
readFieldValue({fieldKey, fields, credentialJson}) | Display value for a requested field. |
detectFieldConflicts({...}) | Conflicting field values across credentials. |
fetchJarRequestObject(requestUri) | Fetch + parse a JAR Request Object JWT. |
Models: PresentRequest, PresentResult (PresentSuccess / PresentDeclined / PresentAddCredentialNeeded / PresentFailure), PreparedPresentation, StartPresentationRequest, PresentationSession (buildPresentRequest(), present()), PresentationCandidate (credential, descriptorId, satisfiesRequest, missingRequiredFieldPaths), PresentationField (path, fieldKey, displayName, isRequired, purpose), PresentationExchange (port).
Deep links
Guide →
| Type | Description |
|---|
HandleLinkInput | uri, walletExternalId. |
HandleLinkResult | Sealed: HandleLinkCredentialOffer (normalizedOfferUrl) / HandleLinkPresentation (prepared state + matches) / HandleLinkExpired / HandleLinkUnsupported (message) / HandleLinkFailed (message). |
WalletUriClassifier | classify(String) → WalletLinkKind. |
WalletLinkKind | Enum: openId4Vp, credentialOffer, unsupported. |
Prompts
Guide →
| Type | Description |
|---|
WalletPromptHandler | Host contract: requestPrompt<R>(WalletPrompt<R>) → Future<R>. |
WalletPromptRegistry | Typed per-prompt callback registry implementing the handler. |
WalletPrompt<R> / WalletPromptResponse | Base types; every prompt carries a stable id. |
WalletPromptIds | Stable prompt id constants. |
PromptCancelledException / PromptTimeoutException | Flow cancellation signals. |
CredentialAcceptancePrompt | → CredentialAcceptanceAccepted / CredentialAcceptanceDeclined. |
SelectCredentialPrompt | → CredentialChosen / AddCredentialRequested / RejectRequested. |
SelectDisclosuresPrompt | → DisclosuresSelected / DisclosureSelectionCancelled. |
ConfirmPresentationPrompt | → PresentationConfirmed / PresentationConfirmationCancelled. |
VerifierTrustPrompt | → ProceedDespiteUntrustedVerifier / AbortUntrustedVerifier. |
ConfirmRejectionPrompt | → RejectionConfirmed / RejectionCancelled. |
RecoverableErrorPrompt | → RetryRequested / FlowAborted; carries WalletFlowStage, code, retryable. |
PromptParty, PromptTrustLevel, PromptClaim, PromptCredentialPreview, PromptCredentialOption | Display models threaded through prompts. |
Trust — WalletTrust
Guide →
| Member | Description |
|---|
issuer | WalletIssuerTrust — getMemberIdByDid, loadIssuerMemberBranding, getCredentialTypePresentation, listIssuersForVerifierAndCredentialType, resolveAssetUrl, plus the IssuerTrustEvaluator port. |
verifier | WalletVerifierTrust — checkVerifierTrust, loadVerifierBranding, explainCredentialNotAcceptableByVerifier, getMemberById, prepareOpenId4VpTrust, validateVerifierEndpoints. |
clearCacheOnLogout() | Clears cached trust-network data. |
Models: VerifierTrustCheckResult, VerifierEntityBranding, IssuerMemberBranding, IssuerListResult / IssuerListItem, CredentialTypePresentation, OpenId4VpTrustContext; ports IssuerTrustEvaluator, VerifierTrustEvaluator.
Secondary entry points
| Import | Exports |
|---|
package:wallet_sdk/dio.dart | DioPlatformHttpClient, PlatformHttpClient — wrap your Dio instance for injection. |
package:wallet_sdk/testing.dart | Fakes (MemoryWalletStorage, …), advanced auth wiring, TrustNetworkApi / TrustNetworkException. |
package:wallet_sdk/platform.dart | Native channel types for the passkey/secure-store plugins. |