hscrypt
Version:
Encrypt Javascript bundles (at build time), inject+decrypt them into pages later (in the browser)
17 lines • 619 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const encrypt_1 = require("../src/encrypt");
const hscrypt_1 = require("../src/hscrypt");
test('encryption/decryption round-trip', () => {
const source = `var abc = 123;
var def = "😎"
function abcdef() {
return abc + def
}`;
const pswd = 'my-password';
const iterations = 1000;
const encrypted = (0, encrypt_1.encrypt)({ source, pswd, iterations, });
const decrypted = (0, hscrypt_1._decrypt)({ encrypted, pswd, iterations, });
expect(decrypted.source).toBe(source);
});
//# sourceMappingURL=hscrypt.test.js.map