feat(express): add API endpoint to verify private key matches wallet#9345
Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Draft
feat(express): add API endpoint to verify private key matches wallet#9345bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
Add POST /api/v2/{coin}/wallet/{id}/verifyPrivateKey endpoint to
BitGo Express. The endpoint accepts either a plaintext private key
(prv) or an encrypted private key (encryptedPrv + walletPassphrase)
and verifies that it matches the wallet's user keychain by calling
coin.assertIsValidKey. When no publicKey is provided the user
keychain's pub (or commonKeychain for TSS wallets) is fetched from
BitGo automatically.
Ticket: WCI-1139
Co-Authored-By: Claude <noreply@anthropic.com>
Session-Id: b17db9f7-ab01-4cc9-ba52-3b1fb87cb276
Task-Id: 77daf7cf-15f3-4405-9967-bd3c8150be94
bitgo-ai-agent-dev
Bot
force-pushed
the
WCI-1139-verify-private-key-matches-wallet
branch
from
July 24, 2026 06:05
c4ab408 to
888bdee
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
POST /api/v2/{coin}/wallet/{id}/verifyPrivateKeyendpoint to BitGo Expressprv) or an encrypted private key (encryptedPrv+walletPassphrase)publicKeyis not provided (usescommonKeychainfor TSS wallets,pubfor standard wallets)coin.assertIsValidKey, which handles both standard (onchain) and TSS wallet key types{ valid: true }on success; returns 400 for missing required params; propagates errors for key mismatchesWhy
Test plan
encryptedPrvflow, and all error cases (missing prv, missing walletPassphrase, key mismatch, wallet not found)POST /api/v2/tbtc/wallet/:id/verifyPrivateKeywith valid and invalid keysTicket: WCI-1139