{"_id":"@serenity-kit/noble-sodium","_rev":"5-094c5e6fd0c40936f98891503efeacc7","name":"@serenity-kit/noble-sodium","dist-tags":{"latest":"0.2.3"},"versions":{"0.1.0":{"name":"@serenity-kit/noble-sodium","version":"0.1.0","keywords":["noble","libsodium","crypto","cryptography"],"author":{"name":"Naisho GmbH"},"license":"MIT","_id":"@serenity-kit/noble-sodium@0.1.0","maintainers":[{"name":"nikgraf","email":"nik@nikgraf.com"}],"homepage":"https://github.com/serenity-kit/noble-sodium#readme","bugs":{"url":"https://github.com/serenity-kit/noble-sodium/issues"},"dist":{"shasum":"0e4b268092e8957187a67e85aa0db77e9f166ab8","tarball":"https://registry.npmjs.org/@serenity-kit/noble-sodium/-/noble-sodium-0.1.0.tgz","fileCount":58,"integrity":"sha512-ufjvhis8V9mcdoSVadworkvnSWcPz3Vl7QF9vPn+LsmPoX+ok1AAGf4RgRbQ3mBx7xUl8fZt41ZYRvS2gBrsXg==","signatures":[{"sig":"MEUCIQCbG6X3H0kPhCc0/eeS5prOK2oRkwG3ec6SOA0flblagAIgZQWgLzJMLTdE7kRWjpuUaWIdZ/i+XGKGUDVMpU5nCDk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28215},"type":"module","_from":"file:serenity-kit-noble-sodium-0.1.0.tgz","exports":{".":"./dist/index.js"},"scripts":{"test":"vitest --typecheck","build":"pnpm run clean && tsc","clean":"rm -rf ./dist/*"},"_npmUser":{"name":"nikgraf","email":"nik@nikgraf.com"},"_resolved":"/private/var/folders/f2/z0ncmshj4vx15x64_bwwxpd80000gn/T/8571114ac1855dfbf03970c281b9fa80/serenity-kit-noble-sodium-0.1.0.tgz","_integrity":"sha512-ufjvhis8V9mcdoSVadworkvnSWcPz3Vl7QF9vPn+LsmPoX+ok1AAGf4RgRbQ3mBx7xUl8fZt41ZYRvS2gBrsXg==","repository":{"url":"git+https://github.com/serenity-kit/noble-sodium.git","type":"git"},"_npmVersion":"11.0.0","description":"TypeScript library offering a Libsodium-compatible API built on top of Noble packages","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","dependencies":{"@noble/curves":"^1.8.2","@noble/hashes":"^1.7.2","@noble/ciphers":"^1.2.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.1","prettier":"^3.5.3","typescript":"^5.8.3","libsodium-wrappers":"^0.7.15","@types/libsodium-wrappers":"^0.7.14"},"_npmOperationalInternal":{"tmp":"tmp/noble-sodium_0.1.0_1745040878563_0.6814436945921132","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@serenity-kit/noble-sodium","version":"0.2.0","keywords":["noble","libsodium","crypto","cryptography"],"author":{"name":"Naisho GmbH"},"license":"MIT","_id":"@serenity-kit/noble-sodium@0.2.0","maintainers":[{"name":"nikgraf","email":"nik@nikgraf.com"}],"homepage":"https://github.com/serenity-kit/noble-sodium#readme","bugs":{"url":"https://github.com/serenity-kit/noble-sodium/issues"},"dist":{"shasum":"b9468c533c9615a05c0331dceadb76d1dc8fe395","tarball":"https://registry.npmjs.org/@serenity-kit/noble-sodium/-/noble-sodium-0.2.0.tgz","fileCount":63,"integrity":"sha512-q9u8MJZHn82QO44k2GPqOl5/jtmKxz1dJaaxE5gcCyQ+W6yltgKTX/tenqwYkKUNMHotv/VFpAt+TkH7DFRzdA==","signatures":[{"sig":"MEUCIE1UUW8L21nKeB7UF+Tajh18M9qJyJoR8K4Mu0AmuF/6AiEA+k5yg47Gxsda8TnXdrVT3DCiiMnPSvMrE6f+qhh8p90=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45499},"type":"module","_from":"file:serenity-kit-noble-sodium-0.2.0.tgz","exports":{".":"./dist/index.js","./wrappers":"./dist/wrappers.js"},"scripts":{"test":"vitest --typecheck","build":"pnpm run clean && tsc","clean":"rm -rf ./dist/*"},"_npmUser":{"name":"nikgraf","email":"nik@nikgraf.com"},"_resolved":"/private/var/folders/f2/z0ncmshj4vx15x64_bwwxpd80000gn/T/16d0f8bd8735d5d0c0898855baa4b30c/serenity-kit-noble-sodium-0.2.0.tgz","_integrity":"sha512-q9u8MJZHn82QO44k2GPqOl5/jtmKxz1dJaaxE5gcCyQ+W6yltgKTX/tenqwYkKUNMHotv/VFpAt+TkH7DFRzdA==","repository":{"url":"git+https://github.com/serenity-kit/noble-sodium.git","type":"git"},"_npmVersion":"11.0.0","description":"TypeScript library offering a Libsodium-compatible API built on top of Noble packages","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","dependencies":{"@noble/curves":"^1.8.2","@noble/hashes":"^1.7.2","@noble/ciphers":"^1.2.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.1","prettier":"^3.5.3","typescript":"^5.8.3","libsodium-wrappers":"^0.7.15","@types/libsodium-wrappers":"^0.7.14"},"_npmOperationalInternal":{"tmp":"tmp/noble-sodium_0.2.0_1745526215458_0.7169141579127529","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@serenity-kit/noble-sodium","version":"0.2.1","keywords":["noble","libsodium","crypto","cryptography"],"author":{"name":"Naisho GmbH"},"license":"MIT","_id":"@serenity-kit/noble-sodium@0.2.1","maintainers":[{"name":"nikgraf","email":"nik@nikgraf.com"}],"homepage":"https://github.com/serenity-kit/noble-sodium#readme","bugs":{"url":"https://github.com/serenity-kit/noble-sodium/issues"},"dist":{"shasum":"da5e01198b6e056dac582b0794ed0fd758651bdf","tarball":"https://registry.npmjs.org/@serenity-kit/noble-sodium/-/noble-sodium-0.2.1.tgz","fileCount":63,"integrity":"sha512-023EjSl/ZMl8yNmnzeeWJh/V44QyBC82I8xuHltITeWdcyrQHbGnmMZRZOm/uTRinhgqoMzRBNQqbrfyuI5idg==","signatures":[{"sig":"MEUCIQDf6HEeqkw+dLimFExjnd4dLFJxucHZdJaf9tztJY6LcQIgJLGjcVRgUDKhStwJpI6n/ng1u81tgn7kdXXNwO89PXw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46703},"type":"module","_from":"file:serenity-kit-noble-sodium-0.2.1.tgz","exports":{".":"./dist/index.js","./wrappers":"./dist/wrappers.js"},"scripts":{"test":"vitest --typecheck","build":"pnpm run clean && tsc","clean":"rm -rf ./dist/*"},"_npmUser":{"name":"nikgraf","email":"nik@nikgraf.com"},"_resolved":"/private/var/folders/f2/z0ncmshj4vx15x64_bwwxpd80000gn/T/dea3fc9dda49651044fadbc6e7b81ddf/serenity-kit-noble-sodium-0.2.1.tgz","_integrity":"sha512-023EjSl/ZMl8yNmnzeeWJh/V44QyBC82I8xuHltITeWdcyrQHbGnmMZRZOm/uTRinhgqoMzRBNQqbrfyuI5idg==","repository":{"url":"git+https://github.com/serenity-kit/noble-sodium.git","type":"git"},"_npmVersion":"11.0.0","description":"TypeScript library offering a Libsodium-compatible API built on top of Noble packages","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","dependencies":{"@noble/curves":"^1.8.2","@noble/hashes":"^1.7.2","@noble/ciphers":"^1.2.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.1.1","prettier":"^3.5.3","typescript":"^5.8.3","libsodium-wrappers":"^0.7.15","@types/libsodium-wrappers":"^0.7.14"},"_npmOperationalInternal":{"tmp":"tmp/noble-sodium_0.2.1_1745526541859_0.16782438592883864","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@serenity-kit/noble-sodium","version":"0.2.2","keywords":["noble","libsodium","crypto","cryptography"],"author":{"name":"Naisho GmbH"},"license":"MIT","_id":"@serenity-kit/noble-sodium@0.2.2","maintainers":[{"name":"nikgraf","email":"nik@nikgraf.com"}],"homepage":"https://github.com/serenity-kit/noble-sodium#readme","bugs":{"url":"https://github.com/serenity-kit/noble-sodium/issues"},"dist":{"shasum":"e51d9f8ac7eab71457533f844188a36b18d0d72f","tarball":"https://registry.npmjs.org/@serenity-kit/noble-sodium/-/noble-sodium-0.2.2.tgz","fileCount":63,"integrity":"sha512-jW708HkAxRxlvs+NnlSd7wp1qKYJ/EhHIjVyzSqRSSzj7C3poetwGSbGHBfPCC/lEOdGiF85o/iYd9je6EQMkA==","signatures":[{"sig":"MEUCIE+Fgkv5M7DQDOv5v4cd0B07GxzAGy95Y5qcjvA+aVzXAiEAqktsZ9WF7AVT4Xfcsp7nFu8eWLovUvO1dLTrea76+7c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46795},"type":"module","_from":"file:serenity-kit-noble-sodium-0.2.2.tgz","exports":{".":"./dist/index.js","./wrappers":"./dist/wrappers.js"},"scripts":{"test":"vitest --typecheck","build":"pnpm run clean && tsc","clean":"rm -rf ./dist/*"},"_npmUser":{"name":"nikgraf","email":"nik@nikgraf.com"},"_resolved":"/private/var/folders/f2/z0ncmshj4vx15x64_bwwxpd80000gn/T/a98ba4decfd98f7217ac6c21bc4da59f/serenity-kit-noble-sodium-0.2.2.tgz","_integrity":"sha512-jW708HkAxRxlvs+NnlSd7wp1qKYJ/EhHIjVyzSqRSSzj7C3poetwGSbGHBfPCC/lEOdGiF85o/iYd9je6EQMkA==","repository":{"url":"git+https://github.com/serenity-kit/noble-sodium.git","type":"git"},"_npmVersion":"11.6.1","description":"TypeScript library offering a Libsodium-compatible API built on top of Noble packages","directories":{},"sideEffects":false,"_nodeVersion":"24.10.0","dependencies":{"@noble/curves":"^2.0.1","@noble/hashes":"^2.0.1","@noble/ciphers":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.9","prettier":"^3.6.2","typescript":"^5.9.3","libsodium-wrappers":"^0.7.15","@types/libsodium-wrappers":"^0.7.14"},"_npmOperationalInternal":{"tmp":"tmp/noble-sodium_0.2.2_1763317128535_0.3085389468754225","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@serenity-kit/noble-sodium","version":"0.2.3","description":"TypeScript library offering a Libsodium-compatible API built on top of Noble packages","repository":{"type":"git","url":"git+https://github.com/serenity-kit/noble-sodium.git"},"type":"module","keywords":["noble","libsodium","crypto","cryptography"],"exports":{".":"./dist/index.js","./wrappers":"./dist/wrappers.js"},"sideEffects":false,"author":{"name":"Naisho GmbH"},"license":"MIT","publishConfig":{"access":"public"},"dependencies":{"@noble/ciphers":"^2.1.1","@noble/curves":"^2.0.1","@noble/hashes":"^2.0.1"},"devDependencies":{"@changesets/cli":"^2.29.8","libsodium-wrappers":"^0.8.2","prettier":"^3.8.1","typescript":"^5.9.3","vitest":"^4.0.18"},"scripts":{"test":"vitest --typecheck","clean":"rm -rf ./dist/*","build":"pnpm run clean && tsc"},"_id":"@serenity-kit/noble-sodium@0.2.3","bugs":{"url":"https://github.com/serenity-kit/noble-sodium/issues"},"homepage":"https://github.com/serenity-kit/noble-sodium#readme","_integrity":"sha512-/IQuvJHJXg8M8SvrZexB/kI5vP0jkoMhNglFpm12h1SitJldncoOA0aF5asvtybJ8nldnkA/HwGEvEL7t+VIyw==","_resolved":"/private/var/folders/f2/z0ncmshj4vx15x64_bwwxpd80000gn/T/8cdb3d0ef167c6595899f9c6f36220e4/serenity-kit-noble-sodium-0.2.3.tgz","_from":"file:serenity-kit-noble-sodium-0.2.3.tgz","_nodeVersion":"24.10.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-/IQuvJHJXg8M8SvrZexB/kI5vP0jkoMhNglFpm12h1SitJldncoOA0aF5asvtybJ8nldnkA/HwGEvEL7t+VIyw==","shasum":"2b5d61450f9603c736684476c48e65244247472a","tarball":"https://registry.npmjs.org/@serenity-kit/noble-sodium/-/noble-sodium-0.2.3.tgz","fileCount":63,"unpackedSize":46834,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEA9724lJL9n4T12H5rsdl1012W6DSND75e7eMM/tH/vAiAzHjwru4JXOwyoyXupicC8H2KmVcWIpqyEBySqy2k/DQ=="}]},"_npmUser":{"name":"nikgraf","email":"nik@nikgraf.com"},"directories":{},"maintainers":[{"name":"nikgraf","email":"nik@nikgraf.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/noble-sodium_0.2.3_1770103355616_0.8881296112354544"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-19T05:34:38.451Z","modified":"2026-02-03T07:22:35.906Z","0.1.0":"2025-04-19T05:34:38.761Z","0.2.0":"2025-04-24T20:23:35.636Z","0.2.1":"2025-04-24T20:29:02.038Z","0.2.2":"2025-11-16T18:18:48.703Z","0.2.3":"2026-02-03T07:22:35.757Z"},"bugs":{"url":"https://github.com/serenity-kit/noble-sodium/issues"},"author":{"name":"Naisho GmbH"},"license":"MIT","homepage":"https://github.com/serenity-kit/noble-sodium#readme","keywords":["noble","libsodium","crypto","cryptography"],"repository":{"type":"git","url":"git+https://github.com/serenity-kit/noble-sodium.git"},"description":"TypeScript library offering a Libsodium-compatible API built on top of Noble packages","maintainers":[{"name":"nikgraf","email":"nik@nikgraf.com"}],"readme":"## NobleSodium\n\nA TypeScript library offering a Libsodium-compatible API built on top of [Noble Packages](https://paulmillr.com/noble/).\n\n## Why this library?\n\nLibsodium is a modern, easy-to-use software library implementing best practices in cryptography and used in [many applications](https://libsodium.gitbook.io/doc/faq). It even offers a JavaScript compile target leveraging WebAssembly. However, the use of WebAssembly has a few drawbacks:\n\n- No code-splitting\n- It's not supported in all environments (ReactNative)\n\nEven Libsodium's author Frank Denis mentioned:\n\n> libsodium.js was a nice contribution, but honestly, for crypto in JavaScript today, I'd rather use WebCrypto when possible, and Noble cryptography for everything else.\n\nSource: [https://github.com/jedisct1/libsodium.js/issues/327#issuecomment-1793419292](https://github.com/jedisct1/libsodium.js/issues/327#issuecomment-1793419292)\n\nThat said, switching to Noble Packages isn’t without its challenges. Noble is more low level and therefor doesn't offer high level constructions like Sealed Boxes. Hence this library. It offers functions compatible with Libsodium but leverages Noble for the actual cryptography.\n\n## Installation\n\n```bash\nnpm install @serenity-kit/noble-sodium\n```\n\n## How to use\n\n```ts\nimport { cryptoBoxKeyPair } from \"@serenity-kit/noble-sodium\";\n\nconst keypair = cryptoBoxKeyPair();\n```\n\nFor more examples see the [tests](./test/).\n\n## API changes compared to `libsodium-wrappers`\n\n- Instead of accepting multiple parameters, objects are used. This is to avoid accidentally passing wrong parameters.\n- Instead of using underscores, camelCase is used.\n- TypeScript out of the box.\n\n### Function mapping\n\n- `cryptoBoxKeyPair` -> `crypto_box_keypair`\n- `cryptoBoxEasy` -> `crypto_box_easy`\n- `cryptoBoxOpenEasy` -> `crypto_box_open_easy`\n\n- `cryptoSignKeyPair` -> `crypto_sign_keypair`\n- `cryptoSignDetached` -> `crypto_sign_detached`\n- `cryptoSignVerifyDetached` -> `crypto_sign_verify_detached`\n\n- `cryptoBoxSeal` -> `crypto_box_seal`\n- `cryptoBoxSealOpen` -> `crypto_box_seal_open`\n\n## Drop-in replacement for `libsodium-wrappers`\n\nAs an alternative to the root export, the library exports a `wrappers` module that is a drop-in replacement for `libsodium-wrappers`. Keep in mind that not yet all functionality e.g. `outputFormat` as `\"hex\"` is available. Feel free to open a PR or an issue if you need certain functionality.\n\n```ts\nimport * as sodium from \"@serenity-kit/noble-sodium/wrappers\";\n\nconst keypair = sodium.crypto_box_keypair();\n```\n\n## Notable findings\n\n- `crypto_box_easy` does a hsalsa on the shared secret and then uses the result as key for the box\n- Libsodium signing private key is: `[ private_key (32 bytes) ‖ public_key (32 bytes) ]`\n\n## Performance compared to `libsodium-wrappers`\n\nWhile `libsodium-wrappers` is faster, the performance difference is only a few x. See more on this blog post: [https://www.nikgraf.com/blog/choosing-a-cryptography-library-in-javascript-noble-vs-libsodium-js](https://www.nikgraf.com/blog/choosing-a-cryptography-library-in-javascript-noble-vs-libsodium-js)\n\n## How is compatiblity with Libsodium verified?\n\nIn the tests functions from `noble-sodium` and `libsodium-wrappers` are used interchangeably to verify compatibility.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}