diff options
author | Saúl Ibarra Corretgé <s@saghul.net> | 2020-09-23 10:13:46 +0200 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2020-09-23 15:27:55 -0400 |
commit | 2ef1f6f4fc5bdc069483a527ab3a1b060c71fcad (patch) | |
tree | 40a3a0833442a59edc18378cc2aa0886eaa44b1a /javascript/test/sas.spec.js | |
parent | 4bae4134eb115859038de4e8eab11b22baf80b0c (diff) |
SAS: add olm_sas_is_their_key_set
Also make olm_sas_generate_bytes fail if their key wasn't set.
Diffstat (limited to 'javascript/test/sas.spec.js')
-rw-r--r-- | javascript/test/sas.spec.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/javascript/test/sas.spec.js b/javascript/test/sas.spec.js index af7ea65..4ab4120 100644 --- a/javascript/test/sas.spec.js +++ b/javascript/test/sas.spec.js @@ -50,4 +50,13 @@ describe("sas", function() { bob.set_their_key(alice.get_pubkey()); expect(alice.calculate_mac("test", "MAC").toString()).toEqual(bob.calculate_mac("test", "MAC").toString()); }); + + it('should fail to generate bytes if their key is not set', function () { + expect(alice.is_their_key_set()).toBeFalsy(); + expect(() => { + alice.generate_bytes("SAS", 5); + }).toThrow(); + alice.set_their_key(bob.get_pubkey()); + expect(alice.is_their_key_set()).toBeTruthy(); + }); }); |