olm/javascript
David Baker 0346145a81 Work with PkDecryption keys by their private keys
Change interface to allow the app to get the private part of the
key and instantiate a decryption object from just the private part
of the key.

Changes the function generating a key from random bytes to be
initialising a key with a private key (because it's exactly the
same thing). Exports & imports private key parts as ArrayBuffer at
JS level rather than base64 assuming we are moving that way in
general.
2018-10-02 12:02:56 +01:00
..
demo Return the message index when decrypting group messages. 2016-10-20 09:58:55 +01:00
test Work with PkDecryption keys by their private keys 2018-10-02 12:02:56 +01:00
.gitignore WebAssembly support! 2018-09-21 16:01:51 +01:00
externs.js Another day, another interface 2018-09-25 17:13:29 +01:00
olm_inbound_group_session.js WebAssembly support! 2018-09-21 16:01:51 +01:00
olm_outbound_group_session.js WebAssembly support! 2018-09-21 16:01:51 +01:00
olm_pk.js Work with PkDecryption keys by their private keys 2018-10-02 12:02:56 +01:00
olm_post.js Another day, another interface 2018-09-25 17:13:29 +01:00
olm_pre.js Another day, another interface 2018-09-25 17:13:29 +01:00
olm_prefix.js Another day, another interface 2018-09-25 17:13:29 +01:00
olm_suffix.js Support passing olm options into init() 2018-09-26 16:38:39 +01:00
package.json Also ship the wasm file 2018-09-21 16:39:04 +01:00
README.md Javascript bindings for group sessions 2016-05-25 17:48:01 +01:00

Olm

Example:

var alice = new Olm.Account();
var bob = new Olm.Account();
alice.create();
bob.create();
bob.generate_one_time_keys(1);

var bobs_id_keys = JSON.parse(bob.identity_keys());
var bobs_id_key = bobs_id_keys.curve25519;
var bobs_ot_keys = JSON.parse(bob.one_time_keys());
for (key in bobs_ot_keys.curve25519) {
    var bobs_ot_key = bobs_ot_keys.curve25519[key];
}

alice_session = new Olm.Session();
alice_session.create_outbound(alice, bobs_id_key, bobs_ot_key);
alice_message = a_session.encrypt("Hello");

bob_session.create_inbound(bob, bob_message);
var plaintext = bob_session.decrypt(message_1.type, bob_message);
bob.remove_one_time_keys(bob_session);

Group chat:

var outbound_session = new Olm.OutboundGroupSession();
outbound_session.create();

// exchange these over a secure channel
var session_id = group_session.session_id();
var session_key = group_session.session_key();
var message_index = group_session.message_index();

var inbound_session = new Olm.InboundGroupSession();
inbound_session.create(message_index, session_key);

var ciphertext = outbound_session.encrypt("Hello");
var plaintext = inbound_session.decrypt(ciphertext);