Skip to content

Commit

Permalink
Merge pull request #4115 from BitGo/BTC-683-add-decypt-check
Browse files Browse the repository at this point in the history
feat(sdk-api): add check to see if the derived xpub matches
  • Loading branch information
davidkaplanbitgo authored Dec 4, 2023
2 parents 637c214 + efef716 commit c23000f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/sdk-api/src/v1/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,10 @@ Wallet.prototype.getAndPrepareSigningKeychain = function (params, callback) {
} catch (e) {
throw new Error('Unable to decrypt user keychain');
}

if (keychain.xpub && bip32.fromBase58(keychain.xprv).neutered().toBase58() !== keychain.xpub) {
throw new Error('derived xpub does not match stored xpub');
}
return keychain;
});
}
Expand Down

0 comments on commit c23000f

Please sign in to comment.