0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/packages/auth/test/crypto-utils.spec.ts
2021-04-09 17:54:01 +02:00

14 lines
441 B
TypeScript

import {aesDecrypt, aesEncrypt, convertPayloadToBase64} from "@verdaccio/utils";
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);
});
});
});