diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-07-21 15:04:27 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-07-21 15:04:27 +0100 |
commit | 411109d8930fca33fc491c62ec6d136e23a86cb6 (patch) | |
tree | 5dd01feb89ca8f94be4ee066dfcc31db19cba2a8 /javascript/README.md | |
parent | 5a60e543a5a1729833f61fb696d2374557788db5 (diff) |
Add package.json for adding olm to npm
Diffstat (limited to 'javascript/README.md')
-rw-r--r-- | javascript/README.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/javascript/README.md b/javascript/README.md new file mode 100644 index 0000000..5c2c96b --- /dev/null +++ b/javascript/README.md @@ -0,0 +1,25 @@ +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); |