You will not need to do this for a fresh checkout, since the project policy is to include the generated javascript as a checked-in file.
- Python 2.x
- a recent Emscripten, which in turn has dependencies on:
- LLVM 3.2
- Clang 3.2
- Node.js 0.6.12 or newer
- Python 2.7.3
Within the js-nacl
directory,
-
import.py
massages an unpackednacl
tarball, extracting just the reference implementations of the various algorithms. (See its origin in Brian Warner'sminimal
branch of pynacl.) -
keys.c
extends corenacl
with a pynacl-compatible implementation ofcrypto_sign_keypair_from_raw_sk
, the foundation fornacl.crypto_sign_keypair_from_seed
. -
nacl_cooked.js
is the high-level Javascript interface to the low-level code. -
nacl_cooked_prefix.js
andnacl_cooked_suffix.js
are wrapped aroundnacl_cooked.js
andnacl_raw.js
to createlib/nacl.js
. -
nacl_randombytes_emscripten.js
is infrastructure for making the Emscripten-compiled library parameterized in its source of randomness. -
test_nacl_browser.html
is a simple example/test of the code running in the browser. -
test_nacl_node.js
is a simple example/test for running in node.js:node test_nacl_node.js
. -
Both of the previous two depend upon
test_nacl.js
, which contains the actual test script. -
benchmark.html
andbenchmark.js
are trivial speed measurements for running in the browser.
Follow the instructions from the Emscripten tutorial to get Emscripten ready to run.
Once emcc
is on your $PATH
somewhere, use the js-nacl
Makefile.
To rebuild everything:
make veryclean all
This will completely remove any compilation products, and recompile everything.
Other Makefile targets:
-
make clean
: removes generated Javascript, but does not remove the unpacked and pre-processednacl
tarball contents. -
make veryclean
: asmake clean
, but also removes thesubnacl
directory and the contents of thenacl
tarball. -
make
ormake all
: performs all the build steps.
If you for some reason need to use a different python than python
,
set the PYTHON
makefile variable; for example,
make all PYTHON=python2.7
Similarly, set EMCC
to the path to your emcc
binary if it's not on
your $PATH
.
The build products will be in
-
node_raw.js
: output from Emscripten -
lib/*
: Javascript for use in the browser and in node.js -
subnacl/*
: Unpackednacl
tarball, after processing byimport.py