Skip to content

feat(sdk-core): accept SPKI secp256k1 pubs in Ofc.isValidPub#8958

Merged
zahin-mohammad merged 1 commit into
masterfrom
zahinmohammad/wcn-266-update-ofcisvalidpub-in-sdk-for-happy-path
Jun 5, 2026
Merged

feat(sdk-core): accept SPKI secp256k1 pubs in Ofc.isValidPub#8958
zahin-mohammad merged 1 commit into
masterfrom
zahinmohammad/wcn-266-update-ofcisvalidpub-in-sdk-for-happy-path

Conversation

@zahin-mohammad
Copy link
Copy Markdown
Contributor

Summary

  • Ofc.isValidPub previously accepted only BIP-32 base58 xpubs. Phase 3 adds a second key to OFC wallets — the BitGo KMS key (source: 'bitgo') stored as a base64-encoded SPKI (DER-wrapped) secp256k1 public key (raw AWS KMS GetPublicKey output) — which the method wrongly rejected.
  • Extend isValidPub to also accept base64 SPKI secp256k1 keys, with a strict crv === 'secp256k1' curve check so wrong-curve keys (e.g. P-256) are still rejected.
  • Add a unit-test matrix covering xpub, SPKI secp256k1, xprv, wrong-curve SPKI, garbage base64, empty string, and raw hex.

Test plan

  • cd modules/bitgo && npx mocha test/v2/unit/coins/ofc.ts → 9 passing
  • @bitgo/sdk-core builds clean
  • eslint: no new errors on changed files

Ticket: WCN-266

🤖 Generated with Claude Code

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 5, 2026

WCN-266

OFC wallets hold keys in two formats: the user key is a BIP-32 base58
xpub and the BitGo key (source: 'bitgo') is a base64-encoded SPKI
(DER-wrapped) secp256k1 public key. Ofc.isValidPub previously accepted
only the xpub format and wrongly returned false for a legitimate BitGo
public key.

Extend isValidPub to also accept base64 SPKI secp256k1 keys, reading the
curve via KeyObject.asymmetricKeyDetails so wrong-curve keys (e.g. P-256)
are rejected.

WCN-266

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zahin-mohammad zahin-mohammad force-pushed the zahinmohammad/wcn-266-update-ofcisvalidpub-in-sdk-for-happy-path branch from 34dc2ca to c7ab5b1 Compare June 5, 2026 18:38
@zahin-mohammad zahin-mohammad requested a review from alextse-bg June 5, 2026 18:41
@zahin-mohammad zahin-mohammad marked this pull request as ready for review June 5, 2026 18:41
@zahin-mohammad zahin-mohammad requested review from a team as code owners June 5, 2026 18:41
@zahin-mohammad zahin-mohammad requested a review from ranga-r2 June 5, 2026 18:41
@zahin-mohammad zahin-mohammad merged commit 3c0aeff into master Jun 5, 2026
22 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