Backup
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.
The backupData and backupKey are required to restore an account with Keyless. Save the Keyless backup info in a secure data store
Android
iOS
1
let backupResult = Keyless.retrieveKeylessBackup()
2
when(backupResult) {
3
// Handle your backup system logic
4
is Success -> Log.D("KeylessSDK", "Retrieve data for backup successful")
5
// Handle error and display an error to the user.
6
is Failure -> Log.D("KeylessSDK", "Retrieve data for backup failed")
7
}
Copied!
1
let backupResult = Keyless.retrieveDataForBackup()
2
switch backupResult {
3
case .success((let backupData, let backupKey)):
4
// Handle your backup system logic
5
print("Retrieve data for backup successful")
6
case .failure(let error):
7
// Handle error and display an error to the user.
8
print("Retrieve data for backup failed with error: \(error.message)")
9
}
Copied!

Restore backup data

It is possible to restore the user account providing the backupData and the backupKey to the Keyless SDK.
Android
iOS
1
Keyless.enrollFromBackup(
2
backupData = backupData,
3
backupKey = backupKey,
4
onCompletion = { result ->
5
when(result) {
6
// Handle your backup system logic
7
is Success -> Log.D("KeylessSDK", "Enroll from backup successful")
8
// Handle error and display an error to the user.
9
is Failure -> Log.D("KeylessSDK", "Enroll from backup failed")
10
}
11
})
Copied!
1
Keyless.enrollFromBackup(backupData: backupData, backupKey: backupKey) { error in
2
if let error = error {
3
print("Enrollment from backup finished with error: \(error.message)")
4
} else {
5
print("Enrollment from backup finished successfully")
6
}
7
}
Copied!
Last modified 1mo ago
Export as PDF
Copy link