npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@qntx/wallet-worker

v0.16.0

Published

Web Worker and worker_threads hosts for @qntx/wallet

Readme

@qntx/wallet-worker

Web and Node host for @qntx/wallet: spawns the wallet kernel in a Worker (dist/kernel.worker.js / dist/kernel.node.js, bundled), keeps the encrypted vault in IndexedDB (Web) or a main-thread store server (Node), and runs the WebAuthn PRF passkey ceremony on the main thread. Peer dependency: the exact @qntx/wallet release this kernel was built against — the host/kernel protocol requires it. dist/kernel.manifest.json records the protocol version, vault format, every pinned kernel dependency's lockfile integrity and the SHA-256 of each bundle.

npm install @qntx/wallet-worker @qntx/wallet

Web

@qntx/wallet-worker/browser:

import { verifyEvent } from "@qntx/nostr";
import { createWebWallet } from "@qntx/wallet-worker/browser";

const wallet = await createWebWallet({
  passkey: {
    rpId: "wallet.example.com", // permanent, wallet-only — see Security notes
    rpName: "Example",
    walletSalt: "example/wallet",
    vaultSalt: "example/vault",
    backupSalt: "example/backup",
  },
  autoLock: { platform: "web", idleMinutes: 15 }, // 5 | 15 | 60; max session 12 h
  verifyEvent, // verifies every event the kernel signs; pass your app's verifier
});

const created = await wallet.wallets.createWithPasskey({ name: "Example Wallet" });
await wallet.vault.unlock({ kind: "passkey" });

import { nostr } from "@qntx/wallet/nostr";

const key = await nostr(wallet).deriveKey(created.walletId, 0);
const signer = nostr(wallet).signer(key.ref);

Node (tests and demos)

@qntx/wallet-worker/node runs the same kernel in a node:worker_threads Worker with an in-memory vault store. createSoftwarePasskey(seed) is a test-only WebAuthn stand-in — deterministic, no authenticator, anyone holding the seed owns the wallet:

import { verifyEvent } from "@qntx/nostr";
import { createNodeWallet, createSoftwarePasskey } from "@qntx/wallet-worker/node";

// The deterministic seed behind the software passkey — test/dev hosts only.
declare const seed: Uint8Array;

const wallet = await createNodeWallet({
  passkey: {
    rpId: "qntx.test",
    rpName: "test",
    walletSalt: "t/wallet",
    vaultSalt: "t/vault",
    backupSalt: "t/backup",
  },
  autoLock: { platform: "web", idleMinutes: 15 },
  verifyEvent,
  authenticator: createSoftwarePasskey(seed),
});

Security notes

  • Secrets exist only inside the kernel Worker; vault.lock() resolves immediately on the host and destroys the worker — the vault image (ciphertext + public headers) persists in the store.

  • Session limits belong to the worker, not the page: idleMinutes accepts 5, 15 or 60 and the absolute session cap is a fixed 12 hours, measured on a monotonic clock. On the Web only user presence (input events, a tab becoming visible) refreshes the idle timer — background request traffic does not; on Node every successful request does.

  • WalletInfo.backup is "mnemonic", "passkey" (a synced passkey — prompt the user to export) or "none" (a device-bound passkey — survives only on this device). exportMnemonic upgrades the record to "mnemonic".

  • createSoftwarePasskey(seed, { synced }) — synced defaults to true and lands in every PrfResult; pass { synced: false } to exercise the device-bound path.

  • The rpId scope is the wallet's trust boundary: any origin that may claim the RP id (its subdomains, its related origins) can derive a passkey wallet's seed with one passkey prompt. Serve the wallet from a domain of its own and use that domain as the rpId.

  • passkey.rpId and the three salts are permanent identifiers: changing them makes existing passkey factors and passkey-derived wallets unrecoverable. Moving domains needs WebAuthn related origins (/.well-known/webauthn); offer exportMnemonic for passkey-derived wallets.

  • IndexedDB upgrades are never blocked: the worker closes its connection on versionchange, and once the database is newer than this build's schema the vault reports { status: "unsupported", reason: "newer" } — update the app, do not reset.

  • The Node store's RPC failures surface as unavailable and precondition failures as conflict — neither hangs a kernel call.

  • The Web host is a hot wallet. CSP needs worker-src 'self'. The host spawns the kernel with new Worker(new URL("kernel.worker.js", import.meta.url)), which bundlers emit as a worker entry with its chunks and spark.wasm. Consumer setup: Vite — worker: { format: "es" } (required to keep the Spark backend lazy; the default "iife" still runs but ships Spark inside the initial worker) and dev-server optimizeDeps.exclude: ["@qntx/wallet-worker"]; webpack 5 — nothing.

  • Trusted Types (require-trusted-types-for 'script') works with a default policy that admits the bundled kernel worker. Bundlers recognise the worker only in the literal new Worker(new URL(…)) form, so the library cannot pass a named policy's TrustedScriptURL itself. Add trusted-types default to the CSP and install the policy before createWebWallet:

    trustedTypes?.createPolicy("default", {
      createScriptURL: (input) => {
        const url = new URL(input, location.href);
        if (url.origin !== location.origin || !/\/kernel\.worker[^/]*\.js$/.test(url.pathname)) {
          throw new TypeError(`script URL not allowed: ${input}`);
        }
        return url.href;
      },
    });

    The Playwright suite runs the whole Web host under exactly this CSP and policy.

  • Custom schemes (Electron app://): register the scheme standard, secure and supportFetchAPI (protocol.registerSchemesAsPrivileged) — the vault needs a real origin and a secure context, and Spark needs fetch of spark.wasm. Passkeys are unavailable there: Chromium admits WebAuthn only on https, localhost and extension origins, so create the vault behind a password factor.

  • dist/kernel.manifest.json pins the artifacts the package was built from. Consumer bundlers re-bundle the worker, so the shipped bytes differ from the manifest's; spark.wasm is still verified by its integrity constant when the kernel loads it.

  • @qntx/wallet/host is for host packages only — not application API.

License

MIT OR Apache-2.0