File: README.md

package info (click to toggle)
olm 2.2.2%2Bgit20170526.0fd768e%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,040 kB
  • ctags: 1,713
  • sloc: ansic: 10,149; cpp: 7,345; java: 2,540; objc: 1,341; python: 1,205; makefile: 236; sh: 160; xml: 10; asm: 7
file content (42 lines) | stat: -rw-r--r-- 1,278 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);