Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Assembly C C++ Other
branch: master
Failed to load latest commit information.
commandline initial commit: unchanged nacl tarball
cpucycles initial commit: unchanged nacl tarball
cpuid initial commit: unchanged nacl tarball
crypto_auth initial commit: unchanged nacl tarball
crypto_box initial commit: unchanged nacl tarball
crypto_core initial commit: unchanged nacl tarball
crypto_hash initial commit: unchanged nacl tarball
crypto_hashblocks initial commit: unchanged nacl tarball
crypto_onetimeauth initial commit: unchanged nacl tarball
crypto_scalarmult initial commit: unchanged nacl tarball
crypto_secretbox initial commit: unchanged nacl tarball
crypto_sign initial commit: unchanged nacl tarball
crypto_stream initial commit: unchanged nacl tarball
crypto_verify initial commit: unchanged nacl tarball
curvecp initial commit: unchanged nacl tarball
inttypes initial commit: unchanged nacl tarball
okcompilers initial commit: unchanged nacl tarball
randombytes initial commit: unchanged nacl tarball
tests initial commit: unchanged nacl tarball
.gitignore .gitignore: also ignore .lock-wscript
LICENSE add a LICENSE file (public domain)
MACROS initial commit: unchanged nacl tarball
OPERATIONS initial commit: unchanged nacl tarball
PROTOTYPES.c initial commit: unchanged nacl tarball
PROTOTYPES.cpp initial commit: unchanged nacl tarball
README.md Update README.md
cpucycles.o add symlinks to the built .o files because waf wants it to be that way
do Modify "do" build script for consistent hostname
index.js commit main binding code :)
measure-anything.c initial commit: unchanged nacl tarball
node_nacl.cc somehow make this work again on node v0.6
package.json bump to 0.1.2
randombytes.o add symlinks to the built .o files because waf wants it to be that way
try-anything.c initial commit: unchanged nacl tarball
version initial commit: unchanged nacl tarball
wscript somehow make this work again on node v0.6

README.md

WARNING: This library DOES NOT WORK on 64-bit systems, and there's nothing I can do about it before the next version of NaCl is available.

Bindings for the Networking and Cryptography library (NaCl). This gives you a fast and easy-to-use crypto box: Put stuff inside, turn the key and it's automagically signed and encrypted. Reverse direction works, too. There's also signing functionality. For details about how to use that stuff, go to the NaCl homepage.

Methods and Properties

box, unbox, sign and unsign return null if one of the parameters is incorrect or a signature is invalid. The methods never throw.

Crypto-Box

// encrypt and sign (message may be string or Buffer, all others must be Buffers, returns a Buffer)
box(message, nonce, pubkey, privkey)
// decrypt and validate (all parameters buffers, returns a Buffer or null)
unbox(box, nonce, pubkey, privkey)
// generates a new keypair, returns {private: <buffer>, public: <buffer>}
boxKeypair()
// lengths of nonces and public and private keys in bytes
// { nonce: x, pubkey: x, privkey: x }
lengths.box

Signatures

// sign, returns the signed message as Buffer (message is a Buffer or a string, privkey is a Buffer)
sign(message, privkey)
// verify signature and remove it (parameters are Buffers, returns a Buffer or null)
unsign(message, pubkey)
// generates a new keypair, returns {private: <buffer>, public: <buffer>}
signKeypair()
// lengths of public and private keys in bytes
// { pubkey: x, privkey: x }
lengths.sign

Installation

This takes some time because there's a long benchmark that takes place after the actual C++ library got compiled. Didn't measure the time, but it's more than a few minutes.

npm install nacl
Something went wrong with that request. Please try again.