sodium-javascript

WebJar for sodium-javascript

License

License

MIT
Categories

Categories

JavaScript Languages
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

sodium-javascript
Last Version

Last Version

0.5.5
Release Date

Release Date

Type

Type

jar
Description

Description

sodium-javascript
WebJar for sodium-javascript
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sodium-friends/sodium-javascript

Download sodium-javascript

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/sodium-javascript/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>sodium-javascript</artifactId>
    <version>0.5.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/sodium-javascript/
implementation 'org.webjars.npm:sodium-javascript:0.5.5'
// https://jarcasting.com/artifacts/org.webjars.npm/sodium-javascript/
implementation ("org.webjars.npm:sodium-javascript:0.5.5")
'org.webjars.npm:sodium-javascript:jar:0.5.5'
<dependency org="org.webjars.npm" name="sodium-javascript" rev="0.5.5">
  <artifact name="sodium-javascript" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='sodium-javascript', version='0.5.5')
)
libraryDependencies += "org.webjars.npm" % "sodium-javascript" % "0.5.5"
[org.webjars.npm/sodium-javascript "0.5.5"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : blake2b jar [2.1.1,3)
org.webjars.npm : nanoassert jar [1.0.0,2)
org.webjars.npm : siphash24 jar [1.0.1,2)
org.webjars.npm : xsalsa20 jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

sodium-javascript

Build Status

WIP - a pure javascript version of sodium-native. Based on tweetnacl

Usage

const sodium = require('sodium-javascript')

const key = Buffer.alloc(sodium.crypto_secretbox_KEYBYTES)
const nonce = Buffer.alloc(sodium.crypto_secretbox_NONCEBYTES)

sodium.randombytes_buf(key)
sodium.randombytes_buf(nonce)

const message = Buffer.from('Hello, World!')
const cipher = Buffer.alloc(message.length + sodium.crypto_secretbox_MACBYTES)

sodium.crypto_secretbox_easy(cipher, message, nonce, key)

console.log('Encrypted:', cipher)

const plainText = Buffer.alloc(cipher.length - sodium.crypto_secretbox_MACBYTES)

sodium.crypto_secretbox_open_easy(plainText, cipher, nonce, key)

console.log('Plaintext:', plainText.toString())

API

See sodium-native. This is a work in progress so not all functions are implemented yet.

This module is organised into individual submodules which can be required independently for smaller bundles in the browser. To leverage automatic switching between sodium-javascript and sodium-native, see sodium-universal.

Install

npm install sodium-javascript

License

MIT

org.webjars.npm

Sodium Friends

Javascript friends of libsodium. Join us at #sodium-friends on Freenode IRC

Versions

Version
0.5.5