0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00
verdaccio/packages/utils/test/crypto-utils.spec.ts

15 lines
431 B
TypeScript
Raw Normal View History

2020-03-08 09:19:12 +01:00
import {aesDecrypt, aesEncrypt, convertPayloadToBase64} from '../src';
2020-03-03 23:59:19 +01:00
describe('test crypto utils', () => {
describe('default encryption', () => {
test('decrypt payload flow', () => {
const payload = 'juan';
const token = aesEncrypt(Buffer.from(payload), '12345').toString('base64');
const data = aesDecrypt(convertPayloadToBase64(token), '12345').toString('utf8');
expect(payload).toEqual(data);
});
});
});