Skip to content

Commit

Permalink
chore: refactor dkg initialization to seperately between user and backup
Browse files Browse the repository at this point in the history
Ticket: WP-2292

TICKET: WP-2292
  • Loading branch information
mohammadalfaiyazbitgo committed Sep 16, 2024
1 parent a10dac8 commit 89cca60
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions modules/sdk-core/src/bitgo/utils/tss/ecdsa/ecdsaMPCv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,31 @@ export class EcdsaMPCv2Utils extends BaseEcdsaUtils {
return { ...(await keychains.add(recipientKeychainParams)), reducedEncryptedPrv: reducedEncryptedPrv };
}

/**
* Converts a User or Backup MPCv1 SigningMaterial to RetrofitData needed by MPCv2 DKG.
*
* @param decryptedKeyshare - MPCv1 decrypted signing material for user or backup as a json.stringify string and bitgo's Big Si.
* @param partyId - The party ID of the MPCv1 keyshare.
* @returns The retrofit data needed to start an MPCv2 DKG session.
*/
getKeyDataForRetrofit(
decryptedKeyshare: string,
partyId: MPCv2PartiesEnum.BACKUP | MPCv2PartiesEnum.USER
): DklsTypes.RetrofitData {
const mpc = new Ecdsa();
const xiList = [
Array.from(bigIntToBufferBE(BigInt(1), 32)),
Array.from(bigIntToBufferBE(BigInt(2), 32)),
Array.from(bigIntToBufferBE(BigInt(3), 32)),
];
return this.getMpcV2RetrofitDataFromMpcV1Key({
mpcv1PartyKeyShare: decryptedKeyshare,
mpcv1PartyIndex: partyId === MPCv2PartiesEnum.USER ? 1 : 2,
xiList,
mpc,
});
}

/**
* Converts user and backup MPCv1 SigningMaterial to RetrofitData needed by MPCv2 DKG.
*
Expand Down

0 comments on commit 89cca60

Please sign in to comment.