diff --git a/test/general/ecc_nist.js b/test/general/ecc_nist.js index 27149763..59cc26e4 100644 --- a/test/general/ecc_nist.js +++ b/test/general/ecc_nist.js @@ -186,7 +186,7 @@ describe('Elliptic Curve Cryptography', function () { var romeo = load_priv_key('romeo'); var msg = openpgp.message.readArmored(data.juliet.message_encrypted); return openpgp.decrypt( - {privateKey: romeo, publicKeys: [juliet], message: msg} + {privateKeys: romeo, publicKeys: [juliet], message: msg} ).then(function (result) { expect(result).to.exist; // trim required because https://github.com/openpgpjs/openpgpjs/issues/311 @@ -206,7 +206,7 @@ describe('Elliptic Curve Cryptography', function () { var romeo = load_pub_key('romeo'); var juliet = load_priv_key('juliet'); return openpgp.decrypt( - {privateKey: juliet, publicKeys: [romeo], message: message} + {privateKeys: juliet, publicKeys: [romeo], message: message} ).then(function (result) { expect(result).to.exist; expect(result.data.trim()).to.equal(data.romeo.message); diff --git a/test/general/key.js b/test/general/key.js index 8c409f12..22a7afd8 100644 --- a/test/general/key.js +++ b/test/general/key.js @@ -1004,7 +1004,7 @@ describe('Key', function() { key = newKey; return openpgp.message.fromText('hello').encrypt([key.key]); }).then(function(msg) { - return msg.message.decrypt(key.key); + return msg.message.decrypt([key.key]); }).catch(function(err) { expect(err.message).to.equal('Private key is not decrypted.'); }); @@ -1258,7 +1258,7 @@ describe('Key', function() { return openpgp.reformatKey(opt).then(function(newKey) { newKey = newKey.key; return openpgp.encrypt({data: 'hello', publicKeys: newKey.toPublic(), privateKeys: newKey, armor: true}).then(function(encrypted) { - return openpgp.decrypt({message: openpgp.message.readArmored(encrypted.data), privateKey: newKey, publicKeys: newKey.toPublic()}).then(function(decrypted) { + return openpgp.decrypt({message: openpgp.message.readArmored(encrypted.data), privateKeys: newKey, publicKeys: newKey.toPublic()}).then(function(decrypted) { expect(decrypted.data).to.equal('hello'); expect(decrypted.signatures[0].valid).to.be.true; }); diff --git a/test/general/openpgp.js b/test/general/openpgp.js index c30ef409..f274bdcf 100644 --- a/test/general/openpgp.js +++ b/test/general/openpgp.js @@ -494,7 +494,7 @@ describe('OpenPGP.js public api tests', function() { publicKeys: publicKey.keys, }; var decOpt = { - privateKey: privateKey.keys[0] + privateKeys: privateKey.keys[0] }; return openpgp.encrypt(encOpt).then(function(encrypted) { decOpt.message = openpgp.message.readArmored(encrypted.data); @@ -541,7 +541,7 @@ describe('OpenPGP.js public api tests', function() { }).then(function(encrypted) { return openpgp.decryptSessionKeys({ message: encrypted.message, - privateKey: privateKey.keys[0] + privateKeys: privateKey.keys[0] }); }).then(function(decrypted) { expect(decrypted[0].data).to.deep.equal(sk); @@ -556,7 +556,7 @@ describe('OpenPGP.js public api tests', function() { }).then(function(encrypted) { return openpgp.decryptSessionKeys({ message: encrypted.message, - password: password1 + passwords: password1 }); }).then(function(decrypted) { expect(decrypted[0].data).to.deep.equal(sk); @@ -572,7 +572,7 @@ describe('OpenPGP.js public api tests', function() { msgAsciiArmored = encrypted.data; return openpgp.decryptSessionKeys({ message: openpgp.message.readArmored(msgAsciiArmored), - privateKey: privateKey.keys[0] + privateKeys: privateKey.keys[0] }); }).then(function(decryptedSessionKeys) { @@ -595,7 +595,7 @@ describe('OpenPGP.js public api tests', function() { msgAsciiArmored = encrypted.data; return openpgp.decryptSessionKeys({ message: openpgp.message.readArmored(msgAsciiArmored), - password: password1 + passwords: password1 }); }).then(function(decryptedSessionKeys) { @@ -616,7 +616,7 @@ describe('OpenPGP.js public api tests', function() { }).then(function(encrypted) { return openpgp.decryptSessionKeys({ message: openpgp.message.readArmored(encrypted.data), - password: password1 + passwords: password1 }); }).then(function(decryptedSessionKeys) { expect(decryptedSessionKeys.length).to.equal(1); @@ -648,7 +648,7 @@ describe('OpenPGP.js public api tests', function() { publicKeys: publicKey.keys, }; var decOpt = { - privateKey: privateKey.keys[0] + privateKeys: privateKey.keys[0] }; return openpgp.encrypt(encOpt).then(function(encrypted) { expect(encrypted.data).to.match(/^-----BEGIN PGP MESSAGE/); @@ -715,7 +715,7 @@ describe('OpenPGP.js public api tests', function() { publicKeys: publicKey.keys }; var decOpt = { - privateKey: privateKey.keys[0] + privateKeys: privateKey.keys[0] }; return openpgp.encrypt(encOpt).then(function(encrypted) { expect(encrypted.data).to.match(/^-----BEGIN PGP MESSAGE/); @@ -733,7 +733,7 @@ describe('OpenPGP.js public api tests', function() { privateKeys: privateKey.keys }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: publicKey.keys }; return openpgp.encrypt(encOpt).then(function(encrypted) { @@ -754,7 +754,7 @@ describe('OpenPGP.js public api tests', function() { privateKeys: privateKey.keys }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: publicKey.keys }; return openpgp.encrypt(encOpt).then(function(encrypted) { @@ -776,7 +776,7 @@ describe('OpenPGP.js public api tests', function() { detached: true }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: publicKey.keys }; return openpgp.encrypt(encOpt).then(function(encrypted) { @@ -805,7 +805,7 @@ describe('OpenPGP.js public api tests', function() { }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: publicKey.keys[0] }; @@ -843,7 +843,7 @@ describe('OpenPGP.js public api tests', function() { }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: [publicKey.keys[0], pubKeyDE] }; @@ -880,7 +880,7 @@ describe('OpenPGP.js public api tests', function() { }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: openpgp.key.readArmored(wrong_pubkey).keys }; @@ -912,7 +912,7 @@ describe('OpenPGP.js public api tests', function() { }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: openpgp.key.readArmored(wrong_pubkey).keys }; @@ -937,7 +937,7 @@ describe('OpenPGP.js public api tests', function() { privateKeys: privateKey.keys }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: openpgp.key.readArmored(wrong_pubkey).keys }; return openpgp.encrypt(encOpt).then(function(encrypted) { @@ -958,7 +958,7 @@ describe('OpenPGP.js public api tests', function() { privateKeys: privateKey.keys }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: openpgp.key.readArmored(wrong_pubkey).keys }; return openpgp.encrypt(encOpt).then(function(encrypted) { @@ -979,7 +979,7 @@ describe('OpenPGP.js public api tests', function() { privateKeys: privateKey.keys }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], }; return openpgp.encrypt(encOpt).then(function(encrypted) { decOpt.message = openpgp.message.readArmored(encrypted.data); @@ -1000,7 +1000,7 @@ describe('OpenPGP.js public api tests', function() { detached: true }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: openpgp.key.readArmored(wrong_pubkey).keys }; return openpgp.encrypt(encOpt).then(function(encrypted) { @@ -1028,7 +1028,7 @@ describe('OpenPGP.js public api tests', function() { }; var decOpt = { - privateKey: privateKey.keys[0], + privateKeys: privateKey.keys[0], publicKeys: [publicKey.keys[0], pubKeyDE] }; @@ -1183,7 +1183,7 @@ describe('OpenPGP.js public api tests', function() { data: plaintext }).then(function(encrypted) { return openpgp.decrypt({ - privateKey: privKeyDE, + privateKeys: privKeyDE, publicKeys: pubKeyDE, message: openpgp.message.readArmored(encrypted.data) }); @@ -1258,7 +1258,7 @@ describe('OpenPGP.js public api tests', function() { privKey.decrypt('1234'); message = openpgp.message.readArmored(pgp_msg); - return openpgp.decrypt({ privateKey:privKey, message:message }).then(function(decrypted) { + return openpgp.decrypt({ privateKeys:privKey, message:message }).then(function(decrypted) { expect(decrypted.data).to.equal('hello 3des\n'); expect(decrypted.signatures.length).to.equal(0); }); @@ -1272,7 +1272,7 @@ describe('OpenPGP.js public api tests', function() { passwords: password1 }; var decOpt = { - password: password1 + passwords: password1 }; return openpgp.encrypt(encOpt).then(function(encrypted) { decOpt.message = openpgp.message.readArmored(encrypted.data); @@ -1289,7 +1289,7 @@ describe('OpenPGP.js public api tests', function() { passwords: [password1, password2] }; var decOpt = { - password: password2 + passwords: password2 }; return openpgp.encrypt(encOpt).then(function(encrypted) { decOpt.message = openpgp.message.readArmored(encrypted.data); @@ -1304,7 +1304,7 @@ describe('OpenPGP.js public api tests', function() { var decOpt = { message: openpgp.message.readArmored(twoPasswordGPGFail), - password: password2 + passwords: password2 }; return openpgp.decrypt(decOpt).then(function(decrypted) { expect(decrypted.data).to.equal(plaintext); @@ -1319,7 +1319,7 @@ describe('OpenPGP.js public api tests', function() { armor: false }; var decOpt = { - password: password1 + passwords: password1 }; return openpgp.encrypt(encOpt).then(function(encrypted) { decOpt.message = encrypted.message; @@ -1338,7 +1338,7 @@ describe('OpenPGP.js public api tests', function() { armor: false }; var decOpt = { - password: password1, + passwords: password1, format: 'binary' }; return openpgp.encrypt(encOpt).then(function(encrypted) { diff --git a/test/general/signature.js b/test/general/signature.js index 9b6be339..9800ef22 100644 --- a/test/general/signature.js +++ b/test/general/signature.js @@ -340,7 +340,7 @@ describe("Signature", function() { var pub_key = openpgp.key.readArmored(pub_key_arm1).keys[0]; var msg = openpgp.message.readArmored(msg_arm1); priv_key.decrypt("abcd"); - return openpgp.decrypt({ privateKey: priv_key, publicKeys:[pub_key], message:msg }).then(function(decrypted) { + return openpgp.decrypt({ privateKeys: priv_key, publicKeys:[pub_key], message:msg }).then(function(decrypted) { expect(decrypted.data).to.exist; expect(decrypted.signatures[0].valid).to.be.true; expect(decrypted.signatures[0].signature.packets.length).to.equal(1); @@ -382,7 +382,7 @@ describe("Signature", function() { var msg = openpgp.message.readArmored(msg_arm1); priv_key_gnupg_ext.subKeys[0].subKey.decrypt("abcd"); - return msg.decrypt(priv_key_gnupg_ext).then(function(msg) { + return msg.decrypt([priv_key_gnupg_ext]).then(function(msg) { return msg.verify([pub_key]).then(verified => { expect(verified).to.exist; expect(verified).to.have.length(1); @@ -466,7 +466,7 @@ describe("Signature", function() { var keyids = esMsg.getEncryptionKeyIds(); privKey.decryptKeyPacket(keyids, 'hello world'); - return openpgp.decrypt({ privateKey: privKey, publicKeys:[pubKey], message:esMsg }).then(function(decrypted) { + return openpgp.decrypt({ privateKeys: privKey, publicKeys:[pubKey], message:esMsg }).then(function(decrypted) { expect(decrypted.data).to.exist; expect(decrypted.data).to.equal(plaintext); expect(decrypted.signatures).to.have.length(1); @@ -502,7 +502,7 @@ describe("Signature", function() { var keyids = esMsg.getEncryptionKeyIds(); privKey.decryptKeyPacket(keyids, 'hello world'); - return openpgp.decrypt({ privateKey: privKey, publicKeys:[pubKey], message:esMsg }).then(function(decrypted) { + return openpgp.decrypt({ privateKeys: privKey, publicKeys:[pubKey], message:esMsg }).then(function(decrypted) { expect(decrypted.data).to.exist; expect(decrypted.data).to.equal(plaintext); expect(decrypted.signatures).to.have.length(1); diff --git a/test/general/x25519.js b/test/general/x25519.js index fc43bad8..da89aa2e 100644 --- a/test/general/x25519.js +++ b/test/general/x25519.js @@ -174,7 +174,7 @@ describe('X25519 Cryptography', function () { expect(night.decrypt(data['night'].pass)).to.be.true; var msg = openpgp.message.readArmored(data['night'].message_encrypted); return openpgp.decrypt( - {privateKey: night, publicKeys: [light], message: msg} + {privateKeys: night, publicKeys: [light], message: msg} ).then(function (result) { expect(result).to.exist; // trim required because https://github.com/openpgpjs/openpgpjs/issues/311 @@ -194,7 +194,7 @@ describe('X25519 Cryptography', function () { var light = load_pub_key('light'); var night = load_priv_key('night'); return openpgp.decrypt( - {privateKey: night, publicKeys: [light], message: message} + {privateKeys: night, publicKeys: [light], message: message} ).then(function (result) { expect(result).to.exist; expect(result.data.trim()).to.equal(data['light'].message); @@ -291,7 +291,7 @@ describe('X25519 Cryptography', function () { // Decrypting and verifying return openpgp.decrypt( { message: msg, - privateKey: bye, + privateKeys: bye, publicKeys: [ hi.toPublic() ] } ).then(output => { expect(output.data).to.equal('Hi, Hi wrote this but only Bye can read it!');