Experimental 🔬 sodium-javascript with support for xchacha20 and kx
$ npm install @geut/sodium-javascript-plus
const message = Buffer.from('some secret message')
const ad = Buffer.from('50515253c0c1c2c3c4c5c6c7', 'hex')
const nonce = Buffer.from('404142434445464748494a4b4c4d4e4f5051525354555657', 'hex')
const key = Buffer.from('808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f', 'hex')
const cipher = Buffer.alloc(message.length + sodium.crypto_aead_xchacha20poly1305_ietf_ABYTES)
sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(
cipher,
message,
ad,
null,
nonce,
key
)
const decrypted = Buffer.alloc(message.length)
sodium.crypto_aead_xchacha20poly1305_ietf_decrypt(
decrypted,
null,
cipher,
ad,
nonce,
key
)
console.log(message.equals(decrypted), 'same message')
const extend = require('@geut/sodium-javascript-plus/extend')
const sodium = extend(require('sodium-javascript'))
// ...
🐛 If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.
👥 Ideas and contributions to the project are welcome. You must follow this guideline.
MIT © A GEUT project