{"library":"sodium-javascript","title":"Sodium JavaScript Cryptography Library","type":"library","description":"sodium-javascript is a pure JavaScript implementation of the libsodium cryptographic library's API, leveraging `tweetnacl` as its foundation. It was developed to provide a browser-compatible alternative to `sodium-native`, which is a Node.js native addon binding to the C libsodium library. The package's current stable version is 0.8.0, but it explicitly states 'WIP - Work In Progress' in its README and was last published over four years ago (January 2022). This suggests the project is largely unmaintained or abandoned. Its key differentiator was offering a pure JavaScript fallback for environments where native bindings are not feasible (e.g., browsers). For modern cross-platform libsodium usage, alternatives like `libsodium-wrappers` (which utilizes WebAssembly for better performance and broader API coverage) are generally recommended.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install sodium-javascript"],"cli":null},"imports":["const sodium = require('sodium-javascript')","const sodium = require('sodium-javascript'); sodium.crypto_secretbox_easy(...)","const sub = require('sodium-javascript/submodule-name')"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/sodium-friends/sodium-javascript","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/sodium-javascript","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"const sodium = require('sodium-javascript')\n\nconst key = Buffer.alloc(sodium.crypto_secretbox_KEYBYTES)\nconst nonce = Buffer.alloc(sodium.crypto_secretbox_NONCEBYTES)\n\nsodium.randombytes_buf(key)\nsodium.randombytes_buf(nonce)\n\nconst message = Buffer.from('Hello, World!')\nconst cipher = Buffer.alloc(message.length + sodium.crypto_secretbox_MACBYTES)\n\nsodium.crypto_secretbox_easy(cipher, message, nonce, key)\n\nconsole.log('Encrypted:', cipher.toString('hex'))\n\nconst plainText = Buffer.alloc(cipher.length - sodium.crypto_secretbox_MACBYTES)\n\nsodium.crypto_secretbox_open_easy(plainText, cipher, nonce, key)\n\nconsole.log('Plaintext:', plainText.toString())","lang":"javascript","description":"This quickstart demonstrates basic authenticated encryption and decryption using the `crypto_secretbox_easy` and `crypto_secretbox_open_easy` functions, including key and nonce generation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}