Skip to main content
Allow customers to use their existing Firebase Authentication to authenticate into a secure enclave that holds the encryption key for the user. The Portal SDK leverages Firebase ID tokens to securely store and retrieve encryption keys from the secure enclave.

How it works

  1. Your app signs the user in with Firebase Auth (Email/Password, Google Sign-In, Phone, or any other Firebase Auth provider).
  2. You configure the Portal SDK with a callback that returns a fresh Firebase ID token.
  3. During backup, the SDK encrypts the client backup share and stores the encryption key in the secure enclave, authenticated by the Firebase ID token.
  4. During recovery, the SDK retrieves the encryption key from the secure enclave using the same authentication, then decrypts the backup share to restore the wallet.

Prerequisites

  1. A Firebase project with Firebase Authentication enabled.
  2. At least one sign-in provider configured in Firebase Auth (Email/Password, Google Sign-In, Apple Sign-In, etc.).
  3. Your Firebase project registered with Portal (see below).

Register your Firebase project with Portal

You must register your Firebase project with Portal so that the secure enclave can validate your users’ Firebase ID tokens.
  1. Go to the Portal Dashboard.
  2. Navigate to Configuration > Webhooks.
  3. In the Firebase Backup Authentication section, enter your Firebase Project ID and save.
You can also register the JWT provider programmatically via the Custodian API:
curl -X POST https://api.portalhq.io/api/v3/custodians/me/jwt-provider \
  -H "Authorization: Bearer YOUR_CUSTODIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "firebase",
    "projectId": "your-firebase-project-id"
  }'

Add Firebase to your app

If you have not already set up Firebase in your iOS app, follow the Firebase iOS setup guide. At a minimum, you need to:
  1. Add your iOS app in the Firebase Console.
  2. Download the GoogleService-Info.plist file and add it to your Xcode project.
  3. Add the FirebaseAuth dependency via Swift Package Manager or CocoaPods.
  4. Call FirebaseApp.configure() in your AppDelegate or app entry point.

Supported platforms

Firebase Auth Backup is currently available on:
Support for React Native and Web is coming soon.