{"_id":"@aloecraft/aloecrypt","_rev":"3-ad410abd407f97d6ae4ecc4908f81e7e","name":"@aloecraft/aloecrypt","dist-tags":{"latest":"0.1.18"},"versions":{"0.1.0":{"name":"@aloecraft/aloecrypt","version":"0.1.0","keywords":["cryptography","post-quantum","pqc","ml-kem","ml-dsa","kyber","dilithium","webassembly","wasm"],"author":{"name":"Michael Godfrey","email":"michael@aloecraft.org"},"license":"Apache-2.0","_id":"@aloecraft/aloecrypt@0.1.0","maintainers":[{"name":"mgodf89","email":"michael@aloecraft.org"}],"homepage":"https://aloecraft.org","bugs":{"url":"https://github.com/Aloecraft-org/aloecrypt_js/issues"},"dist":{"shasum":"d68df6d38759e2e5af2fb23bc8e2799615854a22","tarball":"https://registry.npmjs.org/@aloecraft/aloecrypt/-/aloecrypt-0.1.0.tgz","fileCount":27,"integrity":"sha512-RroY0bRb/GMjnIxT7O9QaPkgapRSvWwLUUmvwhbpKLf1VgIyLNyhD/PlFhCkXgEY6yfuv65rwFfg9D4Ddu4kGg==","signatures":[{"sig":"MEUCIAKkJZ0C6d0btW1XwvaOT3DYPdCCqNPGMr7KIQ12xi7ZAiEAmEIk9CEtyO4XE0FBK5n1I/HPOxInW1FIHIq7q0ssYYQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":720935},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"405e2979ff01efd20224f31e2d7927a2b9fef4f6","scripts":{"docs":"typedoc","test":"npm run build && node dist/test.js","build":"tsc && cp .bin/aloecrypt_plugin.wasm dist/aloecrypt_plugin.wasm","serve":"node serve.mjs","bundle":"esbuild dist/index.js --bundle --format=esm --outfile=dist/bundle.js --external:node:*","prepublishOnly":"npm run build"},"_npmUser":{"name":"mgodf89","email":"michael@aloecraft.org"},"repository":{"url":"git+https://github.com/Aloecraft-org/aloecrypt_js.git","type":"git"},"_npmVersion":"10.8.2","description":"Post-quantum secure messaging library for JavaScript and TypeScript","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@extism/extism":"^2.0.0-rc13","@msgpack/msgpack":"^3.1.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.27.3","ts-node":"^10.9.2","typedoc":"^0.28.0","typescript":"^5.9.3","@types/node":"^25.4.0","typedoc-plugin-markdown":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/aloecrypt_0.1.0_1773266285989_0.4453874782802856","host":"s3://npm-registry-packages-npm-production"}},"0.1.17":{"name":"@aloecraft/aloecrypt","version":"0.1.17","keywords":["cryptography","post-quantum","pqc","ml-kem","ml-dsa","kyber","dilithium","webassembly","wasm"],"author":{"name":"Michael Godfrey","email":"michael@aloecraft.org"},"license":"Apache-2.0","_id":"@aloecraft/aloecrypt@0.1.17","maintainers":[{"name":"mgodf89","email":"michael@aloecraft.org"}],"homepage":"https://aloecrypt-js.aloecraft.org","bugs":{"url":"https://github.com/Aloecraft-org/aloecrypt_js/issues"},"dist":{"shasum":"8261c08d5ed3f4d56761835a075a31b5787393e4","tarball":"https://registry.npmjs.org/@aloecraft/aloecrypt/-/aloecrypt-0.1.17.tgz","fileCount":28,"integrity":"sha512-5Jv/dFnUbZIuH1kX7zFzwKEjdVGner3wzINKzhqY6rMo81Y8GN37u2hHevK2f1t3/eRgeO1kKAKQWsfc9gVaeQ==","signatures":[{"sig":"MEUCIDE2vwXuCM8V+6b/hQbxS2nZpg9l5AkcjykHrrJHzDA5AiEA7alWoiTVVFB7oMxwngjzv/DqYm+xbye5cx3bmevpWMk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aloecraft%2faloecrypt@0.1.17","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":738253},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"0ca3d5e1dd7b0295da8f7665b9cc1811c3df6d7d","scripts":{"docs":"typedoc","test":"npm run build && node dist/test.js","build":"tsc && cp .bin/aloecrypt_plugin.wasm dist/aloecrypt_plugin.wasm","serve":"node serve.mjs","bundle":"esbuild dist/index.js --bundle --format=esm --outfile=dist/bundle.js --external:node:*","format":"prettier --write \"src/**/*.{js,jsx,ts,tsx,css,html}\"","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:dff4138e-40fb-4bb4-aede-01b7a3906883"}},"repository":{"url":"git+https://github.com/Aloecraft-org/aloecrypt_js.git","type":"git"},"_npmVersion":"11.11.1","description":"Post-quantum secure messaging library for JavaScript and TypeScript","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@extism/extism":"^2.0.0-rc13","@msgpack/msgpack":"^3.1.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.27.3","ts-node":"^10.9.2","typedoc":"^0.28.0","prettier":"^3.8.1","typescript":"^5.9.3","@types/node":"^25.4.0","typedoc-plugin-markdown":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/aloecrypt_0.1.17_1773275707773_0.5286645477124523","host":"s3://npm-registry-packages-npm-production"}},"0.1.18":{"name":"@aloecraft/aloecrypt","version":"0.1.18","description":"Post-quantum secure messaging library for JavaScript and TypeScript","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc && cp .bin/aloecrypt_plugin.wasm dist/aloecrypt_plugin.wasm && esbuild dist/index.js --bundle --format=esm --outfile=dist/bundle.js --external:node:* --external:fs --external:path --external:url","bundle":"esbuild dist/index.js --bundle --format=esm --outfile=dist/bundle.js --external:node:* --external:fs --external:path --external:url","test":"npm run build && node dist/test.js","serve":"node serve.mjs","prepublishOnly":"npm run build","docs":"typedoc","format":"prettier --write \"src/**/*.{js,jsx,ts,tsx,css,html}\""},"keywords":["cryptography","post-quantum","pqc","ml-kem","ml-dsa","kyber","dilithium","webassembly","wasm"],"author":{"name":"Michael Godfrey","email":"michael@aloecraft.org"},"license":"Apache-2.0","homepage":"https://aloecrypt-js.aloecraft.org","repository":{"type":"git","url":"git+https://github.com/Aloecraft-org/aloecrypt_js.git"},"publishConfig":{"access":"public"},"dependencies":{"@extism/extism":"^2.0.0-rc13","@msgpack/msgpack":"^3.1.3"},"devDependencies":{"@types/node":"^25.4.0","esbuild":"^0.27.3","prettier":"^3.8.1","ts-node":"^10.9.2","typedoc":"^0.28.0","typedoc-plugin-markdown":"^4.0.0","typescript":"^5.9.3"},"gitHead":"47c9fc86d74871d7e5dab277cbb72bb2e1140972","_id":"@aloecraft/aloecrypt@0.1.18","bugs":{"url":"https://github.com/Aloecraft-org/aloecrypt_js/issues"},"_nodeVersion":"24.14.0","_npmVersion":"11.11.1","dist":{"integrity":"sha512-tBjAbN0zO0aDkiE/YGf1mJZHLWmft713CciApNGObbyL5nt5ush9BPZ4drzu1jUof/2ThmnKd0zOLtT3I6sP4w==","shasum":"ce68da6c41e4ffc27a17777a9f63be7c7fd6aca1","tarball":"https://registry.npmjs.org/@aloecraft/aloecrypt/-/aloecrypt-0.1.18.tgz","fileCount":29,"unpackedSize":969615,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aloecraft%2faloecrypt@0.1.18","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCOKWMOc3yAlXYe3TQdfFVUiNUBJpDMiGrAWEqNdRCWdAIhAJxRXu8a7anwsWjtasVcQgqqlxBPmfZTTwQUzfiREAQL"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:dff4138e-40fb-4bb4-aede-01b7a3906883"}},"directories":{},"maintainers":[{"name":"mgodf89","email":"michael@aloecraft.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aloecrypt_0.1.18_1773276248801_0.5052396282357052"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-11T21:58:05.932Z","modified":"2026-03-12T00:44:09.285Z","0.1.0":"2026-03-11T21:58:06.128Z","0.1.17":"2026-03-12T00:35:07.952Z","0.1.18":"2026-03-12T00:44:08.983Z"},"bugs":{"url":"https://github.com/Aloecraft-org/aloecrypt_js/issues"},"author":{"name":"Michael Godfrey","email":"michael@aloecraft.org"},"license":"Apache-2.0","homepage":"https://aloecrypt-js.aloecraft.org","keywords":["cryptography","post-quantum","pqc","ml-kem","ml-dsa","kyber","dilithium","webassembly","wasm"],"repository":{"type":"git","url":"git+https://github.com/Aloecraft-org/aloecrypt_js.git"},"description":"Post-quantum secure messaging library for JavaScript and TypeScript","maintainers":[{"name":"mgodf89","email":"michael@aloecraft.org"}],"readme":"# @aloecraft/aloecrypt\n\n<div align=\"center\">\n\n<img src=\"https://raw.githubusercontent.com/Aloecraft-org/aloecrypt_py/main/docs/icon.png\" style=\"height:96px; width:96px;\"/>\n\n[![npm version](https://img.shields.io/npm/v/@aloecraft/aloecrypt)](https://www.npmjs.com/package/@aloecraft/aloecrypt)\n[![npm downloads](https://img.shields.io/npm/dm/@aloecraft/aloecrypt)](https://www.npmjs.com/package/@aloecraft/aloecrypt)\n[![License](https://img.shields.io/npm/l/@aloecraft/aloecrypt)](https://github.com/Aloecraft-org/aloecrypt_js/blob/main/LICENSE)\n\n**A post-quantum secure messaging library for JavaScript and TypeScript**\n\n</div>\n\nProvides mutual authentication and encrypted sessions using ML-KEM-768 (Kyber)\nfor key encapsulation and ML-DSA-65 (Dilithium) for signatures, with\nChaCha20-Poly1305 for symmetric encryption. The cryptographic core runs as a\nWebAssembly plugin — no native dependencies.\n\n## Installation\n```bash\nnpm install @aloecraft/aloecrypt\n```\n\n## Setup\n\nThe WASM plugin must be initialised before any other calls. In Node:\n```typescript\nimport { initPluginFromBundle } from \"@aloecraft/aloecrypt\";\n\nawait initPluginFromBundle();\n```\n\nOr if you need control over the WASM path:\n```typescript\nimport { readFile } from \"fs/promises\";\nimport { initPlugin } from \"@aloecraft/aloecrypt\";\n\nconst wasm = await readFile(\"path/to/aloecrypt_plugin.wasm\");\nawait initPlugin(new Uint8Array(wasm).buffer);\n```\n\nIn a browser (requires COOP/COEP headers):\n```typescript\nimport { initPlugin } from \"@aloecraft/aloecrypt\";\n\nconst wasm = await fetch(\"/aloecrypt_plugin.wasm\").then(r => r.arrayBuffer());\nawait initPlugin(wasm);\n```\n\n## Quick example\n```typescript\nimport { initPluginFromBundle, DilithiumSigner, SessionBuilder, performHandshake } from \"@aloecraft/aloecrypt\";\n\nawait initPluginFromBundle();\n\nconst EMPTY_TIMESTAMP = new Uint8Array(8);\n\n// Each party creates a root identity once and persists it\nconst rootA = await DilithiumSigner.new();\nconst rootB = await DilithiumSigner.new();\n\n// Build sessions targeting each other's address\nconst builderA = await SessionBuilder.create(rootB.address, rootA);\nconst builderB = await SessionBuilder.create(rootA.address, rootB);\n\n// Run the handshake\nconst [sessionA, sessionB] = await performHandshake(builderA, builderB);\n\n// Encrypt and decrypt\nconst ciphertext = await sessionA.encrypt(new TextEncoder().encode(\"hello\"));\nconst plaintext  = new TextDecoder().decode(await sessionB.decrypt(ciphertext));\nconsole.log(plaintext); // hello\n```\n\n## Custom sessions from pre-shared secrets\n```typescript\nimport { AloecryptSession } from \"@aloecraft/aloecrypt\";\nimport { randomBytes } from \"crypto\";\n\nconst rand = (n: number) => new Uint8Array(randomBytes(n));\n\nconst sessionA = await AloecryptSession.fromSecrets(\n    rand(32), rand(32), rand(3309), rand(32), rand(32),  // party A\n    rand(32), rand(32), rand(3309), rand(32), rand(32),  // party B\n    rand(32),                                            // shared salt\n);\n```\n\n## Key encapsulation\n```typescript\nimport { KyberFullKEM } from \"@aloecraft/aloecrypt\";\n\nconst EMPTY_TIMESTAMP = new Uint8Array(8);\nconst delegate = await rootA.createDelegate(EMPTY_TIMESTAMP, EMPTY_TIMESTAMP, 0, 0);\nconst fullKem  = await KyberFullKEM.create(delegate, EMPTY_TIMESTAMP, EMPTY_TIMESTAMP, 0, 0);\nconst pubKem   = await fullKem.toPublic();\n\nconst [ciphertext, sentSecret] = await pubKem.encapsulate();\nconst recvSecret = await fullKem.decapsulate(ciphertext);\n// sentSecret and recvSecret are identical\n```\n\n## Algorithms\n\n| Role | Algorithm |\n|---|---|\n| Signing | ML-DSA-65 (Dilithium) |\n| Key encapsulation | ML-KEM-768 (Kyber) |\n| Symmetric encryption | ChaCha20-Poly1305 |\n| Key derivation | HKDF-SHA256 |\n\n## License\n\nApache-2.0 — Copyright Michael Godfrey 2026 | [aloecraft.org](https://aloecraft.org)\n","readmeFilename":"README.md"}