AuthorizationStore

class AuthorizationStore(context: Context, keyManager: WalletKeyManager)

Encrypted local storage for authorization records.

Follows the same encryption pattern as SeedVault: AES-256-GCM with the master key from Android Keystore, atomic writes via temp-file-and-rename.

All read/write operations require pre-authenticated ciphers from BiometricGate. The Keystore master key is biometric-gated (per-use), so callers must obtain a cipher through biometric authentication before calling these methods.

Records are queryable by DID, credential ID, and revocation status. Revoked records are kept for audit trail — never deleted.

Constructors

Link copied to clipboard
constructor(context: Context, keyManager: WalletKeyManager)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun findActiveByDid(did: String, decryptCipher: Cipher? = null): List<AuthorizationRecord>

Finds all active (non-revoked) authorization records for a DID.

Link copied to clipboard
fun findById(id: String, decryptCipher: Cipher? = null): AuthorizationRecord?

Finds a specific record by ID.

Link copied to clipboard

Generates a unique ID for a new authorization record.

Link copied to clipboard

Whether any authorization records exist on disk.

Link copied to clipboard
fun listAll(decryptCipher: Cipher? = null): List<AuthorizationRecord>

Lists all records (active and revoked) for audit purposes.

Link copied to clipboard

Creates a cipher initialized for decrypting the authorization store file.

Link copied to clipboard
fun revoke(id: String, encryptCipher: Cipher, decryptCipher: Cipher? = null): Boolean

Revokes an authorization record.

Link copied to clipboard
fun save(record: AuthorizationRecord, encryptCipher: Cipher)

Saves a new authorization record.

Link copied to clipboard
fun warmCache(decryptCipher: Cipher)

Warms the cache by loading from disk. Call this during app startup while biometric auth is already available.