AppPinConfig

Configuration class for AppPinAuthenticator that defines PIN collection, storage, and security settings.

This DSL-style configuration class provides comprehensive control over how PIN-based authentication is handled, including UI presentation, retry behavior, storage encryption, and keystore management. The configuration follows a builder pattern allowing flexible customization while providing sensible defaults for most use cases.

Key configuration areas:

  • PIN Collection: Customizable UI prompts and collection strategies

  • Security Settings: Retry limits, keystore types, and encryption parameters

  • Storage Configuration: Encrypted storage backends with flexible naming

  • Logging: Configurable logging for debugging and monitoring

Default configuration provides:

  • 3 PIN retry attempts before lockout

  • PKCS12 keystore format for maximum compatibility

  • Encrypted DataStore storage with no caching

  • Automatic UI PIN collector when available

Example usage:

val authenticator = AppPinAuthenticator {
pinRetry = 5
keystoreType = "PKCS12"
prompt {
title = "Authenticate Device"
subtitle = "Enter your PIN"
description = "This PIN protects your device keys"
}
pinCollector { prompt ->
showCustomPinDialog(prompt)
}
storage {
fileName = "my_app_keys"
strongBoxPreferred = true
}
}

Security considerations:

  • PIN attempts are limited to prevent brute force attacks

  • Storage is encrypted using hardware-backed encryption when available

  • KeyStore entries are password-protected with user PIN

  • No caching prevents PIN exposure in memory dumps

Since

1.0.0

See also

EncryptedDataStoreStorage

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

KeyStore type used for storing encrypted private keys.

Link copied to clipboard

Logger instance used for debugging and monitoring authentication operations.

Link copied to clipboard

Maximum number of PIN entry attempts before authentication fails.

Link copied to clipboard

UI prompt configuration for PIN collection dialogs.

Link copied to clipboard

Storage factory function that creates encrypted storage instances.

Functions

Link copied to clipboard
fun pinCollector(block: suspend (Prompt) -> CharArray)

Sets a custom PIN collection strategy.

Link copied to clipboard

Customizes the encrypted storage configuration.