TokenStorage

interface TokenStorage

Platform-agnostic abstraction for persisting and retrieving OAuth2 tokens.

Platform-specific implementations handle encryption, database access, and secure storage. On Android, the existing com.okta.authfoundation.credential.TokenStorage interface adds biometric-aware operations.

Warning: When implementing a custom TokenStorage, it is vitally important that you do not directly invoke any of these methods yourself. These methods are intended to be called on-demand by the other AuthFoundation classes, and the behavior is undefined if these methods are called directly by the developer.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun add(token: TokenInfo, metadata: TokenMetadata): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Stores a new token with associated metadata.

Link copied to clipboard
abstract suspend fun allIds(): ERROR CLASS: Symbol not found for Result<kotlin/collections/List<kotlin/String>>

Returns the IDs of all stored tokens.

Link copied to clipboard
abstract suspend fun getToken(id: String): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/TokenInfo>

Retrieves and decrypts the token with id.

Link copied to clipboard
abstract suspend fun metadata(id: String): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/TokenMetadata?>

Returns metadata for the token with id, or null if not found.

Link copied to clipboard
abstract suspend fun remove(id: String): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Removes the token with id from storage. Does nothing if the provided id does not exist.

Link copied to clipboard
abstract suspend fun replace(token: TokenInfo): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Replaces an existing token with the same ID atomically.

Link copied to clipboard
abstract suspend fun setMetadata(metadata: TokenMetadata): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Updates the metadata for an existing token.