Skip to content

Commit b6a51df

Browse files
authored
Merge pull request #7569 from BitGo/WP-6950-accept-share
docs(express): acceptShareV1 API definition
2 parents 9496493 + 050b1e2 commit b6a51df

1 file changed

Lines changed: 63 additions & 8 deletions

File tree

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

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,82 @@ export const AcceptShareRequestParams = {
88
};
99

1010
export const AcceptShareRequestBody = {
11-
/** User's password for authentication */
11+
/**
12+
* User's password for authentication.
13+
* Required when accepting shares with spend/admin permissions that include encrypted keychains,
14+
* unless overrideEncryptedXprv is provided. Used to decrypt the user's ECDH keychain
15+
* for deriving the shared secret that decrypts the shared wallet keys.
16+
*/
1217
userPassword: optional(t.string),
13-
/** New passphrase to encrypt the shared wallet's keys */
18+
/**
19+
* New passphrase to encrypt the shared wallet keys with.
20+
* If not provided, defaults to userPassword. This passphrase will be required
21+
* for future wallet operations that need to decrypt the wallet keys.
22+
* Only applicable when accepting shares with encrypted keychains.
23+
*/
1424
newWalletPassphrase: optional(t.string),
15-
/** Optional encrypted xprv to use instead of generating a new one */
25+
/**
26+
* Pre-encrypted wallet xprv received through an out-of-band secure channel.
27+
* When provided, bypasses the ECDH key derivation and decryption process.
28+
* Use this only if you received the encrypted key separately from the share invitation.
29+
* The xprv must already be encrypted with your desired passphrase.
30+
*/
1631
overrideEncryptedXprv: optional(t.string),
1732
};
1833

1934
/** Response from accepting a wallet share */
2035
export const AcceptShareResponse = t.type({
21-
/** Indicates whether the share state was changed by this operation */
36+
/**
37+
* Indicates whether the share state was changed by this operation.
38+
* true: The share was successfully accepted (state changed from pending to accepted).
39+
* false: The share was already in the target state (already accepted).
40+
*/
2241
changed: t.boolean,
23-
/** Current state of the wallet share */
42+
/**
43+
* Current state of the wallet share after the operation.
44+
* Possible values: 'accepted', 'rejected', 'active', 'pendingapproval', 'canceled'
45+
* Should be 'accepted' after a successful acceptance.
46+
*/
2447
state: t.string,
2548
});
2649

2750
/**
2851
* Accept a Wallet Share
29-
* Allows users to accept a wallet share invitation from another user.
30-
* When a wallet is shared with a user, they need to accept the share to gain access
31-
* to the wallet according to the permissions granted by the sharing user.
52+
*
53+
* Accepts a wallet share invitation from another user, granting access to the shared wallet
54+
* according to the permissions specified by the sharing user.
55+
*
56+
* ## Wallet Share Permissions
57+
* - **View**: Read-only access to wallet information and transactions
58+
* - **Spend**: Ability to create and sign transactions
59+
* - **Admin**: Full control including user management and settings
60+
*
61+
* ## Acceptance Workflow
62+
*
63+
* The acceptance process varies based on the share type:
64+
*
65+
* ### 1. View-Only Shares
66+
* No encryption processing needed. The share is accepted immediately without requiring userPassword.
67+
*
68+
* ### 2. Spend/Admin Shares with Keychain (Standard Path)
69+
* Uses ECDH (Elliptic Curve Diffie-Hellman) key sharing:
70+
* - Requires `userPassword` to decrypt your ECDH keychain
71+
* - Derives a shared secret between you and the sharing user
72+
* - Decrypts the shared wallet keys using this secret
73+
* - Re-encrypts the keys with `newWalletPassphrase` (or `userPassword` if not specified)
74+
* - Stores the encrypted keys for future wallet operations
75+
*
76+
* ### 3. Override Path (Out-of-Band Key Exchange)
77+
* When `overrideEncryptedXprv` is provided:
78+
* - Bypasses the ECDH key derivation process
79+
* - Uses the pre-encrypted xprv directly
80+
* - No password required (keys are already encrypted)
81+
*
82+
* ## Security Notes
83+
* - `userPassword` must match your BitGo account password
84+
* - `newWalletPassphrase` should be strong and securely stored
85+
* - The ECDH key exchange ensures only the intended recipient can decrypt the wallet keys
86+
* - `overrideEncryptedXprv` should only be used for keys received through a separate secure channel
3287
*
3388
* @operationId express.v1.wallet.acceptShare
3489
* @tag express

0 commit comments

Comments
 (0)