Multi-backup migration guide
Transitioning from MPC version v5 to v6.
What is Multi-Backup?
Multi-backup enhances data security by allowing users to utilize multiple backup methods, ensuring greater resilience and recovery options. In previous versions, recovery attempts could fail if they didn't match the latest backup method used. With multi-backup, users can recover data using any of the methods they've backed up with, such as GDRIVE
, ICLOUD
,PASSWORD
, or PASSKEY
.
Key Changes in the Migration
Webhook Adjustments:
POST /backup
: Now includes a"backupMethod"
key.POST /backup/fetch
: Replaces"backupShare"
with"backupShares"
.
API Endpoint Modifications: The
POST /stored-client-backup-share
endpoint now requires"backupMethod"
.Database Schema Alterations: To support multi-backup, you may need to modify your database schema.
Applicable SDK Version Upgrades
This guide is applicable for the following SDK upgrades:
Database Changes
Multi-backup requires storing both custodian and user backup shares by their respective backup method. We recommend the following database model structure:
For assistance or more details on structuring your database for this migration, please reach out to our team, we are here to help! 😊
Webhook Changes
Before upgrading to multi-backup, update your webhook implementations. These new implementations are backwards compatible. Here's what you need to account for:
POST /backup
: This request now includes a backupMethod
key. Store the custodian backup share accordingly.
Example body:
Be sure to store the share
for the user by backupMethod.
Store the share
for the user by backupMethod.
Since a user can now have a backup share per backup method. If a share
already exists for that user with the same backupMethod
, delete the old share and keep the new one.
POST /backup/fetch
: Expect an array of backup shares in the response, reflecting the user's multiple backup methods.
SDK + REST API Changes
Storing the Encrypted User Backup Share: After
portal.backup()
, store the returnedcipherText
by the backup method that was used in your database.Upgrading the API Endpoint to v2: Use
PUT https://api.portalhq.io/api/v2/clients/me/wallet/stored-client-backup-share
, providing thebackupMethod
in the request body. You can provide it in the request body like this:
Retrieving the User Backup Share: Update your retrieval process to match the backup method used in
portal.recover()
.Update
isMultiBackupEnabled
feature flag: Update the feature flagisMultiBackupEnabled
totrue
when instantiating Portal.
You did it! 🙌 You've successfully navigated the intricacies of enabling multiple backups for your users. Please reach out if you have any questions or if we can assist in any way.
Last updated