forked from mozilla/send
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeychain-tests.js
More file actions
28 lines (26 loc) · 853 Bytes
/
keychain-tests.js
File metadata and controls
28 lines (26 loc) · 853 Bytes
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
import assert from 'assert';
import Keychain from '../../../app/keychain';
describe('Keychain', function() {
describe('setPassword', function() {
it('changes the authKey', async function() {
const k = new Keychain();
const original = await k.authKeyB64();
k.setPassword('foo', 'some://url');
const pwd = await k.authKeyB64();
assert.notEqual(pwd, original);
});
});
describe('encrypt / decrypt metadata', function() {
it('can decrypt metadata it encrypts', async function() {
const k = new Keychain();
const meta = {
name: 'foo',
type: 'bar/baz'
};
const ciphertext = await k.encryptMetadata(meta);
const result = await k.decryptMetadata(ciphertext);
assert.equal(result.name, meta.name);
assert.equal(result.type, meta.type);
});
});
});