Skip to content

feat(sdk-core): getUserAndBackupSession + createKeychains retrofit wiring - #9482

Merged
Marzooqa merged 1 commit into
masterfrom
WCI-1264-getUserAndBackupSession-createKeychains-retrofit
Aug 25, 2026
Merged

feat(sdk-core): getUserAndBackupSession + createKeychains retrofit wiring#9482
Marzooqa merged 1 commit into
masterfrom
WCI-1264-getUserAndBackupSession-createKeychains-retrofit

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown
Contributor

What

  • Added retrofit?: DecryptedRetrofitPayload to EddsaMPCv2Utils.createKeychains() params
  • Added private getUserAndBackupSession(retrofit?) method that branches on the retrofit flag:
    • With retrofit: derives EddsaRetrofitData from MPCv1 key shares via getMpcV2RetrofitDataFromMpcV1Keys and constructs DKG instances with retrofit data
    • Without retrofit: constructs plain DKG instances (existing behavior unchanged)
  • Replaced inline new EddsaMPSDkg.DKG(...) calls in createKeychains with getUserAndBackupSession
  • Extended sendKeyGenerationRound1 / sendKeyGenerationRound1BySender payload types to allow walletId?: string
  • Spread walletId into the R1 request body when params.retrofit?.walletId is present, so server-side isRound1RetrofitDKG() detection kicks in
  • Unit tests for getUserAndBackupSession (both paths) and for walletId presence/absence in the captured R1 payload

Why

  • EdDSA wallet retrofit (upgrading MPCv1 → MPCv2) requires the DKG ceremony to be seeded with the existing MPCv1 key material instead of fresh randomness, so the resulting MPCv2 keychain derives from the same root key that the wallet already uses
  • The server identifies a retrofit DKG round by the presence of walletId in the R1 payload; without this wiring the server would treat every key-gen as a fresh creation
  • Follows the identical pattern already implemented for ECDSA in ecdsaMPCv2.ts (line 639 getUserAndBackupSession, line 126-129 walletId spread)

Test plan

  • EddsaMPCv2Utils.getUserAndBackupSession — returns plain DKG sessions when retrofit is undefined
  • EddsaMPCv2Utils.getUserAndBackupSession — returns retrofit-seeded DKG sessions when retrofit payload is supplied
  • EddsaMPCv2Utils.createKeychains with retrofit wiringwalletId present in R1 payload when retrofit provided
  • EddsaMPCv2Utils.createKeychains with retrofit wiringwalletId absent from R1 payload when no retrofit
  • All existing EddsaMPCv2Utils unit tests continue to pass

Stack

This PR is part 3 of 3 in a stacked series. Review and merge in order:

  1. WCI-1261EddsaRetrofitData type + DKG retrofit constructor + getFirstMessage routing (base: master)
  2. WCI-1263getMpcV2RetrofitDataFromMpcV1Keys for EdDSA (base: WCI-1261-EddsaRetrofitData-DKG-constructor)
  3. This PR — getUserAndBackupSession + createKeychains retrofit wiring (base: WCI-1261-EddsaRetrofitData-DKG-constructor) ← you are here

Ticket: WCI-1264

@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

WCI-1264

@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 800cab5 to b1cb0e7 Compare August 12, 2026 08:49
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from b1cb0e7 to 6c7bcfa Compare August 12, 2026 09:38
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 6c7bcfa to 47cfe16 Compare August 12, 2026 09:38
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from cf3cb10 to b5193dd Compare August 12, 2026 10:53
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from b5193dd to fdf95f7 Compare August 12, 2026 10:53
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from fdf95f7 to d219ede Compare August 13, 2026 06:27
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from d219ede to ce90652 Compare August 13, 2026 06:27
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 58ebac8 to 8d67c7c Compare August 13, 2026 07:24
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 8d67c7c to 4055fe5 Compare August 13, 2026 07:24
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 20b67fd to 9ade6eb Compare August 13, 2026 10:16
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch from 9ade6eb to 61fb76a Compare August 13, 2026 10:16
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch 2 times, most recently from 20a5005 to 6117b6d Compare August 13, 2026 14:30
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 47cfe16 to 5965a4c Compare August 13, 2026 14:33
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 5965a4c to 007e0c8 Compare August 13, 2026 14:33
@Marzooqa
Marzooqa force-pushed the WCI-1261-EddsaRetrofitData-DKG-constructor branch 2 times, most recently from 502e157 to 06cf112 Compare August 14, 2026 08:03
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 007e0c8 to 412c78a Compare August 24, 2026 11:18
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 412c78a to f83e35a Compare August 24, 2026 11:18
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch 2 times, most recently from 7cf80ae to b3d7996 Compare August 24, 2026 12:07
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot changed the base branch from WCI-1261-EddsaRetrofitData-DKG-constructor to master August 24, 2026 12:07
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from b3d7996 to 1e37492 Compare August 24, 2026 12:08
@ralph-bitgo
ralph-bitgo Bot force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from 1e37492 to b7da41b Compare August 24, 2026 12:08
Use MPCv1-derived retrofit data when creating EdDSA MPCv2 DKG sessions
and include the wallet ID in round one requests so the server selects
the retrofit flow.

Ticket: WCI-1264
@Marzooqa
Marzooqa force-pushed the WCI-1264-getUserAndBackupSession-createKeychains-retrofit branch from b7da41b to ea83766 Compare August 25, 2026 07:13
@Marzooqa
Marzooqa marked this pull request as ready for review August 25, 2026 08:31
@Marzooqa
Marzooqa requested review from a team as code owners August 25, 2026 08:31
@Marzooqa
Marzooqa requested review from a team as code owners August 25, 2026 08:31

@vibhavgo vibhavgo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Marzooqa
Marzooqa merged commit a68583c into master Aug 25, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants