Don't repeatedly decrypt the same key in unit tests
This commit is contained in:
parent
253e1c572b
commit
f0633f00ea
|
@ -817,9 +817,13 @@ describe('OpenPGP.js public api tests', function() {
|
||||||
describe('encryptSessionKey, decryptSessionKeys', function() {
|
describe('encryptSessionKey, decryptSessionKeys', function() {
|
||||||
const sk = new Uint8Array([0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01]);
|
const sk = new Uint8Array([0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01]);
|
||||||
|
|
||||||
|
let decryptedPrivateKey;
|
||||||
beforeEach(async function() {
|
beforeEach(async function() {
|
||||||
|
if (!decryptedPrivateKey) {
|
||||||
expect(await privateKey.keys[0].decrypt(passphrase)).to.be.true;
|
expect(await privateKey.keys[0].decrypt(passphrase)).to.be.true;
|
||||||
return true;
|
decryptedPrivateKey = privateKey;
|
||||||
|
}
|
||||||
|
privateKey = decryptedPrivateKey;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should encrypt with public key', function() {
|
it('should encrypt with public key', function() {
|
||||||
|
@ -981,9 +985,13 @@ describe('OpenPGP.js public api tests', function() {
|
||||||
'=6XMW\r\n' +
|
'=6XMW\r\n' +
|
||||||
'-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n';
|
'-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n';
|
||||||
|
|
||||||
beforeEach(async function () {
|
let decryptedPrivateKey;
|
||||||
|
beforeEach(async function() {
|
||||||
|
if (!decryptedPrivateKey) {
|
||||||
expect(await privateKey.keys[0].decrypt(passphrase)).to.be.true;
|
expect(await privateKey.keys[0].decrypt(passphrase)).to.be.true;
|
||||||
return true;
|
decryptedPrivateKey = privateKey;
|
||||||
|
}
|
||||||
|
privateKey = decryptedPrivateKey;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should encrypt then decrypt', function () {
|
it('should encrypt then decrypt', function () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user