Skip to content

Commit d22cc1d

Browse files
committed
fix(express): createLocalKeyChain type codec
Ticket: WP-6717
1 parent b967950 commit d22cc1d

File tree

2 files changed

+114
-186
lines changed

2 files changed

+114
-186
lines changed

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

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

55
/**
6-
* Request parameters for creating a local keychain
6+
* Request body for creating a local keychain
77
*/
88
export const CreateLocalKeyChainRequestBody = {
9-
/** Optional seed for key generation (use with caution) */
9+
/** Optional seed for key generation (hex string that will be converted to Buffer internally) */
1010
seed: optional(t.string),
11+
/** Whether to generate a root key pair (uses generateRootKeyPair instead of generateKeyPair) */
12+
isRootKey: optional(t.boolean),
1113
};
1214

1315
/**
1416
* Response for creating a local keychain
1517
*/
1618
export const CreateLocalKeyChainResponse = t.type({
17-
/** The extended private key */
18-
xprv: t.string,
19-
/** The extended public key */
20-
xpub: t.string,
21-
/** The Ethereum address derived from the xpub (if available) */
22-
ethAddress: optional(t.string),
19+
/** The private key (in extended key format) */
20+
prv: t.string,
21+
/** The public key (in extended key format) - optional */
22+
pub: optional(t.string),
2323
});
2424

2525
/**
2626
* Create a local keychain
2727
*
2828
* Locally creates a new keychain. This is a client-side function that does not
29-
* involve any server-side operations. Returns an object containing the xprv and xpub
30-
* for the new chain. The created keychain is not known to the BitGo service.
31-
* To use it with the BitGo service, use the 'Add Keychain' API call.
29+
* involve any server-side operations. Returns an object containing the prv and pub
30+
* keys (in extended key format) for the new chain. The created keychain is not known
31+
* to the BitGo service. To use it with the BitGo service, use the 'Add Keychain' API call.
3232
*
3333
* For security reasons, it is highly recommended that you encrypt and destroy
34-
* the original xprv immediately to prevent theft.
34+
* the original private key immediately to prevent theft.
3535
*
3636
* @operationId express.v1.keychain.local
3737
* @tag express

0 commit comments

Comments
 (0)