Repository navigation
feat: userAuth key reset SDK support and per-recipient reshare results - #10108
Draft
davidkaplanbitgo wants to merge 2 commits into
Draft
davidkaplanbitgo wants to merge 2 commits into
davidkaplanbitgo wants to merge 2 commits into
Conversation
Contributor
Contributor
|
|
Add the SDK pieces for a customer-initiated userAuth key reset on custody lightning wallets: - computeUserAuthResetVerificationCode and a compare helper, computed locally and never taken from a server response - UserAuthKeyResetSignedRequest codec (rejects extra and missing fields) and typed request, status and response codecs - CustodialLightningWallet.requestUserAuthKeyReset, getUserAuthKeyResetRequest and cancelUserAuthKeyResetRequest; the new private key and passphrase are never sent - createMessageSignature and verifyMessageSignature parse xpub/xprv keys with bitcoin version bytes on testnet, since tlnbtc keys are generated that way TICKET: WCN-3893
reshareWalletWithSpenders takes an optional fourth argument and now returns
the outcome per recipient:
- includeAdmins also reshares to admins who can spend
- onlyNeedsRecovery only reshares to users flagged needsRecovery, which is
how other spenders regain access after a lightning userAuth key reset
- a failure for one recipient (for example an existing active or pending
share) no longer aborts the rest; it is returned in `failed`
- spenders who are not enterprise users are returned in `failed` instead of
being skipped silently
- returns { shared, failed } instead of void; setup and key decryption
errors still reject
Without options the recipients are unchanged. bulkUpdateWalletShare keeps
logging recipient failures. The method is now declared on IWallets.
TICKET: WCN-3894
davidkaplanbitgo
force-pushed
the
davidkaplan/wcn-3893-userauth-reset-sdk
branch
from
October 31, 2026 12:16
ac75cf1 to
a098c59
Compare
This branch has not been deployed
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
SDK support for a customer-initiated userAuth key reset on custody lightning wallets (a customer who forgot their wallet password replaces the key that password encrypts, with BitGo support approving the request).
WCN-3893 -
abstract-lightningcomputeUserAuthResetVerificationCode(walletId, newUserAuthKeyPub)andcompareUserAuthResetVerificationCodes: SHA-256 oflightning-userauth-reset:v1:<walletId>:<pub>, RFC 4648 base32, first 10 chars, displayed asXXXXX-XXXXX. Compare ignores case, dashes and spaces.UserAuthKeyResetSignedRequest(exact: rejects extra and missing fields),UserAuthKeyResetStatus(requested | canceled | expired | pending | dnr_held | wp_swapped | completed | failed), request/response codecs. The GET response carriescompletedAtandreleasedAt(nullable); "released" isreleasedAt !== null, not a status.CustodialLightningWallet.requestUserAuthKeyReset({ passphrase, encryptionVersion }),getUserAuthKeyResetRequest(),cancelUserAuthKeyResetRequest(requestId). The new key is generated and encrypted locally and registered with the same shape wallet creation uses (purpose: 'userAuth', no passcode encryption code). The proof is signed with the new key. The private key and passphrase are never sent, and the returned verification code is computed locally, never taken from the server.createMessageSignature/verifyMessageSignaturenow parsexpub/xprvkeys with bitcoin version bytes even when a testnet network is passed.tlnbtckeys are generated with the default network, so signing withgetUtxolibNetwork('tlnbtc')threw before. Existing callers pass no network and are unaffected;tpub/tprvkeys still use the given network. Signatures are identical on both networks (same message prefix).WCN-3894 -
sdk-coreWallets.reshareWalletWithSpenders(walletId, userPassword, encryptionVersion?, opts?)withopts: { includeAdmins?, onlyNeedsRecovery? }, returning{ shared: string[], failed: { userId, error }[] }.failed. Selected spenders who are not enterprise users are also returned infailedinstead of being skipped silently. Setup and key-decryption errors still reject.bulkUpdateWalletSharekeeps logging recipient failures;acceptSharestill ignores the result as before.IWallets.needsRecoveryis typed inline onWalletData.usersuntil@bitgo/public-typescarries it.Notes for review
POST/GET/DELETE /api/v2/:coin/wallet/:walletId/lightning/userAuthKey/resetRequest) is being built in wallet-platform; response shapes are defined here and must match its spec.Testing
modules/abstract-lightning: 77 passing (mocha --recursive test), including verification-code vectors checked independently against Python'sbase64.b32encode(sha256(...)), codec exactness, nock tests forlnbtcandtlnbtcasserting the proof verifies, the private key and passphrase are absent from every request body, and the server'sverificationCodeis ignored. Four of these fail without thesignature.tschange.modules/bitgowallets.ts: thereshareWalletWithSpendersandbulkUpdateWalletSharetests pass (33), including new cases forincludeAdmins,onlyNeedsRecovery, defaults, per-recipient failures and non-enterprise users.eslint --quietandprettier --checkpass on the changed files.modules/bitgo/test/v2/unit/wallets.tsfail with and without these changes (nock mismatches, shielded wallets, v2-encrypted shares, keycard). Two of them, in the accept-share reshare cases, assert the old abort-on-first-failure behaviour; I updated that expectation to the new behaviour but could not run it locally, so please check it in CI.