Eject a wallet

The eject feature allows a user to construct a private key that can be imported into another wallet manager, such as MetaMask.

Warning: Providing the custodian backup share to the client device puts both MPC shares on a single device, removing the multi-party security benefits of MPC. This operation should only be done for users who want to move off of MPC and into a single private key. Use portal.eject() at your own risk!

Ejecting Your User's Wallets

To eject the private keys for your users' wallets, their two matching backup shares need to be combined. This requires providing the following two shares to portal.eject():

  • User Backup Share - Encrypted backup share received from portal.backup().

  • Custodian Backup Share - Raw backup share received from the POST /backup webhook.

Here's an example implementation:

// Fetch the encrypted user backup share from your API.
let encryptedUserBackupShare = try await yourAPI.fetchEncryptedUserBackupShare(
    userId,
    withBackupMethod: .Password
)

// Fetch the user's custodian backup share from your API.
let custodianBackupShare = try await yourAPI.fetchCustodianBackupShare(
    userId,
    withBackupMethod: .Password
)

// Obtain the private key for the user's SECP256K1 wallet.
let secp256K1PrivateKey = try await portal.eject(
    .Password,
    withCipherText: encryptedUserBackupShare,
    andOrganizationBackupShare: custodianBackupShare
)

SECP256K1 is the curve used by Ethereum.

You can learn more about signing algorithms and curves here.

Eject is only supported for curve SECP256K1. It is not available for ED25519 currently, which is the curve Solana uses. Stay tuned though because we will be releasing eject support for Solana soon.

And that's it! Now your users can obtain a SECP256K1 private key to import their wallet into another wallet manager.

Last updated