Skip to content

Commit b9d4987

Browse files
authored
docs(mpc): document that reducedEncryptedPrv contains private key material
2 parents 4d0c656 + 3805b29 commit b9d4987

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

modules/sdk-core/src/bitgo/keychain/iKeychains.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export interface Keychain {
3232
provider?: string;
3333
encryptedPrv?: string;
3434
// Required for MPCV2 keys where we reduce the amount of data needed for the keycard.
35-
// This is only generated client side and is not sent to WP
35+
// Contains the party's private scalar (s_i) as private key material, CBOR-encoded
36+
// and encrypted with the wallet passphrase. This is only generated client side and
37+
// is not sent to WP.
3638
reducedEncryptedPrv?: string;
3739
derivationPath?: string;
3840
derivedFromParentWithSeed?: string;

modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ export class EcdsaMPCv2Utils extends BaseEcdsaUtils {
365365
input: privateMaterial.toString('base64'),
366366
password: passphrase,
367367
});
368+
// Encrypts the CBOR-encoded ReducedKeyShare (which contains the party's private
369+
// scalar s_i) with the wallet passphrase. The result is stored as reducedEncryptedPrv
370+
// on the key card QR code and represents a second copy of private key material
371+
// beyond the server-stored encryptedPrv.
368372
reducedEncryptedPrv = this.bitgo.encrypt({
369373
// Buffer.toString('base64') can not be used here as it does not work on the browser.
370374
// The browser deals with a Buffer as Uint8Array, therefore in the browser .toString('base64') just creates a comma seperated string of the array values.

modules/sdk-lib-mpc/src/tss/ecdsa-dkls/dkg.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ export class Dkg {
184184
return this.keyShareBuff;
185185
}
186186

187+
/**
188+
* Returns a CBOR-encoded ReducedKeyShare buffer containing the party's private
189+
* scalar (s_i) in the `prv` field. This buffer is private key material.
190+
* The caller encrypts it and stores it as `reducedEncryptedPrv` on the key card QR code.
191+
*/
187192
getReducedKeyShare(): Buffer {
188193
if (!this.keyShareBuff) {
189194
throw Error('Can not get key share, DKG is not complete yet.');

modules/sdk-lib-mpc/src/tss/ecdsa-dkls/types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ export type RetrofitData = {
6060
xiList?: number[][];
6161
};
6262

63+
/**
64+
* A CBOR-encoded subset of an MPCv2 (DKLS) key share stored on the key card.
65+
*
66+
* @property bigSList - Public commitments S_i = s_i * G for each party.
67+
* @property xList - Evaluation points (x-coordinates for Lagrange interpolation).
68+
* @property rootChainCode - Root chain code for HD derivation.
69+
* @property prv - The party's private scalar s_i. This is private key material;
70+
* possession of this value allows the holder to act as this party in signing.
71+
* @property pub - The party's public key.
72+
*/
6373
export const ReducedKeyShareType = t.type({
6474
bigSList: t.array(t.array(t.number)),
6575
xList: t.array(t.array(t.number)),

0 commit comments

Comments
 (0)