createEncryptedTokenStorage

fun createEncryptedTokenStorage(configuration: OAuth2ClientConfiguration, dbPath: String = ".okta", encryptionKeyProvider: () -> SecretKey? = null): RoomTokenStorage

Creates a RoomTokenStorage for JVM applications with AES-256-GCM encryption.

The encryption handler uses JceTokenEncryptionHandler by default, which manages encryption keys at ~/.okta/.encryption_key (Base64 encoded). Custom key providers can be supplied via encryptionKeyProvider.

Return

a configured RoomTokenStorage instance with encryption enabled.

Parameters

configuration

the OAuth2ClientConfiguration used to reconstruct tokens.

dbPath

the file system path for the database. Defaults to ~/.okta/common_token_database.

encryptionKeyProvider

optional lambda to provide a custom SecretKey. Defaults to JCE key management.