Back up a wallet
This guide will walk you through how backups of a user's wallet are set up with Portal.
Last updated
Was this helpful?
This guide will walk you through how backups of a user's wallet are set up with Portal.
Last updated
Was this helpful?
This product is currently in Beta and is under active development.
MPC backups allow your users to recover their MPC wallets in the event that their device is lost, stolen, or is bricked.
Backups are handled in two pieces: and .
At the time of recovery, these two backups are used together to generate new shares to be stored on-device, allowing the user to migrate their wallet with a new device.
Storing a user MPC backup is done by storing an encryption key with the user's cloud storage provider and the encrypted share within your infrastructure.
In order to support user MPC backups, three main dependencies must be met:
You must have cloud storage configured for storing the user's share of the MPC backup
Your server must be able to store the encrypted share
Your app must send the encrypted share to your server for storage
The Web SDK currently support Google Drive as the backup mechanism. When a user backs up their wallet, the encryption key for their backup share is stored in their Google Drive folder.
In order to use the Google Drive functionality for backup you must first get an for your Google Project.
Setting up your oAuth Credential
Go to the .
From the projects list, select a project or create a new one.
If the APIs & services page isn't already open, open the console left side menu and select APIs & services.
On the left, click Credentials.
Click New Credentials, then select OAuth client ID.
For application type, choose Web Application
In the Authorized JavaScript Origins
section, add https://web.portalhq.io
In the Authorized Redirect URIs
section, add https://web.portalhq.io/auth/index.html
If this is your first time creating a client ID, you can also configure your consent screen by clicking Consent Screen. You won't be prompted to configure the consent screen after you do it the first time.
Click Create client ID
To use Google Drive backups with Portal, add the Client ID
for your oAuth Client to your initialization config.
On your server, create an endpoint to accept the encrypted share and store it.
In order to add support for user MPC backups to your app, you must perform three steps:
Generate an encrypted client backup share using portal.mpc.backup
.
Send the resulting backup share to your API and store it.
Storing a custodian MPC backup is done by Portal generating a custodian backup share and sending the share – via webhook
– to be stored within your infrastructure.
In order to support custodian MPC backups, two main dependencies must be met:
Register a webhooks_root
with Portal
Implement the /{webhooks_root}/backup
route in your server to store your backup share
Portal will send the custodian MPC backup share to /{webhooks_root}/backup
via a POST
request. The body of this POST
request will contain two fields:
clientId
- The Portal clientId
for the user
share
- a JSON.stringified
version of the backup share
You must also in your project in order for backup to function properly.
Call portal.api.storedClientBackupShare
to notify Portal that the encrypted client backup share was saved successfully. (Alternatively you can directly.)
You can register your webhooks_root
via the .
Now that you've successfully implemented MPC backups, your app can support .