Installation
Add the package and check what the runtime supports.
pnpm add @0xsarwagya/ghost# or: npm install @0xsarwagya/ghostThe package has two entry points and zero dependencies:
@0xsarwagya/ghost— the browser API: identity lifecycle and signing.@0xsarwagya/ghost/server— the verifier: challenges, proofs, replay protection. Runs anywhereglobalThis.cryptoexists — Node 20+, Deno, Bun, and edge runtimes. Node 18.17+ works but 20+ is recommended.
Runtime requirements
The browser side needs Web Crypto Ed25519 and IndexedDB — baseline in Chromium 137+, Firefox 129+, and Safari 17+. Instead of memorizing that, ask the runtime:
import { capabilities } from "@0xsarwagya/ghost";
const caps = await capabilities();
if (!caps.supported) {
// Render an honest unsupported state. caps.webCrypto, caps.ed25519,
// and caps.indexedDB say exactly what is missing.
}