Skip to content

✨ (signer-btc-legacy) [DSDK-1617]: Add get extended public key - #2000

Merged
aussedatlo merged 3 commits into
developfrom
feat/dsdk-1617-btc-legacy-wallet-xpub
Oct 23, 2026
Merged

aussedatlo merged 3 commits into
developfrom
feat/dsdk-1617-btc-legacy-wallet-xpub

Conversation

@aussedatlo

@aussedatlo aussedatlo commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📝 Description

Get extended public key for signer-btc-legacy (ticket 1.3 of Plan: Bitcoin family on DMK). Stacked on #1994.

  • getExtendedPublicKey(path, { skipOpenApp }) returns { extendedPublicKey }, named like signer-btc's method.
  • The legacy protocol has no xpub command, so a task does what hw-app-btc's BtcOld.getWalletXpub does: two get address calls (the parent's key for the fingerprint, the account's key and chain code), then the BIP32 serialization with the coin's version, base58check encoded. A path with fewer than two levels returns an error before any APDU.
  • LegacyCoinProfile gets xpubVersion; LITECOIN_PROFILE uses 0x019da462 ("Ltub"), the value Ledger Wallet reads from coin-bitcoin's networks.ts.
  • New dependencies: @noble/hashes (as in signer-zcash) and bs58 (workspace catalog).
const { observable } = signer.getExtendedPublicKey("84'/2'/0'");

One deliberate difference with hw-app-btc: it always sets the hardened bit of the child index; the kit writes the real index. Both are identical for account paths, the only ones Ledger Wallet uses.

Compared with Ledger Wallet. For the 44', 49' and 84' Litecoin accounts of the Speculos seed, the same three xpubs come from:

  • ledger-live's own hw-app-btc (BtcOld.getWalletXpub, Ledger Wallet's Litecoin xpubVersion), run live against a real Speculos Litecoin app through the mock server;
  • an off-device BIP32 derivation of the seed, checked against the BIP32 test vector;
  • the kit, in its unit test (fed the app's answers) and in the e2e tests.

Sample app: a "Get extended public key" action on the Litecoin screen, and 3 Playwright specs against the real Litecoin app 2.4.13 on Flex 1.7.0, through the mock server and Speculos.

❓ Context

  • JIRA or GitHub link: DSDK-1617
  • Feature: Legacy Bitcoin signer kit, wallet xpub

✅ Checklist

Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.

  • Covered by automatic tests
  • Changeset is provided
  • Documentation is up-to-date
  • Impact of the changes:
    • signer-btc-legacy: new get extended public key API; xpubVersion is a new required field of LegacyCoinProfile
    • Sample app: new action on the Litecoin screen; Playwright specs in signers/litecoin (3 new specs, all on real Speculos)

🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
device-sdk-ts-sample Ready Ready Preview Oct 23, 2026 10:18am UTC
doc-device-management-kit Ready Ready Preview Oct 23, 2026 10:18am UTC

Request Review

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Danger Check Results

Messages

✅

Danger: All checks passed successfully! 🎉

Generated by 🚫 dangerJS against 3c3018d

@aussedatlo
aussedatlo added this pull request to stack #2027 October 22, 2026 08:35
@aussedatlo
aussedatlo marked this pull request as ready for review October 22, 2026 08:35
@aussedatlo
aussedatlo requested a review from a team as a code owner October 22, 2026 08:35
Copilot AI balanced review requested due to automatic review settings October 22, 2026 08:35

Copilot AI 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.

🟡 Changes recommended

Short-path validation runs after app opening, allowing invalid requests to trigger device communication before returning an error.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

Adds extended public key retrieval to the legacy Bitcoin signer, building on its existing address API and Litecoin profile.

Changes:

  • Adds getExtendedPublicKey and constructs BIP32 keys from parent and account public keys.
  • Introduces coin-specific xpub versions and hashing/Base58 dependencies.
  • Adds unit coverage, three Litecoin end-to-end cases, documentation, and a sample-app action.
File Description
pnpm-lock.yaml Locks hashing and Base58 dependencies.
packages/​signer/​signer-btc-legacy/​src/​internal/​use-cases/​address/​GetExtendedPublicKeyUseCase.ts Forwards xpub requests and options.
packages/​signer/​signer-btc-legacy/​src/​internal/​use-cases/​address/​GetExtendedPublicKeyUseCase.test.ts Tests option forwarding and defaults.
packages/​signer/​signer-btc-legacy/​src/​internal/​DefaultSignerBtcLegacy.ts Implements the signer method.
packages/​signer/​signer-btc-legacy/​src/​internal/​DefaultSignerBtcLegacy.test.ts Tests signer action wiring.
packages/​signer/​signer-btc-legacy/​src/​internal/​btcLegacyTypes.ts Adds the dependency-injection identifier.
packages/​signer/​signer-btc-legacy/​src/​internal/​btcLegacyModule.ts Registers the new use case.
packages/​signer/​signer-btc-legacy/​src/​internal/​btcLegacyModule.test.ts Tests use-case registration.
packages/​signer/​signer-btc-legacy/​src/​internal/​app-binder/​task/​utils/​legacyTransactionUtils.ts Adds public-key compression and hashing.
packages/​signer/​signer-btc-legacy/​src/​internal/​app-binder/​task/​GetExtendedPublicKeyTask.ts Retrieves keys and serializes the xpub.
packages/​signer/​signer-btc-legacy/​src/​internal/​app-binder/​task/​GetExtendedPublicKeyTask.test.ts Tests serialization and error handling.
packages/​signer/​signer-btc-legacy/​src/​internal/​app-binder/​BtcLegacyAppBinder.ts Runs the task in the selected app.
packages/​signer/​signer-btc-legacy/​src/​internal/​app-binder/​BtcLegacyAppBinder.test.ts Tests task-action configuration.
packages/​signer/​signer-btc-legacy/​src/​api/​SignerBtcLegacy.ts Declares the public method.
packages/​signer/​signer-btc-legacy/​src/​api/​profiles/​litecoinProfile.ts Sets Litecoin’s Ltub version.
packages/​signer/​signer-btc-legacy/​src/​api/​model/​LegacyCoinProfile.ts Requires a coin-specific xpub version.
packages/​signer/​signer-btc-legacy/​src/​api/​model/​ExtendedPublicKeyOptions.ts Defines the app-opening option.
packages/​signer/​signer-btc-legacy/​src/​api/​index.ts Exports the new public types.
packages/​signer/​signer-btc-legacy/​src/​api/​app-binder/​GetExtendedPublicKeyDeviceActionTypes.ts Defines action output, errors, and interaction types.
packages/​signer/​signer-btc-legacy/​README.md Documents xpub usage and options.
packages/​signer/​signer-btc-legacy/​package.json Adds hashing and Base58 dependencies.
apps/​sample/​src/​components/​SignerLitecoinView/​index.tsx Adds the xpub action form.
apps/​sample/​playwright/​utils/​drivers/​LtcSignerDriver.ts Adds xpub form automation.
apps/​sample/​playwright/​cases/​signers/​litecoin/​get-extended-public-key.spec.ts Checks three Litecoin account xpubs.
.changeset/​bitcoin-legacy-xpub.md Records the minor package update.

Review effort: Balanced

Copilot AI 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.

🟡 Changes recommended

Address the critical compressed-key handling defect, correct the pre-APDU validation error type, and resolve the LegacyCoinProfile compatibility or release-versioning issue.

2 open issues
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Lite

Copilot AI 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.

🔵 Needs a closer look

Invalid or empty derivation paths can throw synchronously instead of returning the documented observable error; path validation should handle these inputs and include a regression test.

1 open issue
1 resolved since last review
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Lite

Copilot AI 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.

🟢 Approval recommended

No unresolved review comments were identified, and the reviewed changes are assessed as approval-ready.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Lite

Base automatically changed from feat/dsdk-1616-btc-legacy-get-address to develop October 23, 2026 09:36
@aussedatlo
aussedatlo force-pushed the feat/dsdk-1617-btc-legacy-wallet-xpub branch from ed9df7f to 3c3018d Compare October 23, 2026 10:16
@aussedatlo
aussedatlo enabled stacked auto-merge October 23, 2026 10:23
stacked auto-merge was automatically disabled October 23, 2026 10:27

Replaced by a newer auto-merge request

@aussedatlo
aussedatlo enabled stacked auto-merge October 23, 2026 10:27
@sonarqubecloud

Copy link
Copy Markdown

@aussedatlo
aussedatlo added this pull request to the merge queue Oct 23, 2026
Merged via the queue into develop with commit 084c422 Oct 23, 2026
25 checks passed
@aussedatlo
aussedatlo deleted the feat/dsdk-1617-btc-legacy-wallet-xpub branch October 23, 2026 10:43

This branch was successfully deployed

2 active deployments
Preview – device-sdk-ts-sample — 3c3018db Deployed Oct 23, 2026 by vercel[bot]
Preview – doc-device-management-kit — 3c3018db Deployed Oct 23, 2026 by vercel[bot]
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.

3 participants