BindingMigration

Manages the migration of device binding data from the Legacy SDK to the new SDK format.

This object orchestrates a multi-step migration process that transfers:

  • Biometric authentication keys

  • Application PIN keys

  • User key metadata

The migration runs automatically during app initialization via androidx.startup.Initializer and can also be triggered manually by calling start.

Migration Steps

The migration executes three sequential steps:

  1. Step 1 - Migration Preparation: Check if migration is required and prepare the necessary state which required for subsequent steps, including loading existing keys from the Legacy SDK.

  2. Step 3 - User Key Metadata: Migrates user key metadata (UserKey objects) from the Legacy SDK's repository to the new storage system, ensuring continuity of device bindings.

  3. Step 2 - Application PIN Keys: Migrates application PIN keys from the Legacy SDK's encrypted SharedPreferences to the new DataStore-based storage with BouncyCastle encryption.

Usage

Automatic migration (recommended):

// Migration starts automatically when the app initializes
// via MigrationInitializer in the manifest

Manual migration:

// Trigger migration programmatically
BindingMigration.start(context)

Progress Monitoring

The migration emits progress updates through a Flow that can be observed:

See also

Properties

Link copied to clipboard

Logger instance for migration progress and error reporting.

Link copied to clipboard

The migration configuration that defines the sequence of migration steps.

Functions

Link copied to clipboard
suspend fun start(context: Context)

Starts the device binding migration process.