CredentialOrganization

Combined credential organization capabilities for wallets that support both collections and tagging.

Extends CredentialCollections and CredentialTagging so wallets can implement a single interface to provide both capabilities. Code that only needs one capability should prefer the narrower interface.

Example Usage:

val wallet: Wallet = createWallet()

// Use narrower interface when possible
if (wallet is CredentialCollections) {
val collectionId = wallet.createCollection("My Credentials", "Personal credentials")
wallet.addToCollection(credentialId, collectionId)
}
if (wallet is CredentialTagging) {
wallet.tagCredential(credentialId, setOf("important", "verified"))
wallet.addMetadata(credentialId, mapOf("source" to "issuer.com"))
}

// Or use CredentialOrganization for full access
if (wallet is CredentialOrganization) {
wallet.createCollection("My Credentials")
wallet.tagCredential(credentialId, setOf("important"))
}

Functions

Link copied to clipboard
abstract suspend fun addMetadata(credentialId: String, metadata: Map<String, Any>): Boolean

Add metadata to a credential.

Link copied to clipboard
abstract suspend fun addToCollection(credentialId: String, collectionId: String): Boolean

Add a credential to a collection.

Link copied to clipboard
abstract suspend fun createCollection(name: String, description: String? = null): String

Create a new credential collection.

Link copied to clipboard
abstract suspend fun deleteCollection(collectionId: String): Boolean

Delete a collection.

Link copied to clipboard
abstract suspend fun findByTag(tag: String): List<VerifiableCredential>

Find credentials by tag.

Link copied to clipboard
abstract suspend fun getAllTags(): Set<String>

Get all tags used in the wallet.

Link copied to clipboard
abstract suspend fun getCollection(collectionId: String): CredentialCollection?

Get a collection by ID.

Link copied to clipboard
abstract suspend fun getCredentialsInCollection(collectionId: String): List<VerifiableCredential>

Get all credentials in a collection.

Link copied to clipboard
abstract suspend fun getMetadata(credentialId: String): CredentialMetadata?

Get metadata for a credential.

Link copied to clipboard
abstract suspend fun getTags(credentialId: String): Set<String>

Get all tags for a credential.

Link copied to clipboard
abstract suspend fun listCollections(): List<CredentialCollection>

List all collections.

Link copied to clipboard
abstract suspend fun removeFromCollection(credentialId: String, collectionId: String): Boolean

Remove a credential from a collection.

Link copied to clipboard
abstract suspend fun tagCredential(credentialId: String, tags: Set<String>): Boolean

Add tags to a credential.

Link copied to clipboard
abstract suspend fun untagCredential(credentialId: String, tags: Set<String>): Boolean

Remove tags from a credential.

Link copied to clipboard
abstract suspend fun updateNotes(credentialId: String, notes: String?): Boolean

Update notes for a credential.