Eject keys

Key eject lets a Smart Wallet user rebuild the full private key from their backup share and Tatum's backup share; signing through Tatum then stops.

Key eject lets a user exit the MPC model and reconstruct their full private key outside of Tatum. It is an escape hatch - once ejected, the wallet can no longer sign through Tatum's MPC signing service.

How Eject Works

  1. You (the custodian) enable eject for a wallet with a time window using wallets.custodian.enableEject()
  2. The client retrieves their encrypted backup share and Tatum's custodian backup share using client.getEjectableBackupShares()
  3. The client decrypts their backup share and passes both shares to client.reconstructPrivateKey(), which rebuilds the private key locally
  4. The client calls client.completeEject() to mark the wallet as ejected in Tatum

The wallet is then marked as ejected (ejectedAt is set on the client). No further signing is possible through Tatum.

Before You Start

  • The wallet has a backup. Eject combines the client backup share with Tatum's custodian backup share. Without a backup, there is nothing to reconstruct from (see Backup Wallet).
  • You know the wallet ID and curve. Eject works per wallet, and each wallet has one curve. Read both from getClientDetails():
const details = await client.getClientDetails();
const wallet = details.wallets?.find((w) => w.curve === "SECP256K1");
const walletId = wallet?.id; // pass this as walletId below
  • The eject window is open. The custodian must call enableEject() for that wallet first, and the client must fetch the shares before ejectableUntil passes. The wallet's current window shows as ejectableUntil in its entry in details.wallets.

Enable Eject

Eject must be explicitly enabled by the custodian. You set an ejectableUntil timestamp (ISO 8601, at least one minute in the future) that limits the window during which the client can pull the shares:

// Allow eject for 7 days
const result = await wallets.custodian.enableEject({
  path: { clientId: "{CLIENT_ID}" },
  body: {
    walletId: "{WALLET_ID}",
    ejectableUntil: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
  },
});

console.log(result.ejectableUntil); // ISO timestamp

Retrieve Ejectable Backup Shares

From the client side (client fetches their own shares). backupMethod is required: "GDRIVE", "ICLOUD", "PASSWORD" or "PASSKEY". The shares come back under data:

const { data } = await client.getEjectableBackupShares({
  path: { walletId: "{WALLET_ID}" },
  query: { backupMethod: "PASSWORD" },
});

// data?.encryptedClientBackupShare — client's encrypted backup share, or null if none is stored for this backup method
// data?.custodianBackupShare       — Tatum's custodian backup share

A successful client-side fetch clears the wallet's ejectableUntil, so reconstruct the key from that response. If the client stored its backup ciphertext on your own backend instead of with Tatum, encryptedClientBackupShare is null and you decrypt your own copy.

From the custodian side (you fetch on behalf of the client). This call returns the shares directly, without a data wrapper:

const ejectable = await wallets.custodian.getEjectableBackupShares({
  path: {
    clientId: "{CLIENT_ID}",
    walletId: "{WALLET_ID}",
  },
});

// ejectable.custodianBackupShare       — Tatum's backup share
// ejectable.encryptedClientBackupShare — client's encrypted backup share, if it is stored with Tatum

Reconstruct the Private Key

Decrypt the client backup share with the key you used at backup time (see Encrypt Shares), then pass it with the custodian backup share to reconstructPrivateKey():

if (!data?.encryptedClientBackupShare || !data.custodianBackupShare) {
  throw new Error("Ejectable backup shares are missing");
}

const clientShare = decryptShare(data.encryptedClientBackupShare, userKey); // your decryption

const privateKey = await client.reconstructPrivateKey({
  curve: "SECP256K1", // the wallet's curve
  clientShare,
  custodianShare: data.custodianBackupShare,
});
ParameterTypeDescription
curve"SECP256K1" | "ED25519"The wallet's curve
clientSharestring | object | Uint8ArrayThe decrypted client backup share (the plaintext of encryptedClientBackupShare)
custodianSharestring | object | Uint8ArraycustodianBackupShare from getEjectableBackupShares()

It returns a Promise<string> with the private key:

  • SECP256K1: a 64-character hex string, without a 0x prefix
  • ED25519: a Base58 string (the 32-byte key scalar, little-endian)

Reconstruction runs locally and makes no network call. It throws if a share is malformed or if the key it derives doesn't match the public key in the client share. The function is also exported on its own, so you can run it without a client, for example on the custodian side:

import { reconstructPrivateKey } from "@tatumio/wallet-sdk";

const privateKey = await reconstructPrivateKey({
  curve: "ED25519",
  clientShare: decryptedClientBackupShare,
  custodianShare: ejectable.custodianBackupShare!,
});

Treat the returned key as highly sensitive: never log it or send it over an unencrypted channel.

Complete Eject

After the client has reconstructed their key, call completeEject() to finalize:

await client.completeEject({
  path: { walletId: "{WALLET_ID}" },
});

This sets ejectedAt on the client and prevents further MPC signing through Tatum. completeEject() returns no data and is available on the client side only.

Ownership & Exit Guarantees

  • Eject requires both the client's backup share (held by them) and Tatum's custodian backup share
  • Tatum enforces the ejectableUntil window and does not release its backup share after the window closes
  • completeEject() is irreversible — the wallet cannot return to MPC signing through Tatum after ejection
  • If backup shares were not created before eject, key reconstruction is impossible

Always create a backup before enabling eject.


Did this page help you?