storage

Configures the encrypted storage backend with custom settings.

This method allows customization of the EncryptedDataStoreStorage behavior while preserving any previously configured settings. It uses the andThen pattern to compose configuration blocks, enabling incremental customization.

Common configuration options include:

  • fileName: Custom file name for the storage file

  • keyAlias: Custom alias for the encryption key in Android KeyStore

  • strongBoxPreferred: Enable StrongBox hardware security module (if available)

  • cacheStrategy: Choose between NO_CACHE, IN_MEMORY, or DISK caching

  • encrypted: Enable/disable encryption (encryption strongly recommended)

Example:

storage {
fileName = "custom_keys"
strongBoxPreferred = true
cacheStrategy = CacheStrategy.IN_MEMORY
}

Parameters

block

Configuration block for EncryptedDataStoreStorageConfig customization

See also


Factory function that creates the underlying storage implementation for user key metadata.

This property allows for complete customization of the storage backend while maintaining the same high-level interface. The default implementation uses EncryptedDataStoreStorage with Android DataStore and AES encryption for secure, persistent storage.

Custom implementations can be provided to:

  • Use different storage technologies (Room database, file system, network storage)

  • Implement custom encryption schemes

  • Add data compression or validation

  • Integrate with existing storage systems

The storage must handle List serialization and be thread-safe for concurrent access from multiple coroutines.

Return

A Storage instance configured for List operations

See also

EncryptedDataStoreStorage