Skip to content

Add a branded card capture page for Kernel wallets - #3

Open
hiroTamada wants to merge 2 commits into
mainfrom
hypeship/card-capture-example
Open

hiroTamada wants to merge 2 commits into
mainfrom
hypeship/card-capture-example

Conversation

@hiroTamada

Copy link
Copy Markdown

Summary

Adds a card enrollment example alongside the credential flows: a branded /cards/add page that renders KernelCardCapture from @onkernel/vault-react 0.5.0, and a script that prints a capture link for it.

  • app/cards/add: reads the capture token from the URL fragment, removes it from the address bar, and renders the component with custom copy. It styles all three layers: page CSS through the class hooks, fieldCss for VGS inputs, and evervaultTheme for Evervault's iframe, so the same page works whichever card vault the organization uses.
  • scripts/create-card-link.ts (bun run create-card-link -- <vault-name> [wallet-key]): upserts the vault and a provider: "kernel" wallet, runs add_payment_method, and prints /cards/add#token=....
  • lib/capture-token.ts: validates the <payment-method-id>.<secret> token format.
  • /cards/add gets the same no-store, no-referrer, nosniff and frame-deny headers as the credential page.
  • Bumps @onkernel/vault-react to ^0.5.0 (0.1.0 can't render Evervault cards) and @onkernel/sdk to ^0.148.0 (0.122 has no add_payment_method operation). The credential flows are unchanged and their tests still pass.
  • README: a Card capture section covering the flow, the styling layers, and the CSP origins for VGS and Evervault.

Testing

  • bun run typecheck, bun run test (26 pass, including new tests for the token parser and the page), bun run build
  • End to end against the production Kernel API on an organization that stores cards in Evervault: create-card-link created a link, and /cards/add loaded in headless Chromium with the token cleared from the URL, GET /vault/card-captures/current returning 200, and Evervault's card fields rendered with the custom theme. No card was submitted. The test vault was deleted afterwards.
  • Not tested: an organization on VGS.

@hiroTamada
hiroTamada marked this pull request as ready for review November 17, 2026 20:05
@hiroTamada
hiroTamada requested a review from yummybomb November 17, 2026 20:05

@yummybomb yummybomb left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i’d fix two token-handling cases in app/cards/add/card-capture-page.tsx:62-67 before merging:

  • Switching links in the same tab: If a second enrollment link changes only the fragment, the page stays mounted and the form keeps the first token. If that enrollment is still open, saving the card completes the first enrollment, not the second.
  • Opening a valid link in next dev: Strict Mode runs the mount effect twice. The first run reads the token and clears the fragment; the second reads the empty fragment and overwrites the token with null, so the user sees “This link is incomplete.”

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