"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const chai_1 = require("chai");
const peertube_crypto_1 = require("../../helpers/peertube-crypto");
describe('Encrypt/Descrypt', function () {
    it('Should encrypt and decrypt the string', function () {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const secret = 'my_secret';
            const str = 'my super string';
            const encrypted = yield (0, peertube_crypto_1.encrypt)(str, secret);
            const decrypted = yield (0, peertube_crypto_1.decrypt)(encrypted, secret);
            (0, chai_1.expect)(str).to.equal(decrypted);
        });
    });
    it('Should not decrypt without the same secret', function () {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const str = 'my super string';
            const encrypted = yield (0, peertube_crypto_1.encrypt)(str, 'my_secret');
            let error = false;
            try {
                yield (0, peertube_crypto_1.decrypt)(encrypted, 'my_sicret');
            }
            catch (err) {
                error = true;
            }
            (0, chai_1.expect)(error).to.be.true;
        });
    });
});
//# sourceMappingURL=crypto.js.map