npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

axolotl

v1.3.0

Published

An indepedent JavaScript implementation of Axolotl. Axolotl is a ratcheting forward secrecy protocol.

Downloads

28

Readme

Build Status

This project is an independent implementation of Axolotl in JavaScript. It is not endorsed by Open Whisper Systems.

Axolotl is a ratcheting forward secrecy protocol that works in synchronous and asynchronous messaging environments. The protocol overview is available here, and the details of the TextSecure wire format are available here.

Currently this implementation only supports version 3 of the protocol.

WARNING: This implementation has not yet been independently audited. That means you should probably not use it.

Installation

Node.js

Install using npm:

$ npm install axolotl

and import using "axolotl":

var axolotl = require("axolotl");

Browser

Install using bower:

$ bower install axolotl

and import using AMD:

require(["axolotl"], function(axolotl) {

});

or without:

window.axolotl(...)

Getting started

Dependencies

libaxolotl-javascript depends on traceur-runtime and protobuf.js and cryptographic primitives. These dependencies are not included in the distributed package. If you installed libaxolotl-javascript using npm then there is nothing more you need to do - npm will download these dependencies for you.

If you are using libaxolotl-javascript in the browser, you will have to provide the library's dependencies yourself. If you're using AMD, then simply provide the location of these dependencies in your AMD configuration. Otherwise, include the dependencies on the page before including axolotl.js.

The Store interface

You need to provide an implementation of the Store interface when instantiating Axolotl. This is an object that has the following methods.

Note that all methods may return a Promise if the operation is asynchronous.

getLocalIdentityKeyPair

getLocalIdentityKeyPair() → {KeyPair}

Get the local identity key pair created at install time. A key pair is a JavaScript object containing the keys public and private which correspond to the public and private keys, respectively. These keys are of type ArrayBuffer.

getLocalRegistrationId

getLocalRegistrationId() → {Number}

Get the local registration identifier created at install time.

getLocalSignedPreKeyPair

getLocalSignedPreKeyPair(signedPreKeyId) → {KeyPair}

Get the local signed pre-key pair associated with the signedPreKeyId.

Parameters

Name|Type|Description :---|:---|:---------- signedPreKeyId|Number|The identifier of the signed pre-key.

getLocalPreKeyPair

getLocalPreKeyPair(preKeyId) → {KeyPair}

Get the local pre-key pair associated with the preKeyId.

Parameters

Name|Type|Description :---|:---|:---------- preKeyId|Number|The identifier of the pre-key.

Using Axolotl

Start by instantiating Axolotl:

var axol = axolotl(store);

When your application is first installed, the client will likely need to register with the server. To do this, a number of data needs to be generated:

axol.generateIdentityKeyPair().then(...); // Generate our identity key
axol.generateRegistrationId().then(...); // Generate our registration id
axol.generatePreKeys(0, 100).then(...); // Generate the first set of our pre-keys to send to the server
axol.generateLastResortPreKey().then(...); // Generate our last restore pre-key to send to the server
axol.generateSignedPreKey(identityKeyPair, 1).then(...); // Generate our first signed pre-key to send to the server

Once registered, sending messages is very simple:

var message = convertStringToBytes("Hello bob");
axol.encryptMessage("bob", message).then(function(ciphertext) {
    // Send ciphertext to alice
});

and on the receiving side:

// When receiving a ciphertext, decide what type it is from the container and then decrypt
axol.decryptPreKeyWhisperMessage("alice", ciphertext).then(function(plaintext) {
    console.log(plaintext); // "Hello bob"
});

See Axolotl.js for more detailed API documentation.