Add Wallet Users

Overview

Wallet admins can send wallet-user invitations to people in their enterprise who have a BitGo account. When you share a wallet with users in your enterprise, you can designate them with one of the following roles:

  • Admin - Able to initiate any wallet transactions, including adding, approving, and removing wallet users.
  • Spender - Able to initiate spend transactions.
  • Viewer - Able to view wallet balances, transactions, and wallet metadata (such as other wallet users).

Prerequisites

Steps

  • SDK
  • API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 import { BitGoAPI } from '@bitgo/sdk-api'; import { Btc, Tbtc } from '@bitgo/sdk-coin-btc'; const bitgo = new BitGoAPI({ accessToken: '<access_token>', env: 'test', }); // Set the id of the wallet to share. const walletId = null; // Set BitGo account email of wallet share recipient. const recipient = null; // Set share permissions as a comma-separated list (e.g. 'view,spend'). // Valid permissions to choose from are: view, spend, manage, admin. const perms = 'view'; // Provide the passphrase for the wallet being shared const passphrase = null; bitgo.register('btc', Btc.createInstance) bitgo.register('tbtc', Tbtc.createInstance) async function main() { const wallet = await bitgo.coin(coin).wallets().get({ id: walletId }); const shareResult = await wallet.shareWallet({ email: recipient, walletPassphrase: passphrase, permissions: perms, }); console.log('Wallet was shared successfully'); console.dir(shareResult); } main().catch(error => console.log(error))

Step Result

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "id": "string", "coin": "string", "wallet": "string", "walletLabel": "My Wallet", "fromUser": "string", "toUser": "string", "permissions": "spend,view", "message": "string", "state": "active", "enterprise": "string", "pendingApprovalId": "string", "keychain": { "pub": "string", "encryptedPrv": "string", "fromPubKey": "string", "toPubKey": "string", "path": "m/1234/1/1" } }

See Also