convertToLegacyExportedData
Converts legacy authenticator data from a StorageClient into a LegacyExportedData object ready to be returned from LegacyStorageProvider.getMigrationData.
This helper uses the SDK's own org.forgerock.android.auth.Account.toJson and org.forgerock.android.auth.Mechanism.toJson methods to serialize each entry, so no manual field mapping is required and all mechanism types (OATH and Push) are handled automatically.
Return
LegacyExportedData containing all accounts and mechanisms ready for migration.
Example
class MyCustomStorageConfiguration(
private val context: Context,
private val storageClient: StorageClient
) : CustomStorageConfiguration {
override suspend fun getMigrationData(context: Context): LegacyExportedData =
withContext(Dispatchers.IO) {
LegacyDataConverter.convertToLegacyExportedData(storageClient)
}
}Content copied to clipboard
Parameters
storageClient
The ForgeRock StorageClient holding the legacy accounts and mechanisms.