Skip to content

Commit e28a53c

Browse files
authored
Merge pull request #7577 from BitGo/WP-6950-simple-create
docs(express): simpleCreateV1 API definition
2 parents 7efdf3f + 1db2832 commit e28a53c

File tree

1 file changed

+42
-19
lines changed

1 file changed

+42
-19
lines changed

modules/express/src/typedRoutes/api/v1/simpleCreate.ts

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,73 @@ import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
33
import { BitgoExpressError } from '../../schemas/error';
44

55
export const SimpleCreateRequestBody = {
6-
/** wallet passphrase to encrypt user and backup keys with */
6+
/** Wallet passphrase to encrypt user and backup keys with (required) */
77
passphrase: t.string,
8-
/** wallet label, is shown in BitGo UI */
8+
/** Wallet label shown in BitGo UI */
99
label: optional(t.string),
10-
/** backup keychain xpub, it is HIGHLY RECOMMENDED you generate this on a separate machine!
11-
* BITGO DOES NOT GUARANTEE SAFETY OF WALLETS WITH MULTIPLE KEYS CREATED ON THE SAME MACHINE */
10+
/** Backup keychain xpub generated on a separate machine (HIGHLY RECOMMENDED for security - cannot be used with backupXpubProvider) */
1211
backupXpub: optional(t.string),
13-
/* Provision backup key from this provider (KRS), e.g. "keyternal". Setting this value will create an instant-capable wallet. */
12+
/** Key Recovery Service provider for backup key, e.g. "keyternal" (creates instant-capable wallet - cannot be used with backupXpub) */
1413
backupXpubProvider: optional(t.string),
14+
/** Enterprise ID to create wallet under */
1515
enterprise: optional(t.string),
16-
/** the code used to encrypt the wallet passcode used in the recovery process */
16+
/** Code used to encrypt the wallet passcode for the recovery process */
1717
passcodeEncryptionCode: optional(t.string),
18+
/** Disable transaction notifications for this wallet */
1819
disableTransactionNotifications: optional(t.boolean),
20+
/** Disable KRS email notifications (only applicable when using backupXpubProvider) */
1921
disableKRSEmail: optional(t.boolean),
2022
};
2123

2224
export const SimpleCreateResponse = t.intersection([
2325
t.type({
24-
/** newly created wallet model object */
26+
/** Newly created wallet model object with balance, label, keychains array, and other wallet properties */
2527
wallet: t.UnknownRecord,
26-
/** the newly created user keychain, which has an encrypted xprv stored on BitGo */
28+
/** User keychain with xpub and encryptedXprv (encrypted with passphrase, stored on BitGo) */
2729
userKeychain: t.UnknownRecord,
28-
/** the newly created backup keychain */
30+
/** Backup keychain with xpub (and xprv if created locally - must be backed up immediately) */
2931
backupKeychain: t.UnknownRecord,
30-
/** the BitGo-managed keychain */
32+
/** BitGo-managed keychain with xpub (BitGo holds this key) */
3133
bitgoKeychain: t.UnknownRecord,
3234
}),
3335
t.partial({
34-
/** warning message when backup keychain has xprv */
36+
/** Warning message present only when backup keychain was created locally (has xprv) - reminds you to back it up */
3537
warning: t.string,
3638
}),
3739
]);
3840

3941
/**
40-
* Create Wallet with Keychain
41-
* Create a new 2-of-3 wallet and it's associated keychains.
42-
* Returns the locally created keys with their encrypted xprvs.
42+
* Create Wallet with Keychains
43+
*
44+
* Creates a new 2-of-3 multisignature wallet along with all three required keychains in a single
45+
* operation. This is a convenience method that handles the entire wallet setup process.
46+
*
4347
* **WARNING: BE SURE TO BACKUP! NOT DOING SO CAN RESULT IN LOSS OF FUNDS!**
4448
*
45-
* 1. Creates the user keychain locally on the client, and encrypts it with the provided passphrase
46-
* 2. If no xpub was provided, creates the backup keychain locally on the client, and encrypts it with the provided passphrase
47-
* 3. Uploads the encrypted user and backup keychains to BitGo
48-
* 4. Creates the BitGo key on the service
49-
* 5. Creates the wallet on BitGo with the 3 public keys above
49+
* **Workflow:**
50+
* 1. Creates the user keychain locally and encrypts it with the provided passphrase
51+
* 2. Handles backup keychain based on parameters (see Backup Keychain Strategies below)
52+
* 3. Uploads the encrypted user keychain and backup keychain xpub to BitGo
53+
* 4. Creates the BitGo-managed keychain on the service
54+
* 5. Creates the 2-of-3 multisig wallet on BitGo with all three public keys
55+
*
56+
* **Backup Keychain Strategies:**
57+
* - **KRS Provider (Recommended)**: Set backupXpubProvider to use a Key Recovery Service (e.g., "keyternal")
58+
* - Creates instant-capable wallets
59+
* - Professional key management
60+
* - Cannot be combined with backupXpub
61+
* - **External Xpub (Recommended)**: Provide backupXpub generated on a separate, secure machine
62+
* - Maximum security (keys never on same machine)
63+
* - You control the backup key
64+
* - Cannot be combined with backupXpubProvider
65+
* - **Local Generation (NOT RECOMMENDED)**: If neither backupXpub nor backupXpubProvider provided
66+
* - Creates backup key on same machine as user key (security risk)
67+
* - Response includes warning message and unencrypted backup xprv
68+
* - You MUST back up the backup keychain yourself
69+
*
70+
* **Response:** Returns wallet object and all three keychains. If backup keychain was created
71+
* locally, response includes warning message and the backup keychain will contain xprv (which
72+
* you must securely back up). Otherwise, backup keychain only contains xpub.
5073
*
5174
* @operationId express.v1.wallet.simplecreate
5275
* @tag express

0 commit comments

Comments
 (0)