Hemmelig.app/tests/server/helpers/crypto.test.js
bjarneo 0c86efd56c
refactor: use fastify vite for the dev server (#284)
* refactor: use fastify vite for the server

by doing this we do not need to have local hacks for the routes. No local proxy needed. Everything just works.

* fix: update the dockerfile build path

* fix: update package.json

* fix: fonts path
2024-03-11 13:43:20 +01:00

19 lines
521 B
JavaScript

import assert from 'assert';
import { decrypt, encrypt, generateKey } from '../../../shared/helpers/crypto.js';
const SECRET = 'MASTER_KEY=1337-super-secret';
const RANDOM_KEY = generateKey();
describe('Crypto', () => {
describe('#encrypt(string)', () => {
it('should encrypt, and decrypt a secret', async () => {
const encrypted = encrypt(SECRET, RANDOM_KEY);
const decrypted = decrypt(encrypted, RANDOM_KEY);
assert.equal(decrypted, SECRET);
});
});
});