TokenEncryptionHandler

Interface for defining how Tokens are encrypted before storing in RoomTokenStorage, the default implementation of TokenStorage.

The default implementation is provided, and handles all Credential.Security options. A custom implementation may be useful for more advanced use-cases, and for more fine-grained control in handling biometrics. Custom implementations of TokenEncryptionHandler can be passed to AuthFoundationDefaults.tokenEncryptionHandler.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class EncryptionResult(val encryptedToken: ByteArray, val encryptionExtras: Map<String, String>)

The encryption result when calling TokenEncryptionHandler.encrypt.

Functions

Link copied to clipboard
abstract suspend fun decrypt(encryptedToken: ByteArray, encryptionExtras: Map<String, String>, security: Credential.Security, promptInfo: BiometricPrompt.PromptInfo? = Credential.Security.promptInfo): Token

Decrypt the provided encryptedToken, and return the Token.

Link copied to clipboard

Encrypt the provided token with security, and return the EncryptionResult.

Link copied to clipboard
abstract fun generateKey(security: Credential.Security)

Generate the key with the specified Credential.Security. If a key with Credential.Security.keyAlias already exists, do nothing.