StorageAdapter

interface StorageAdapter

Protocol for persisting smart account credentials and sessions.

Storage adapters provide a pluggable persistence layer for credentials and sessions. Implementations must be thread-safe and support concurrent access.

The default implementation is InMemoryStorageAdapter, which stores data in memory only. Platform-specific implementations can provide persistent storage.

Inheritors

AndroidStorageAdapter
IndexedDBStorageAdapter
LocalStorageAdapter
KeychainStorageAdapter
UserDefaultsStorageAdapter

Functions

Link copied to clipboard
abstract suspend fun clear()

Clears all credentials from storage.

Link copied to clipboard
abstract suspend fun clearSession()

Clears the current session.

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

Deletes a credential by its ID.

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

Retrieves a credential by its ID.

Link copied to clipboard
abstract suspend fun getAll(): List<StoredCredential>

Retrieves all stored credentials.

Link copied to clipboard
abstract suspend fun getByContract(contractId: String): List<StoredCredential>

Retrieves all credentials associated with a contract address.

Link copied to clipboard
abstract suspend fun getSession(): StoredSession?

Retrieves the current session.

Link copied to clipboard
abstract suspend fun save(credential: StoredCredential)

Saves a credential to storage using upsert semantics.

Link copied to clipboard
abstract suspend fun saveSession(session: StoredSession)

Saves a session to storage.

Link copied to clipboard
abstract suspend fun update(credentialId: String, updates: StoredCredentialUpdate)

Updates a credential with partial changes.