Wallet

Unified wallet interface.

A wallet is a composition of capability interfaces. All wallets must implement CredentialStorage. Other capabilities are optional and can be checked using Kotlin's type system against the narrowest interface you need.

Example Usage:

val wallet: Wallet = createWallet()

// Core operations (always available)
val id = wallet.store(credential)
val credential = wallet.get(id)

// Optional capabilities — prefer the narrowest interface you actually need
if (wallet is CredentialCollections) {
wallet.createCollection("My Collection")
}
if (wallet is CredentialTagging) {
wallet.tagCredential(id, setOf("important"))
}

if (wallet is CredentialPresentation) {
val presentation = wallet.createPresentation(
credentialIds = listOf(id),
holderDid = "did:key:holder",
options = proofOptions { ... }
)
}

if (wallet is DidManagement) {
val did = wallet.createDid("key")
println("Wallet DID: ${wallet.walletDid}")
}

// Get statistics
val stats = wallet.getStatistics()
println("Total credentials: ${stats.totalCredentials}")

Inheritors

Properties

Link copied to clipboard

Wallet capabilities for runtime discovery.

Link copied to clipboard
abstract val walletId: String

Wallet identifier (DID or UUID).

Functions

Link copied to clipboard
open override fun close()

Release resources owned by this wallet (e.g. connection pools).

Link copied to clipboard
abstract suspend fun delete(credentialId: String): Boolean

Delete a credential.

Link copied to clipboard
abstract suspend fun get(credentialId: String): VerifiableCredential?

Get a credential by ID.

Link copied to clipboard
open suspend fun getStatistics(): WalletStatistics

Get wallet statistics.

Link copied to clipboard
abstract suspend fun list(filter: CredentialFilter? = null): List<VerifiableCredential>

List credentials matching a filter.

Link copied to clipboard
abstract suspend fun query(query: CredentialQueryBuilder.() -> Unit): List<VerifiableCredential>

Query credentials using a query builder.

Link copied to clipboard
abstract suspend fun store(credential: VerifiableCredential): String

Store a credential.

Link copied to clipboard
inline fun <T> Wallet.withCollections(block: (CredentialCollections) -> T): T?

Extension function for type-safe access to the CredentialCollections capability.

Link copied to clipboard
inline fun <T> Wallet.withDidManagement(block: (DidManagement) -> T): T?

Extension function for type-safe capability access.

Link copied to clipboard
inline fun <T> Wallet.withIssuance(block: (CredentialIssuance) -> T): T?

Extension function for type-safe capability access.

Link copied to clipboard
inline fun <T> Wallet.withKeyManagement(block: (KeyManagement) -> T): T?

Extension function for type-safe capability access.

Link copied to clipboard
inline fun <T> Wallet.withLifecycle(block: (CredentialLifecycle) -> T): T?

Extension function for type-safe capability access.

Link copied to clipboard
inline fun <T> Wallet.withOrganization(block: (CredentialOrganization) -> T): T?

Extension function for type-safe access to the combined CredentialOrganization capability.

Link copied to clipboard
inline fun <T> Wallet.withPresentation(block: (CredentialPresentation) -> T): T?

Extension function for type-safe capability access.

Link copied to clipboard
inline fun <T> Wallet.withTagging(block: (CredentialTagging) -> T): T?

Extension function for type-safe access to the CredentialTagging capability.

Link copied to clipboard

Wraps this wallet so its storage operations are reported to Telemetry.