Skip to content

feat(zcash): wallet.zcashDisplayAddress for on-device UA verification#39

Merged
BitHighlander merged 5 commits into
masterfrom
feat/zcash-display-address
Apr 30, 2026
Merged

feat(zcash): wallet.zcashDisplayAddress for on-device UA verification#39
BitHighlander merged 5 commits into
masterfrom
feat/zcash-display-address

Conversation

@BitHighlander
Copy link
Copy Markdown
Collaborator

Status: DRAFT — wrapper code is shape-correct and ready for review. Dep bump is the only thing keeping CI red. See "Blocker" below.

Summary

Adds a wrapper around the firmware `ZcashDisplayAddress` flow so hosts can ask the device to render a Zcash unified address with QR for the user to verify. Mirrors the existing `zcashGetOrchardFVK` pattern.

API

wallet.zcashDisplayAddress({
  addressNList: number[];          // ZIP-32 path [32', 133', account']
  account?: number;
  address: string;                 // host-built UA string (u1...)
  ak: Uint8Array;                  // FVK components for verification
  nk: Uint8Array;
  rivk: Uint8Array;
  expectedSeedFingerprint?: Uint8Array;  // optional ZIP-32 §6.1 binding
}): Promise<{
  address: string;                 // confirmed by user on device
  seedFingerprint?: Uint8Array;    // device's ZIP-32 §6.1 fingerprint
}>

Plus a standalone `Zcash.zcashDisplayAddress(transport, params)` helper.

Trust model

Device-side: device re-derives its own Orchard FVK at the requested account and rejects with `Failure` unless the host-supplied `(ak, nk, rivk)` matches. On match, device displays the address with QR; user accept returns the confirmed bytes.

If `expectedSeedFingerprint` is supplied, device checks
`BLAKE2b-256("Zcash_HD_Seed_FP", I2LEBSP_8(len(seed)) || seed)`
and rejects before any FVK derivation on mismatch — catches "wrong device" errors.

Blocker — dep republish

The TypeScript build will fail against this PR until `@bithighlander/device-protocol` is republished with the new `ZcashDisplayAddress` / `ZcashAddress` proto messages. The proto changes are already merged on `BitHighlander/device-protocol:master` via:

Once the npm package is republished (e.g. `7.15.0`), bumping
`packages/hdwallet-keepkey/package.json`'s
`@bithighlander/device-protocol` pin will turn this PR green. That bump is intentionally NOT included here so it can be a separate mechanical commit in the same PR or as a follow-up.

Upstream chain

Test plan

…tion

Wraps the firmware ZcashDisplayAddress flow as a method on
KeepKeyHDWallet plus a standalone Zcash.zcashDisplayAddress() helper.

Pattern mirrors zcashGetOrchardFVK: build the proto, transport.call,
unpack the response.

API:
  wallet.zcashDisplayAddress({
    addressNList,             // ZIP-32 path [32', 133', account']
    account?,
    address,                  // host-built UA string (u1...)
    ak, nk, rivk,             // FVK components for verification
    expectedSeedFingerprint?, // optional ZIP-32 §6.1 binding
  }): Promise<{ address: string; seedFingerprint?: Uint8Array }>

Trust model is firmware-side: device re-derives its Orchard FVK at
the requested account and rejects unless host's (ak, nk, rivk) matches.
On match, device displays the address with QR; user accept returns the
confirmed address bytes. Reject closes the call with Failure.

If expectedSeedFingerprint is supplied, device checks it against
BLAKE2b-256("Zcash_HD_Seed_FP", I2LEBSP_8(len) || seed) and rejects
before any FVK derivation on mismatch — catches "wrong device" errors.

Requires firmware ≥ 7.15.0 with the ZcashDisplayAddress proto handler
(BitHighlander/keepkey-firmware:feature-zcash, PR #220).

Build will fail until @bithighlander/device-protocol is republished
with the ZcashDisplayAddress / ZcashAddress proto messages — both are
already on BitHighlander/device-protocol:master via PR #27 and PR #28
but the npm package is currently pinned at 7.14.1 which predates them.
The package.json bump is intentionally NOT included here so that the
dep republish + version pick can be a separate, mechanical commit.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

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

Project Deployment Actions Updated (UTC)
hdwallet-sandbox Ready Ready Preview, Comment Apr 30, 2026 11:23pm

Request Review

Picks up ZcashDisplayAddress / ZcashAddress proto messages and the
seed_fingerprint binding fields on FVK / SignPCZT / DisplayAddress /
Address messages. Required for the wallet.zcashDisplayAddress wrapper
introduced in this PR to compile.

Also tightens the response unpack: throw on empty address instead of
silently returning a possibly-undefined string. Empty means something
went wrong on the wire.

Verified locally: yarn build → success.
Firmware derives the Orchard UA from device seed material and
displays it; host no longer supplies UA / ak / nk / rivk. Wrapper
now accepts only { addressNList?, account? } and returns
{ address }.
@BitHighlander BitHighlander merged commit d83a65c into master Apr 30, 2026
3 of 4 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.

1 participant