UNPKG

chaingate

Version:

A complete TypeScript library for connecting to and making transactions on different blockchains

17 lines 849 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Encrypted_1 = require("../Encrypted"); const TestUtils_1 = require("../../../../Utils/TestUtils"); (0, TestUtils_1.setupCryptoGetRandomValuesMock)(); describe('Legacy Keystore', () => { it('Encrypt data', async () => { const dataToEncrypt = new Uint8Array([0x00, 0x01, 0x02]); const encrypted = await Encrypted_1.Encrypted.encrypt(dataToEncrypt, '1234'); await expect(async () => { await Encrypted_1.Encrypted.decrypt(encrypted, 'Incorrect password'); }).rejects.toThrow(Encrypted_1.IncorrectPassword); const decrypted = await Encrypted_1.Encrypted.decrypt(encrypted, '1234'); expect(JSON.stringify(decrypted)).toBe(JSON.stringify(dataToEncrypt)); }); }); //# sourceMappingURL=Encrypted.test.js.map