{"_id":"@7h3/protocol-browser","_rev":"2-cc22aac0b1c8c98bc6faea7fbe8b01a0","name":"@7h3/protocol-browser","dist-tags":{"latest":"0.6.1"},"versions":{"0.4.0":{"name":"@7h3/protocol-browser","version":"0.4.0","keywords":["7h3","protocol","browser","webcrypto","ed25519","signing","mcp"],"license":"MIT","_id":"@7h3/protocol-browser@0.4.0","maintainers":[{"name":"7h3.agency","email":"ice@7h3.agency"}],"dist":{"shasum":"d881d4decdc96a8e3033d626ee5d51414ddf4bf6","tarball":"https://registry.npmjs.org/@7h3/protocol-browser/-/protocol-browser-0.4.0.tgz","fileCount":3,"integrity":"sha512-rTZQ6B7oPxDkV64ykx6qJJY9JpDb8gvk0L3gmo2jv/cdx0W+EtWwVvcES5XlMtuoALqUxCnP6JNgXDO8GRoxTw==","signatures":[{"sig":"MEUCIDzUpsBG/Lg9e7zEQk8nOcpl4obrvRjoiDr1/SfsahIfAiEAn6lj248xDvQ1XYnBuLtoSkrZhVn+aHjehU7lo+ZDCoA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13299},"main":"./index.js","type":"module","types":"./index.d.ts","module":"./index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js"}},"gitHead":"ea2198d81786fa9105714605f9a66c054cba4ecf","_npmUser":{"name":"7h3.agency","email":"ice@7h3.agency"},"_npmVersion":"11.12.1","description":"7h3 Protocol - Browser/Edge SDK. Pure Web Crypto API. Zero dependencies.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/protocol-browser_0.4.0_1782661175220_0.5224188997113146","host":"s3://npm-registry-packages-npm-production"}},"0.6.1":{"name":"@7h3/protocol-browser","version":"0.6.1","description":"7h3 Protocol - Browser/Edge SDK. Pure Web Crypto API. Zero dependencies.","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"keywords":["7h3","protocol","browser","webcrypto","ed25519","signing","mcp"],"license":"Apache-2.0","sideEffects":false,"scripts":{"build":"tsc","smoke":"node scripts/smoke-test-package.mjs","prepublishOnly":"npm run build"},"devDependencies":{"typescript":"~6.0.3"},"repository":{"type":"git","url":"git+https://github.com/IceMasterT/7h3-protocol.git"},"gitHead":"b8537c5168bc6740af6fbb51f5a1ffed3288967b","_id":"@7h3/protocol-browser@0.6.1","bugs":{"url":"https://github.com/IceMasterT/7h3-protocol/issues"},"homepage":"https://github.com/IceMasterT/7h3-protocol#readme","_nodeVersion":"24.20.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-Ytwgvgz4g+/AU6k5ZE9rs36hr+z8Vpn92D/Q738VQfKXmPOYDo2wuZ+EN8CPF3Au0pf/d7GbgAKp837JEUeKRw==","shasum":"182d87208e58eb869008b7847da68cb4a0cd3d94","tarball":"https://registry.npmjs.org/@7h3/protocol-browser/-/protocol-browser-0.6.1.tgz","fileCount":6,"unpackedSize":28196,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@7h3%2fprotocol-browser@0.6.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD0a4sryLkW+8RIO7mBtubQqs3EWI/k7SyUDF5X74rk0wIhANPpwFDI81LuKpvlSzAJwJEBvZcf2Fqh4LAsLXMmKoac"}]},"_npmUser":{"name":"7h3.agency","email":"ice@7h3.agency"},"directories":{},"maintainers":[{"name":"7h3.agency","email":"ice@7h3.agency"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/protocol-browser_0.6.1_1788380238478_0.1600041032189996"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-28T15:39:35.091Z","modified":"2026-09-02T20:17:18.911Z","0.4.0":"2026-06-28T15:39:35.349Z","0.6.1":"2026-09-02T20:17:18.598Z"},"license":"Apache-2.0","keywords":["7h3","protocol","browser","webcrypto","ed25519","signing","mcp"],"description":"7h3 Protocol - Browser/Edge SDK. Pure Web Crypto API. Zero dependencies.","maintainers":[{"name":"7h3.agency","email":"ice@7h3.agency"}],"readme":"# @7h3/protocol-browser\n\n**7h3 Protocol — Browser/Edge SDK.** Pure Web Crypto, zero dependencies,\n`sideEffects: false`.\n\n```bash\nnpm install @7h3/protocol-browser\n```\n\nA self-contained implementation of the `7h3/0.1` wire format for environments\nwhere you want the smallest possible surface: sign, verify, validate, and\nattach an envelope to a `fetch`. If you need gateways, capability tokens,\nreplay stores or encryption, use [`@7h3/protocol`](https://www.npmjs.com/package/@7h3/protocol)\n— it is also pure Web Crypto and runs in the browser unchanged.\n\n## Use\n\n```ts\nimport {\n  generateKeypair,\n  createEnvelope,\n  signEnvelope,\n  verifyEnvelope,\n  validateEnvelope,\n} from '@7h3/protocol-browser'\n\nconst { publicKey, privateKey } = await generateKeypair()\n\nconst envelope = createEnvelope({\n  sender: 'browser@example.com',\n  body: { intent: 'TASK', content: 'hello' },\n  ttlMs: 60_000,\n})\n\nconst signed = await signEnvelope(envelope, privateKey, 'k1')\nawait verifyEnvelope(signed, publicKey)   // → true\n```\n\n> `createEnvelope` takes a **nested `body`** here, unlike the core's flattened\n> `{ intent, content }`. The wire format is identical either way.\n\n## Validation\n\n```ts\nvalidateEnvelope(signed)\n// → [] when valid, otherwise [{ level: 'error', message: '…' }]\n```\n\nEnforces the same rules as the TypeScript, Python, Rust and Go SDKs: the wire\nversion, presence of `messageId` / `sender` / `nonce`, finite `timestampMs` and\n`ttlMs`, the 24h `MAX_TTL_MS` ceiling, the 30s `MAX_CLOCK_SKEW_MS`\nfuture-timestamp ceiling, and expiry.\n\n`isEnvelopeExpired` **fails closed**: a non-finite timestamp or TTL counts as\nexpired, because `NaN + NaN < now` is false and naive arithmetic would wave such\nan envelope through.\n\n## Signing a request\n\n```ts\nimport { signRequest, ENVELOPE_HEADER } from '@7h3/protocol-browser'\n\nconst request = await signRequest(new Request(url, { method: 'POST' }), {\n  sender: 'browser@example.com',\n  privateKey,\n  keyId: 'k1',\n})\n```\n\n## Cross-SDK guarantee\n\nAn envelope signed here verifies under every other 7h3 SDK and vice versa. That\nis not an aspiration — `src/browserParity.test.ts` compares canonical bytes,\nround-trips signatures in both directions, and asserts that both SDKs emit\nidentical validation diagnostics for every malformed envelope.\n\n## Requirements\n\nA **secure context** — `crypto.subtle` is unavailable over plain HTTP\n(`localhost` counts). Ed25519 in Web Crypto needs a current browser.\n\n**Do not ship a private key to the browser.** A page-generated key is fine for\nsigning that visitor's own session artifacts; anything representing your\norigin's identity must be signed server-side.\n\n## Building agent tools?\n\nUse [`@7h3/protocol-webmcp`](https://www.npmjs.com/package/@7h3/protocol-webmcp)\n— capability scoping, replay protection and signed receipts for WebMCP tools.\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","homepage":"https://github.com/IceMasterT/7h3-protocol#readme","repository":{"type":"git","url":"git+https://github.com/IceMasterT/7h3-protocol.git"},"bugs":{"url":"https://github.com/IceMasterT/7h3-protocol/issues"}}