Backups allow you to save and restore the user's Keyless account. This is useful to give the users the ability to restore their account if the app is deleted.

Retrieve backup data

After each authentication it is possible to fetch the backupData and the backupKey and push them into your backup system. It could be Google Drive, iCloud or your cloud. Each backup is encrypted with aes-gcm using the backupKey as symmetric key.

The backupData and backupKey are required to restore an account with Keyless. Save the Keyless backup info in a secure data store

val configuration = AuthenticationConfiguration.builder

    authenticationConfiguration = configuration,
    onCompletion = { authResult ->
        when (authResult) {
            is Keyless.KeylessResult.Success -> {
                // use the backup
                val backup: KeylessBackup? = authResult.value.backup
            is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Authentication failure - error code ${result.error.code}")

Restore backup data

It is possible to restore the user account providing the backupData and the backupKey to the Keyless SDK.

val configuration = EnrollmentConfiguration.builder
    backupKey = backupKey, 
    backupData = backupData

  enrollmentConfiguration = configuration,
  onCompletion = { result ->
    when (result) {
      is Keyless.KeylessResult.Success -> Log.d("KeylessSDK ", "Enroll success - userId ${result.value.keylessId}")
      is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "Enroll failure - error code ${result.error.code}")

Backup restoration parameters


Using the withBackup method it is possible to pass the object required to restore a backup.

Last updated