From 4c6866286b837114c519ccfd6f04175d347e4e84 Mon Sep 17 00:00:00 2001 From: toby Date: Wed, 15 Mar 2017 12:24:56 -0400 Subject: [PATCH] Remove "display message in output" opt in PGP ops --- src/js/config/OperationConfig.js | 15 ------ src/js/operations/PGP.js | 15 +++--- test/tests/operations/PGP.js | 79 +------------------------------- 3 files changed, 8 insertions(+), 101 deletions(-) diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js index 91ab8629..bc443289 100755 --- a/src/js/config/OperationConfig.js +++ b/src/js/config/OperationConfig.js @@ -3223,11 +3223,6 @@ var OperationConfig = { type: "string", value: "", }, - { - name: "Display message in output", - type: "boolean", - value: true, - } ] }, "Sign PGP Detached": { @@ -3264,11 +3259,6 @@ var OperationConfig = { type: "text", value: "", }, - { - name: "Display message in output", - type: "boolean", - value: true, - } ] }, "Sign PGP Cleartext": { @@ -3300,11 +3290,6 @@ var OperationConfig = { type: "text", value: "", }, - { - name: "Display message in output", - type: "boolean", - value: true, - } ] }, "Generate PGP Key Pair": { diff --git a/src/js/operations/PGP.js b/src/js/operations/PGP.js index f141d1ab..f5734e01 100755 --- a/src/js/operations/PGP.js +++ b/src/js/operations/PGP.js @@ -171,8 +171,7 @@ var PGP = { runVerify: function (input, args) { var publicKey = args[0], privateKey = args[1], - password = args[2], - displayDecrypt = args[3]; + password = args[2]; return new Promise(function(resolve, reject) { try { @@ -229,7 +228,7 @@ var PGP = { "Signed by: " + verification.author, "Signed with: ", "\n", - displayDecrypt && verification.verified ? decrypted.data : "", + decrypted.data, ].join("\n")); }) @@ -316,8 +315,7 @@ var PGP = { */ runVerifyDetached: function (input, args) { var publicKey = args[0], - armoredSignature = args[1], - displayDecrypt = args[2]; + armoredSignature = args[1]; return new Promise(function(resolve, reject) { try { @@ -358,7 +356,7 @@ var PGP = { "Signed by: " + verification.author, "Signed with: ", "\n", - displayDecrypt && verification.verified ? input : "", + input, ].join("\n")); }) @@ -419,8 +417,7 @@ var PGP = { * @returns {string} - "true" or "false" depending on the validity of the signature */ runVerifyCleartext: function (input, args) { - var publicKey = args[0], - displayDecrypt = args[1]; + var publicKey = args[0]; return new Promise(function(resolve, reject) { @@ -463,7 +460,7 @@ var PGP = { "Signed by: " + verification.author, "Signed with: ", "\n", - displayDecrypt && verification.verified ? verification.message : "", + verification.message, ].join("\n")); }) .catch(function(err) { diff --git a/test/tests/operations/PGP.js b/test/tests/operations/PGP.js index 02fe857c..9e984e5f 100644 --- a/test/tests/operations/PGP.js +++ b/test/tests/operations/PGP.js @@ -317,47 +317,7 @@ TestRegister.addTests([{ }, { op: "PGP Verify", - args: [alice.pub, bob.sec, bob.password, true], - }, - ], - }]); - }); -}); - -["hello world"].forEach(function(input) { - [ - [PGP_TEST_KEY_PAIRS[0], PGP_TEST_KEY_PAIRS[1]], - [PGP_TEST_KEY_PAIRS[1], PGP_TEST_KEY_PAIRS[0]], - ].forEach(function(pairOfKeyPairs) { - var alice = pairOfKeyPairs[0]; - var bob = pairOfKeyPairs[1]; - - var testName = "PGP Sign ($alice), PGP Verify ($bob) '$input' (message hidden)"; - testName = testName.replace("$alice", alice.name); - testName = testName.replace("$bob", bob.name); - testName = testName.replace("$input", input); - - TestRegister.addTests([{ - name: testName, - input: input, - expectedOutput: [ - "Verified: true", - "Key ID: " + alice.keyID, - "Encrypted for: " + bob.name, - "Signed on: ", - "Signed by: " + alice.name, - "Signed with: ", - "\n", - "", - ].join("\n"), - recipeConfig: [ - { - op: "PGP Sign", - args: [bob.pub, alice.sec, alice.password], - }, - { - op: "PGP Verify", - args: [alice.pub, bob.sec, bob.password, false], + args: [alice.pub, bob.sec, bob.password], }, ], }]); @@ -391,42 +351,7 @@ TestRegister.addTests([{ }, { op: "Verify PGP Cleartext", - args: [keyPair.pub, true], - }, - ], - }; - }) - ); -}); - -["", "hello world"].forEach(function(input) { - TestRegister.addTests( - PGP_TEST_KEY_PAIRS.map(function(keyPair) { - var testName = "Sign Sign Cleartext, Verify PGP Cleartext ($pw, $ks) '$input' (message hidden)"; - testName = testName.replace("$ks", keyPair.size); - testName = testName.replace("$pw", keyPair.password ? "pw" : "no pw"); - testName = testName.replace("$input", input); - - return { - name: testName, - input: input, - expectedOutput: [ - "Verified: true", - "Key ID: " + keyPair.keyID, - "Signed on: ", - "Signed by: " + keyPair.name, - "Signed with: ", - "\n", - "", - ].join("\n"), - recipeConfig: [ - { - op: "Sign PGP Cleartext", - args: [keyPair.sec, keyPair.password], - }, - { - op: "Verify PGP Cleartext", - args: [keyPair.pub, false], + args: [keyPair.pub], }, ], };