diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-05 01:45:06 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-05 01:45:06 +0100 |
commit | 2a8202e74846d191a321cca1202175af9db6107d (patch) | |
tree | a6f455caf07da1186851f343a237a4c4e4484f46 /javascript/README.md | |
parent | 8efa0ec17d8c262f9c3fd7603e8074f74a053708 (diff) |
Diffstat (limited to 'javascript/README.md')
-rw-r--r-- | javascript/README.md | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/javascript/README.md b/javascript/README.md deleted file mode 100644 index bdf0224..0000000 --- a/javascript/README.md +++ /dev/null @@ -1,46 +0,0 @@ -Olm -=== - -Note: before using any of the olm functions, you must call `Olm.init()`, and -wait for the promise to resolve, otherwise you will get errors like: -`Uncaught TypeError: Olm.Account is not a constructor` - -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); |