Skip to content

feat(vault): hardware-verifiable x402 payments - #403

Merged
BitHighlander merged 2 commits into
developfrom
feat/x402-hardware-verification
Aug 10, 2026
Merged

feat(vault): hardware-verifiable x402 payments#403
BitHighlander merged 2 commits into
developfrom
feat/x402-hardware-verification

Conversation

@BitHighlander

Copy link
Copy Markdown
Collaborator

Replaces the stale draft #383 by cherry-picking its vault-side commit (b373dfc7) onto current develop.

Why not just rebase #383

#383 has not moved since 2026-07-31 and shows as CONFLICTING. Its second commit, chore: pin canonical x402 dependencies, moves modules/device-protocol to 5a8e2702 and modules/hdwallet to 25310f2cboth of which develop's current pins already contain. Merging it would have walked two tier-1 submodules backwards days before a release, for no gain. This branch takes the code and leaves the pins alone.

What this does

The x402 payment intent supplied by the server is never trusted on its own. The signing path re-derives what the Solana transaction actually does — SPL transfer, associated-token-account creation, memo, and PDA validity (including the on-curve check) — and reconciles that against the declared intent. The device screen and the payment request therefore cannot disagree.

projects/keepkey-vault/src/bun/solana-x402.ts      (new)
projects/keepkey-vault/__tests__/evm-x402.test.ts   (new)
projects/keepkey-vault/__tests__/solana-x402.test.ts (new)
+ eip712-decoder, rest-api, schemas, solana-consent, solana-signing, walletconnect, swagger.json

Two fixes on top of the cherry-pick

Both were needed to hold the typecheck gate at its 636 baseline — as-is the branch pushed it to 637.

  • solana-x402.ts imported from node:crypto, which does not resolve under this tsconfig. Every other module in src/bun/ imports from crypto.
  • Added both x402 test files to make test-unit. They were not in the target on the source branch, so they would never have run in CI.

Left alone: getNestedValue in eip712-decoder.ts reports as unused, but it is already dead on develop — pre-existing, not orphaned by this change.

Verification

  • make preflight — all gates pass; no submodule pins moved
  • make test-unit — 351 pass / 0 fail across 20 files
  • make build — clean
  • typecheck 636, exactly at baseline

Not verified: on-device. No x402 payment has been signed on hardware from this branch.

Cherry-picked from the stale draft #383 (b373dfc). Its companion commit,
"chore: pin canonical x402 dependencies", is NOT taken: it moved
device-protocol and hdwallet to pins that develop already contains, so it
would have walked both submodules backwards for no gain.

The x402 payment intent from the server is never trusted on its own — the
signing path re-derives what the transaction actually does (SPL transfer,
ATA, memo, PDA validity) and reconciles it against the declared intent, so
the device screen and the payment request cannot disagree.

Two fixes on top of the cherry-pick, both needed to hold the typecheck gate
at its 636 baseline:

- solana-x402.ts imported from 'node:crypto', which does not resolve under
  this tsconfig. Every other module here imports from 'crypto'.
- Added both x402 test files to make test-unit. They were not in the target
  on the source branch, so they would never have run in CI.

Pre-existing and left alone: getNestedValue in eip712-decoder.ts is dead
code on develop already, not something this change orphaned.
Resolves the Makefile test-unit list and the Solana REST sign path as a
union: #402's ClearSign event recording wraps the call, #403's x402
intent field is passed through to signSolanaWireTransaction.
@BitHighlander
BitHighlander merged commit 8a0e4d3 into develop Aug 10, 2026
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