actual/packages/loot-core/src/server/encryption.test.js

20 lines
500 B
JavaScript
Raw Normal View History

2022-04-29 02:44:38 +00:00
import encryption from './encryption';
afterEach(() => encryption.unloadAllKeys());
describe('Encryption', () => {
test('should encrypt and decrypt', async () => {
let key = await encryption.createKey({
id: 'foo',
password: 'mypassword',
salt: 'salt'
});
await encryption.loadKey(key);
let data = await encryption.encrypt('hello', 'foo');
let output = await encryption.decrypt(data.value, data.meta);
expect(output.toString()).toBe('hello');
});
});