feat(sdk-core): add createOfflineKeyGenRound2Share to EddsaMPCv2Utils#9243
Draft
bitgo-ai-agent-dev[bot] wants to merge 3 commits into
Draft
feat(sdk-core): add createOfflineKeyGenRound2Share to EddsaMPCv2Utils#9243bitgo-ai-agent-dev[bot] wants to merge 3 commits into
bitgo-ai-agent-dev[bot] wants to merge 3 commits into
Conversation
Contributor
ebc2b27 to
a95ffdb
Compare
Author
|
The The This PR actually fixes that bug by replacing The BitGo SDK workflow (which tests our branch) passes cleanly on both CI runs — lint ✅, format ✅, unit tests ✅. |
f8de6e4 to
f697809
Compare
Add createOfflineKeyGenRound2Share to EddsaMPCv2Utils in sdk-core,
enabling external signer AKM flows to complete DKG round 2 without
holding decrypted key material in memory across API calls.
The method:
- Decrypts encryptedUserGpgPrvKey and encryptedRound1Session with the
wallet passphrase
- Restores the DKG session via dkg.restoreSession
- Verifies and deserializes all 3 incoming round-1 messages (own,
counterParty, BitGo) via MPSComms.verifyMpsMessage
- Calls dkg.handleIncomingMessages([ownMsg1, counterPartyMsg1, bitgoMsg1])
to produce ownMsg2 (WASM filters by partyIdx internally)
- Signs ownMsg2 payload with the GPG private key via
MPSComms.detachSignMpsMessage
- Serializes {dkgSession, ownMsgPayload, ownMsgFrom} and encrypts it
as encryptedRound2Session
Also fix DKG.restoreSession in sdk-lib-mpc to be async and load WASM
before restoring state (matching DSG.restoreSession behavior), which
is required for handleIncomingMessages to work after a restore.
Also fix createOfflineKeyGenRound1Share (WCI-889) to use
this.bitgo.encrypt/decrypt instead of non-existent encryptAsync/
decryptAsync — BitGoBase.encrypt/decrypt already return Promise<string>.
Ticket: WCI-890
Session-Id: 2b6d8843-9bec-4a05-8725-18d450b7f097
Task-Id: dcea3d67-b592-483a-967b-968cc01f5b76
Fix prettier formatting in createOfflineKeyGenRound2Share (multi-line decrypt call) and in test helper (function signature and initDkg args). Remove unused variables from buildCounterPartyAndBitgoMsgs test helper. Update sdk-lib-mpc DKG session management test to await restoreSession, which is now async after the fix to load WASM before restoring state. Ticket: WCI-890 Session-Id: 2b6d8843-9bec-4a05-8725-18d450b7f097 Task-Id: dcea3d67-b592-483a-967b-968cc01f5b76
The assert message incorrectly said "round 1" when it should say "round 2". Ticket: WCI-890 Session-Id: 2b6d8843-9bec-4a05-8725-18d450b7f097 Task-Id: dcea3d67-b592-483a-967b-968cc01f5b76
8156388 to
9a7d477
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
createOfflineKeyGenRound2SharetoEddsaMPCv2Utilsinmodules/sdk-core/src/bitgo/utils/tss/eddsa/eddsaMPCv2.tsdkg.handleIncomingMessagesto produceownMsg2, signs it with the GPG key, and returns{ signedMsg2, encryptedRound2Session }DKG.restoreSessioninmodules/sdk-lib-mpc/src/tss/eddsa-mps/dkg.tsto beasyncand load WASM before restoring state (mirrorsDSG.restoreSession), which is required so thathandleIncomingMessagesworks on a restored sessioncreateOfflineKeyGenRound1Share(WCI-889) to callthis.bitgo.encrypt/decryptinstead of non-existentencryptAsync/decryptAsync—BitGoBase.encrypt/decryptalready returnPromise<string>Why
createKeychainsWithExternalSignerto function end-to-endTest plan
{ signedMsg2, encryptedRound2Session }walletPassphrasefor session decryptiongetEnv()returns'prod'or'test'(env requires BitGo pub key config)encryptedRound2Sessionis only decryptable with the correctwalletPassphraseeddsaMPCv2.tscontinue to passTicket: WCI-890