Crypton is a framework for creating zero-knowledge applications with JavaScript.
Zero Knowledge applications offer meaningful privacy assurance to end users because the servers running the application cannot read the data created and stored by the application.
To learn more, check out the Crypton website.
Install Redis
TBD
TBD
These installation instructions were run on a system running OS X El Capitan
(version 10.11) and all dependencies were installed using the latest software versions available from Homebrew at the time this was written (10/2015). These instructions assume you have git
and homebrew
already installed.
brew install redis
After installation follow the instructions to copy the launchd
plist file and setup Redis to launch at boot time.
Install PostgreSQL Database using Homebrew
brew install postgresql
After installation follow the instructions to copy the launchd
plist file and launch PostgreSQL at boot time.
createuser
is installed as part of the postgresql
install.
createuser -s -r postgres
Install the Node.js Version Manager and Node.js
See the nvm website for detailed installation instructions. Crypton currently expects Node.js version 0.12.x
to be installed (which is no longer the current stable version).
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash
nvm install 0.12.7
Verify your node
installation:
$ which node
~/.nvm/versions/node/v0.12.7/bin/node
$ which npm
~/.nvm/versions/node/v0.12.7/bin/npm
git clone https://github.com/SpiderOak/crypton.git
cd crypton
nvm use
Important : If you are using nvm
enable the use of the correct Node.js version after you enter the crypton directory by typing nvm use
which will reference the .nvmrc
file which is already present in the root of the repository. This will setup the correct version of node
and npm
.
You need to do this every time you cd
into the crypton dir in every terminal shell you open.
./check_dependencies.sh
If the output is OK then continue.
cd crypton/client
npm install -g karma-cli
npm install
./compile.sh --once
compile.sh
will place a crypton.js
file in the crypton/client/dist/
directory, this is the Javscript file you'll use in your client applications.
The db:init
command creates a crypton_test_user
DB user, crypton_test
database, and the appropriate DB schema in PostgreSQL.
cd crypton/server
npm install
npm link
crypton-server db:init
Mocha + PhantomJS Tests
cd crypton/client
make test
Mocha + Browser Tests
You may first want to edit crypton/client/karma.conf.js
to specify which (or all) of Chrome, Firefox, and Safari to test. When you run karma
it will launch all of the selected browsers and run the tests in each.
cd crypton/client
karma start --single-run
Mocha Tests
cd crypton/server
make test
The default server configurations can be found in crypton/server/config/config.test.json
.
crypton-server run
Use Control-c
to exit.
The default server configurations can be found in crypton/server/config/config.test.json
.
crypton-server start
crypton-server status
crypton-server tail
crypton-server stop
The full set of commands can be seen with crypton-server -h
$ crypton-server -h
Usage: crypton-server [options] [command]
Commands:
run Run the server
db:init Initialize the database
db:drop Drop the database
status Print the status of the daemonized server
start Daemonize the server
stop Stop the daemonized server
restart Restart the daemonized server
logs Print the latest server logs
tail Tail the server logs to STDOUT
cleanlogs Remove the server logs
Options:
-h, --help output usage information
-V, --version output the version number
-c, --config [file] Specify a custom configuration file [default config]
-d, --docker Enable Docker mode to use environment variables instead of a config file [default false]
Verify the server is running with curl
or a browser. You may need to use --insecure
mode which skips self-signed TLS certificate checks. Crypton ships with a self-signed certificate for testing purposes only. You will definitely want to use your own real TLS certificates!
curl --insecure -i https://localhost:1025
cd client/examples/items
crypton-server run
Open your browser to the URL https://localhost:1025/ and register a new account via the form. Since the server uses a self-signed certificate by default you may need to instruct your browser to accept and trust this localhost
only certificate. You can find the instructions for Safari here.
Once you are registered and logged in, open the JS console in your browser. See the original version of these instructions here. The following is just a quick smoke-test that things are working as expected. You should continue to the Crypton docs for more info and examples.
This creates an empty Item called 'myitem'
app.session.getOrCreateItem('myitem', function callback(err, item) {console.log(arguments)});
Add values to this Item. This will save the item immediately, no callback required.
app.session.items.myitem.value = {foo: 1, bar: 2};