system-secured-storage
Version:
A Node.js project that allows users to store encrypted key-value data locally on their system. This project serves as an alternate storage solution to SQLite but with enhanced security features, leveraging AES encryption to ensure the confidentiality and
24 lines • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const globals_1 = require("@jest/globals");
const encryption_service_1 = require("../services/encryption.service");
(0, globals_1.describe)('Encryption service', () => {
let encryptionService;
const TESTING_DATA = 'Testing text !@#$%^&*()_+';
let encryptedData;
(0, globals_1.beforeAll)(() => {
encryptionService = new encryption_service_1.EncryptionService('de746182415c1a57acaa6e53b6eeb66be0c4d13cb6206d6a1dabf29422fe5581', 'a5cf58ee1df1343334a5ec799c237256');
});
(0, globals_1.it)('Should encrypt passed argument to encrypted hex value.', () => {
encryptedData = encryptionService.encrypt(TESTING_DATA);
const isHexadecimal = /^[a-fA-F0-9]+$/.test(encryptedData);
(0, globals_1.expect)(encryptedData).toBeDefined();
(0, globals_1.expect)(isHexadecimal).toBe(true);
});
(0, globals_1.it)('Should decrypt the encrypted test data to its original form.', () => {
const decryptedData = encryptionService.decrypt(encryptedData);
(0, globals_1.expect)(decryptedData).toBeDefined();
(0, globals_1.expect)(decryptedData).toEqual(TESTING_DATA);
});
});
//# sourceMappingURL=encryption.service.test.js.map