Skip to main content

API Reference

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 →

MemberSignatureDescription
initializestatic Future<WalletSdk> initialize(WalletSdkOptions options)Wires all modules and returns the singleton. Idempotent; safe to await concurrently. Throws WalletSdkException on empty baseUrl.
isInitializedstatic boolWhether initialization has completed.
optionsWalletSdkOptionsThe options the SDK was initialized with.
authWalletAuthAuthentication module.
credentialsWalletCredentialsCredential storage module.
trustWalletTrustTrust network module.
offerAcceptanceWalletOfferAcceptanceIssuance module (always wired).
presentationWalletPresentationPresentation module (always wired).
listCredentialsFuture<List<VaultCredential>> listCredentials({required String walletExternalId})Convenience for credentials.listCredentials.
getCredentialFuture<VaultCredential?> getCredential(String externalId)Convenience for credentials.getCredential.
acceptOfferFuture<AcceptOfferResult> acceptOffer(AcceptOfferRequest request)Full OID4VCI issuance flow.
presentFuture<PresentResult> present(PresentRequest request)Full OpenID4VP presentation flow.
handleLinkFuture<HandleLinkResult> handleLink(HandleLinkInput input)Classifies and dispatches an inbound wallet URI.
resetForTeststatic Future<void> resetForTest()Clears the singleton between tests (@visibleForTesting).

Configuration​

Guide →

TypeDescription
WalletSdkOptionsHost-supplied configuration for initialize — required baseUrl and storageEncryptionKeyProvider; optional HTTP clients, prompt handler, trust settings, and port overrides.
TrustNetworkModeEnum: off, warn, strict.
WalletSdkExceptionException with message and optional cause.

Authentication — WalletAuth​

Guide →

MethodSignatureDescription
authenticateFuture<AuthResult> authenticate({required String username})Passkey sign-in.
registerFuture<AuthResult> register({required String username, bool requiresPasskeyReset})Create user + passkey; success carries one-time recovery codes.
recoverFuture<AuthResult> recover({required String code, required RecoveryScenario scenario})Recovery-code flow (userNameOnly or fullRecovery).
generateRecoveryCodesFuture<List<String>> generateRecoveryCodes()Fresh recovery codes for the signed-in user.
logoutFuture<void> logout({bool authTokenOnly = true})Sign out; optionally clear the stored username too.
restoreSessionFuture<AuthSession?> restoreSession()Restore a persisted session on cold start.
readStoredCredentialsFuture<({String? token, String? username})> readStoredCredentials()Raw stored token + username.
readStoredUsernameFuture<String?> readStoredUsername()Stored username only.
clearStoredSessionFuture<void> clearStoredSession({bool authTokenOnly = false})Clear local session state without a backend call.
registeredUserIdFuture<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 →

MethodDescription
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 →

TypeDescription
WalletOfferAcceptance.acceptOffer(AcceptOfferRequest)The issuance flow (also on WalletSdk.acceptOffer).
AcceptOfferRequestwalletExternalId, offer, did, optional placeholder, credentialTypesForTrust.
AcceptOfferResultSealed: AcceptOfferSuccess (credential, resolution, isDuplicate, isIssuerTrusted, issuerTrustWarningMessage) / AcceptOfferDeclined / AcceptOfferFailure (message).
CredentialOfferResolutioncredentialIssuer, credentialConfigurationIds, primaryCredentialType, resolveDisplayName().
CredentialOfferExchangePort: backend exchange override.
CredentialOfferUriParserPort: offer deep-link parser override.

Presentation — WalletPresentation​

Guide →

MethodDescription
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).

Guide →

TypeDescription
HandleLinkInputuri, walletExternalId.
HandleLinkResultSealed: HandleLinkCredentialOffer (normalizedOfferUrl) / HandleLinkPresentation (prepared state + matches) / HandleLinkExpired / HandleLinkUnsupported (message) / HandleLinkFailed (message).
WalletUriClassifierclassify(String) → WalletLinkKind.
WalletLinkKindEnum: openId4Vp, credentialOffer, unsupported.

Prompts​

Guide →

TypeDescription
WalletPromptHandlerHost contract: requestPrompt<R>(WalletPrompt<R>) → Future<R>.
WalletPromptRegistryTyped per-prompt callback registry implementing the handler.
WalletPrompt<R> / WalletPromptResponseBase types; every prompt carries a stable id.
WalletPromptIdsStable prompt id constants.
PromptCancelledException / PromptTimeoutExceptionFlow 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, PromptCredentialOptionDisplay models threaded through prompts.

Trust — WalletTrust​

Guide →

MemberDescription
issuerWalletIssuerTrust — getMemberIdByDid, loadIssuerMemberBranding, getCredentialTypePresentation, listIssuersForVerifierAndCredentialType, resolveAssetUrl, plus the IssuerTrustEvaluator port.
verifierWalletVerifierTrust — 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​

ImportExports
package:wallet_sdk/dio.dartDioPlatformHttpClient, PlatformHttpClient — wrap your Dio instance for injection.
package:wallet_sdk/testing.dartFakes (MemoryWalletStorage, …), advanced auth wiring, TrustNetworkApi / TrustNetworkException.
package:wallet_sdk/platform.dartNative channel types for the passkey/secure-store plugins.