olm/javascript
2018-07-04 15:24:44 -04:00
..
demo Return the message index when decrypting group messages. 2016-10-20 09:58:55 +01:00
test add functions for pickling/unpickling a decryption object 2018-06-28 17:10:36 -04:00
.gitignore Add some tests for the Javascript wrappers 2016-12-19 09:43:58 +00:00
olm_inbound_group_session.js Implement importing group session data 2017-01-09 17:45:46 +00:00
olm_outbound_group_session.js Avoid buffer overrun on encryption 2016-12-16 14:42:41 +00:00
olm_pk.js add functions for pickling/unpickling a decryption object 2018-06-28 17:10:36 -04:00
olm_post.js add initial implementation of basic private key encryption functionality 2018-06-27 16:38:45 -04:00
olm_pre.js Let apps override emscripten settings 2016-12-14 11:46:12 +00:00
package.json prepare 2.3.0 2018-07-04 15:24:44 -04: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);