A guide that goes over all of the various backup methods your users can use.
Passkey + Enclave Backup
Allow customers to create a passkey authenticate and store the private encryption key within a secure enclave.
Implementation Requirements
Initialize the portal config object with a passkey object.
Call backup or recover with passkeys as the backup method argument.
constBackupButton:React.FC= () => {consthandleBackup=async () => {// Get an encryped user backup share from running backup.constcipherText=awaitportal.backupWallet(BackupMethods.Passkey) }return (<button onClick={handleBackup}>Back up your wallet</button> )}exportdefault BackupButton
constBackupButton:React.FC= () => {consthandleBackup=async () => {// Get an encryped user backup share from running backup.constcipherText=awaitportal.backupWallet(BackupMethods.Passkey)try {// Send the backup share to your API and store it.awaitaxios.post('{your_server}/users/[userId]/user-backup-share', { data: { backupMethod:"PASSKEY", cipherText } })// ✅ Notify Portal that the user backup share was stored! 🙌awaitportal.storedClientBackupShare(true,"PASSKEY") } catch (error) {// ❌ Notify Portal that the user backup share was not stored.awaitportal.storedClientBackupShare(false,"PASSKEY") } }return (<button onClick={handleBackup}>Back up your wallet</button> )}exportdefault BackupButton
Password/Pin
Allow users to create a password/pin. Users can either remember the password or store it in a password storage manager.
Implementation Requirements
Create a UI for password input.
Enforce password requirements. Customer can choose between password, PIN code, passcode, or any other text-based input.
If user forgets password there are no additional recovery options.
import axios from'axios'import React, { FC } from'react'import { BackupMethods, usePortal } from'@portal-hq/core'constBackupButton:FC= () => {const [password,setPassword] =useState<string>('')constportal=usePortal()consthandleBackup=async () => {// Get an encryped client backup share from running backup.constcipherText=awaitportal.backupWallet(BackupMethods.Password, { passwordStorageConfig: { pasword } }) }return ( <div><input onChange={setPassword} placeholder="Password/Pin" type="password" value={password}/><button onClick={handleBackup}>Back up your wallet</button></div> )}exportdefault BackupButton
import axios from'axios'import React, { FC } from'react'import { BackupMethods, usePortal } from'@portal-hq/core'constBackupButton:FC= () => {const [password,setPassword] =useState<string>('')constportal=usePortal()consthandleBackup=async () => {// Get an encryped client backup share from running backup.constcipherText=awaitportal.backupWallet(BackupMethods.Password, { passwordStorageConfig: { pasword } })try {// Send the backup share to your API and store it.awaitaxios.post('{your_server}/users/[userId]/user-backup-shares', { data: { backupMethod:"PASSWORD", cipherText } })// ✅ Notify Portal that the user backup share was stored! 🙌awaitportal.api.storedClientBackupShare(true,"PASSWORD") } catch (error) {// ❌ Notify Portal that the user backup share was not stored.awaitportal.api.storedClientBackupShare(false,"PASSWORD") } }return ( <div><input onChange={setPassword} placeholder="Password/Pin" type="password" value={password}/><button onClick={handleBackup}>Back up your wallet</button></div> )}exportdefault BackupButton