{"_id":"@emeraldlabs/emvault-jade","name":"@emeraldlabs/emvault-jade","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@emeraldlabs/emvault-jade","version":"0.1.0","description":"Dependency-free Blockstream Jade WebSerial (USB) driver for the browser — Bitcoin PSBT signing and device onboarding over Jade's CBOR-RPC protocol.","license":"MIT OR Apache-2.0","author":{"name":"Greg Mikeska","url":"https://github.com/gmikeska"},"type":"module","scripts":{"test":"node --test"},"main":"src/index.js","module":"src/index.js","types":"src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","default":"./src/index.js"}},"engines":{"node":">=18"},"repository":{"type":"git","url":"git+https://github.com/gmikeska/emvault-jade.git"},"homepage":"https://github.com/gmikeska/emvault-jade#readme","bugs":{"url":"https://github.com/gmikeska/emvault-jade/issues"},"keywords":["bitcoin","jade","blockstream","webserial","hardware-wallet","psbt"],"publishConfig":{"access":"public"},"sideEffects":false,"gitHead":"1a780a824e5afc8e4acf83cb9a90d523b41e8e8e","_id":"@emeraldlabs/emvault-jade@0.1.0","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-OZ1LST+qrUKfH2N8U+tj6NrRe/O7MOAf3iNOnOYax3OcVwyFI9A/a8bZlC1UzKTsYDF3YiR5fnsEcFDm9xvRxg==","shasum":"ae3d30b2767220db64d3b6f7e07f97d7d1310524","tarball":"https://registry.npmjs.org/@emeraldlabs/emvault-jade/-/emvault-jade-0.1.0.tgz","fileCount":8,"unpackedSize":60352,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHcEnUQfQiL+wIbX0OFMyOr5iJYol85mzu3eUL1eoJdjAiEA5feNSnd9G1FZMiUeq6+39uIIvnpWn3ikkA3y3WpwPfc="}]},"_npmUser":{"name":"digital_intaglio","email":"gmikeska07@gmail.com"},"directories":{},"maintainers":[{"name":"digital_intaglio","email":"gmikeska07@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emvault-jade_0.1.0_1782926939099_0.4365566252822852"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-01T17:28:58.950Z","0.1.0":"2026-07-01T17:28:59.254Z","modified":"2026-07-01T17:28:59.456Z"},"maintainers":[{"name":"digital_intaglio","email":"gmikeska07@gmail.com"}],"description":"Dependency-free Blockstream Jade WebSerial (USB) driver for the browser — Bitcoin PSBT signing and device onboarding over Jade's CBOR-RPC protocol.","homepage":"https://github.com/gmikeska/emvault-jade#readme","keywords":["bitcoin","jade","blockstream","webserial","hardware-wallet","psbt"],"repository":{"type":"git","url":"git+https://github.com/gmikeska/emvault-jade.git"},"author":{"name":"Greg Mikeska","url":"https://github.com/gmikeska"},"bugs":{"url":"https://github.com/gmikeska/emvault-jade/issues"},"license":"MIT OR Apache-2.0","readme":"# @emeraldlabs/emvault-jade\n\nA **dependency-free Blockstream Jade driver for the browser**, speaking Jade's\nCBOR-RPC protocol directly over the **Web Serial API** (USB).\n\nIt exists because `lwk_wasm`'s `Jade` has no Bitcoin `sign_psbt` entry point and\nno xpub / fingerprint / multisig-registration surface. This driver fills that\ngap: **Bitcoin PSBT signing** plus full **device onboarding** (xpub, master\nfingerprint, multisig registration) over a single USB connection.\n\n## Requirements\n\n- A **Chromium-based desktop browser** (Web Serial API: Chrome/Edge/Brave/Arc).\n  The driver throws a clear error elsewhere.\n- A Blockstream **Jade** (v1, Jade Plus, or a DIY ESP32 build — USB-UART\n  filters for CP210x / ESP32-S3 / CH9102 / CH340 are pre-registered).\n\n## Install\n\n```sh\nnpm install @emeraldlabs/emvault-jade\n```\n\nZero runtime dependencies; ships as ES modules with TypeScript types. Runs in the\nbrowser (Web Serial). No build step required.\n\n## Usage\n\n```js\nimport { JadeRpc } from \"@emeraldlabs/emvault-jade\";\n\nconst jade = await JadeRpc.fromSerial();          // call inside a click handler\nawait jade.unlock(\"testnet\");                     // PIN on device → pinserver auth\n\n// Onboarding\nconst fp   = await jade.getMasterFingerprintHex(\"testnet\");\nconst xpub = await jade.getXpub(\"testnet\", \"m/84'/1'/0'\");\nawait jade.registerMultisig(\"testnet\", \"ast1234\", multisigFileText);\n\n// Bitcoin signing\nconst signedPsbt = await jade.signPsbt(\"testnet\", psbtBytes); // Uint8Array\n\nawait jade.close();\n```\n\n> `fromSerial()` calls `navigator.serial.requestPort()`, which the browser only\n> allows from a **user gesture** — invoke it from a click/tap handler, not on\n> page load.\n\n> **Pinserver / CORS:** `unlock()` performs Jade's PIN handshake by POSTing from\n> the browser to Blockstream's pinserver (`https://j8d.io` or\n> `jadepin.blockstream.com`). Your app's origin must be allowed to reach it — if\n> a browser CORS policy or network filter blocks the request, `unlock()` rejects\n> with a clear *\"could not reach the pinserver … (network error or CORS block)\"*\n> message (distinct from a pinserver that answers with an error status).\n\n## API\n\n| Method | Purpose |\n|---|---|\n| `JadeRpc.fromSerial({ filter? })` | Open a Web Serial port and wrap it. Pass `{ filter: false }` for unlisted USB-UART chips. |\n| `unlock(network)` | Auth handshake — relays the device's `http_request` to Blockstream's pinserver. |\n| `getXpub(network, path)` | XPUB at a derivation path (`\"m/84'/1'/0'\"` or a `u32[]`). |\n| `getMasterFingerprintHex(network)` | Master key fingerprint (hex). |\n| `registerMultisig(network, name, descriptor)` | Register a Bitcoin multisig wallet. |\n| `signPsbt(network, psbtBytes)` | Sign a Bitcoin PSBT → signed PSBT bytes. |\n| `close()` | Release the serial port (idempotent). |\n\nAlso exported: `NETWORKS` (valid network strings), and helpers\n`pathToU32Array`, `base58CheckDecode`, `bytesToHex`, `hexToBytes`,\n`base64ToBytes`, `bytesToBase64`.\n\nThe driver is silent by default. For troubleshooting, set `JadeRpc.debug = true`\nto surface read-loop/decode diagnostics on the console.\n\n## Network names\n\nJade firmware expects specific identifiers:\n\n| Chain | `network` argument |\n|---|---|\n| Bitcoin mainnet | `mainnet` |\n| Bitcoin testnet/signet | `testnet` |\n| Bitcoin regtest | `localtest` |\n\n## Liquid / Elements support (pair with `lwk_wasm`)\n\n`@emeraldlabs/emvault-jade` is Bitcoin-only. To add **Liquid/Elements** (PSET signing and\nLiquid onboarding) on the same page, pair it with\n[`lwk_wasm`](https://www.npmjs.com/package/lwk_wasm) (built with the `serial`\nfeature). Two companion guides in this repo cover that:\n\n- **[BUILD_LWK_FROM_SOURCE.md](https://github.com/gmikeska/emvault-jade/blob/master/BUILD_LWK_FROM_SOURCE.md)**\n  — how to **build and install `lwk_wasm`** yourself (Rust + `wasm-pack`\n  toolchain, pinned commit, vendoring the output into your app), for Elements support. (As of June 1st, 2026, the version of lwk_wasm on npm doesn't come with USB support so Jade functionality requres a compiled library)\n- **[WEBSERIAL_PORT_LIFECYCLE.md](https://github.com/gmikeska/emvault-jade/blob/master/WEBSERIAL_PORT_LIFECYCLE.md)**\n  — how to use **`@emeraldlabs/emvault-jade` alongside `lwk_wasm`** for Elements support:\n  managing the shared Web Serial port between the two drivers (single-session reuse, and the page reload needed when switching Liquid ↔ Bitcoin).\n\n## Layout\n\n```\nsrc/index.js     — public re-exports\nsrc/jade-rpc.js  — the JadeRpc CBOR-RPC WebSerial driver (no dependencies)\nsrc/cbor.js      — minimal CBOR encode/decode\n```\n\nNo build step: ship the ES modules as-is, or bundle with your app.\n","readmeFilename":"README.md","_rev":"1-81dcceab9695789309ae07c6cd0e2e30"}