fix(sdk-lib-mpc): derive final_session_id deterministically in DKG retrofit#8496
Merged
mohammadalfaiyazbitgo merged 1 commit intomasterfrom Apr 14, 2026
Merged
Conversation
…trofit Replace the all-zero final_session_id in _createDKLsRetrofitKeyShare with a deterministic sha256(public_key || root_chain_code) derivation. All-zero session IDs weaken protocol transcript binding, allowing potential cross-session confusion when multiple retrofit wallets sign simultaneously. Fixes WAL-392 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kaustubhbitgo
approved these changes
Apr 14, 2026
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.
Summary
Fixes WAL-392 — DKG retrofit keyshares were using an all-zero
final_session_id(Array(32).fill(0)), meaning every retrofit wallet shared the same session identifier. This weakens DKLS protocol transcript binding and could allow cross-session confusion when multiple retrofit wallets sign simultaneously on the same server.Change: Replace the hardcoded zeros with a deterministic derivation:
This produces a unique, wallet-specific 32-byte value derived from the key material — identical across all parties for the same wallet (since they share the same public key and chain code), but distinct across different wallets.
Files Changed
modules/sdk-lib-mpc/src/tss/ecdsa-dkls/dkg.ts— addcryptoimport, replaceArray(32).fill(0)with SHA256 derivation in_createDKLsRetrofitKeyShare()modules/sdk-lib-mpc/test/unit/tss/ecdsa/dklsDkg.ts— 5 new tests verifying the fixTest Plan
should create retrofit key shares with non-zero final_session_idshould create retrofit key shares with 32-byte final_session_idshould produce deterministic final_session_id for same retrofit inputsshould derive final_session_id as sha256(public_key || chaincode)should produce the same final_session_id for all parties in a retrofit@bitgo/sdk-lib-mpcunit tests passRisk
Low. Single-line change in one function. The output contract (32-byte
number[]) is preserved.final_session_idis not persisted in completed keyshares — it is only consumed byKeygenSession.initKeyRotation()during the retrofit ceremony. Confirmed not used in the wallet-platform backend.🤖 Generated with Claude Code