Documentation Hub
Mobile SDK
Mobile SDK
  • Keyless SDK Documentation
  • Introduction
    • 🧩Components
    • ⚙️Integration Flows
    • 🤳Sample Apps
  • 📱Mobile SDK Guide
    • 1️⃣ Getting started
    • 2️⃣ Enrollment
    • 3️⃣ Authentication
    • 4️⃣ De-Enrollment
    • 5️⃣ Backup
    • 6️⃣ User and device management
  • 📱Mobile SDK Reference
    • UI Customization
    • Error handling
    • Liveness Settings
    • JWT signing
    • PIN authentication
    • Introduce Keyless to Users
  • 📱Mobile SDK Use Cases
    • Account recovery
    • Dynamic Linking
  • 📒Mobile SDK Changelog
    • Changelog
  • 💽Server API
    • Getting Started
    • Users
    • Devices
    • Operations
Powered by GitBook
On this page
  • Create a backup (not recommended)
  • Restore from a backup (not recommended)

Was this helpful?

  1. Mobile SDK Guide

5️⃣ Backup

Last updated 2 months ago

Was this helpful?

Backup data is no longer the recommended approach to perform account recovery, and the feature has been removed from Android and iOS SDKs. The recommended flow is using the temporary state. Follow the guide on .

Back up your user's data so you can restore their Keyless account when necessary.

Create a backup (not recommended)

Create backups after authentication, and push them into your backup system. Each backup is encrypted with aes-gcm using the backupKey as symmetric key. You need both backupData and backupKey to restore an account with Keyless.

import 'package:keyless_flutter_sdk/keyless.dart';
import 'package:keyless_flutter_sdk/models/configurations/authentication_configuration.dart';

// Retrieve temporary state during authentication
final configuration = BiomAuthConfig(shouldRetrieveTemporaryState: true);

try {
    final result = await Keyless.instance.authenticate(configuration);
    if (result.temporaryState != null) {
        print("Temporary state retrieved successfully");
        // Store temporaryState securely
    }
} catch (error) {
    print("Failed to retrieve temporary state: $error");
}

Restore from a backup (not recommended)

Restore the user account by providing backupData and backupKey to the withBackup method:

import 'package:keyless_flutter_sdk/keyless.dart';
import 'package:keyless_flutter_sdk/models/configurations/enrollment_configuration.dart';

// Create enrollment configuration with backup
final configuration = BiomEnrollConfig(
    backup: KeylessBackup(
        data: backupData,
        key: backupKey
    )
);

try {
    final result = await Keyless.instance.enroll(configuration);
    print("Enrollment from backup successful");
} catch (error) {
    print("Enrollment from backup failed: $error");
}
📱
account recovery