Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geut/sodium-javascript-plus
sodium-javascript with experimental support for xchacha20 and kx
https://github.com/geut/sodium-javascript-plus
assemblyscript crypto kx sodium wasm xchacha20
Last synced: about 1 month ago
JSON representation
sodium-javascript with experimental support for xchacha20 and kx
- Host: GitHub
- URL: https://github.com/geut/sodium-javascript-plus
- Owner: geut
- License: mit
- Created: 2020-04-06T00:30:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-15T18:55:38.000Z (over 4 years ago)
- Last Synced: 2024-10-13T06:43:06.880Z (2 months ago)
- Topics: assemblyscript, crypto, kx, sodium, wasm, xchacha20
- Language: JavaScript
- Homepage:
- Size: 658 KB
- Stars: 16
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# sodium-javascript-plus
[![Build Status](https://travis-ci.com/geut/sodium-javascript-plus.svg?branch=master)](https://travis-ci.com/geut/sodium-javascript-plus)
[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)> **Experimental** :microscope: sodium-javascript with support for xchacha20 and kx
```
$ npm install @geut/sodium-javascript-plus
``````javascript
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')
```### You can extend your sodium instance
```javascript
const extend = require('@geut/sodium-javascript-plus/extend')
const sodium = extend(require('sodium-javascript'))// ...
```:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/sodium-javascript-plus/issues). Please specify your OS and the actions to reproduce it.
:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/sodium-javascript-plus/blob/master/CONTRIBUTING.md).
## License
MIT © A [**GEUT**](http://geutstudio.com/) project