Skip to content

Add Electron desktop wallet example (#341)#346

Open
Kingvic300 wants to merge 2 commits into
Miracle656:mainfrom
Kingvic300:electron-desktop-example
Open

Add Electron desktop wallet example (#341)#346
Kingvic300 wants to merge 2 commits into
Miracle656:mainfrom
Kingvic300:electron-desktop-example

Conversation

@Kingvic300

@Kingvic300 Kingvic300 commented Jun 25, 2026

Copy link
Copy Markdown

Closes #341

Summary

  • Adds examples/electron/ — an Electron desktop wallet example that runs the Veil web SDK unmodified in the renderer process (no native plugin, no IPC bridge for crypto). Register/dashboard/send flows mirror the vite-react starter.
  • electron/main.cjs loads the renderer over local HTTP (Vite dev server in dev, a tiny built-in static server in prod) rather than file://, since Chromium does not treat file:// as a secure context and WebAuthn requires one.
  • README documents the resulting platform caveats: per-origin localStorage, native OS biometric prompts, and platform-authenticator differences across macOS/Windows/Linux.
  • Fixes a pre-existing sdk/ build bug found while verifying this example: tsc compiles src/ and react/ together (required, since react/ imports from src/), which nests output under dist/src/* instead of dist/*. package.json's main/exports point at dist/index.js, so that file never actually existed in a fresh build — silently breaking the SDK's main entry point for every example that consumes it (vite-react, tauri, etc.), not just this one. Added sdk/scripts/flatten-dist.js, wired into npm run build, to fix this.

Test plan

  • cd sdk && npm install && npm run build — confirms dist/index.js now exists and require('./dist/index.js').useInvisibleWallet resolves
  • cd examples/electron && npm install && npm run build — renderer builds cleanly
  • Packaged mode (npm start): Electron boots, serves the built bundle over http://localhost:5180, SPA routing/fallback verified (/, /register, asset requests)
  • Dev mode: Vite dev server boots with HMR, Electron loads it, renderer process spawns with DevTools auto-opened, no errors
  • Confirmed via git stash that pre-existing useSendPayment.test.tsx failures are unrelated to the SDK build fix
  • Manual passkey registration with real Touch ID/Windows Hello/security key hardware (not testable in this environment — no display/biometric hardware)

tsc compiles src/ and react/ together (react/ imports from src/), which
made it nest src output under dist/src/* instead of dist/*. package.json's
main/types/exports point at dist/index.js etc., so the SDK's main entry
point never actually existed in a fresh build — breaking every example
that imports '@veil/invisible-wallet-sdk' from the main export.
Runs the Veil web SDK unmodified in an Electron renderer process —
register, dashboard, and send flows mirror the vite-react starter.
main.cjs serves the renderer over local HTTP (dev server or a built-in
static server) since file:// is not a secure context and WebAuthn
requires one. README documents the resulting caveats: per-origin
localStorage, native OS biometric prompts, and platform-authenticator
support differences across macOS/Windows/Linux.
@Kingvic300 Kingvic300 requested a review from Miracle656 as a code owner June 25, 2026 13:44
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

@Kingvic300 is attempting to deploy a commit to the miracle656's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@Kingvic300 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Electron desktop example

1 participant