Remove "display message in output" opt in PGP ops

This commit is contained in:
toby 2017-03-15 12:24:56 -04:00
parent 56154a7987
commit 4c6866286b
3 changed files with 8 additions and 101 deletions

View file

@ -3223,11 +3223,6 @@ var OperationConfig = {
type: "string", type: "string",
value: "", value: "",
}, },
{
name: "Display message in output",
type: "boolean",
value: true,
}
] ]
}, },
"Sign PGP Detached": { "Sign PGP Detached": {
@ -3264,11 +3259,6 @@ var OperationConfig = {
type: "text", type: "text",
value: "", value: "",
}, },
{
name: "Display message in output",
type: "boolean",
value: true,
}
] ]
}, },
"Sign PGP Cleartext": { "Sign PGP Cleartext": {
@ -3300,11 +3290,6 @@ var OperationConfig = {
type: "text", type: "text",
value: "", value: "",
}, },
{
name: "Display message in output",
type: "boolean",
value: true,
}
] ]
}, },
"Generate PGP Key Pair": { "Generate PGP Key Pair": {

View file

@ -171,8 +171,7 @@ var PGP = {
runVerify: function (input, args) { runVerify: function (input, args) {
var publicKey = args[0], var publicKey = args[0],
privateKey = args[1], privateKey = args[1],
password = args[2], password = args[2];
displayDecrypt = args[3];
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
try { try {
@ -229,7 +228,7 @@ var PGP = {
"Signed by: " + verification.author, "Signed by: " + verification.author,
"Signed with: ", "Signed with: ",
"\n", "\n",
displayDecrypt && verification.verified ? decrypted.data : "", decrypted.data,
].join("\n")); ].join("\n"));
}) })
@ -316,8 +315,7 @@ var PGP = {
*/ */
runVerifyDetached: function (input, args) { runVerifyDetached: function (input, args) {
var publicKey = args[0], var publicKey = args[0],
armoredSignature = args[1], armoredSignature = args[1];
displayDecrypt = args[2];
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
try { try {
@ -358,7 +356,7 @@ var PGP = {
"Signed by: " + verification.author, "Signed by: " + verification.author,
"Signed with: ", "Signed with: ",
"\n", "\n",
displayDecrypt && verification.verified ? input : "", input,
].join("\n")); ].join("\n"));
}) })
@ -419,8 +417,7 @@ var PGP = {
* @returns {string} - "true" or "false" depending on the validity of the signature * @returns {string} - "true" or "false" depending on the validity of the signature
*/ */
runVerifyCleartext: function (input, args) { runVerifyCleartext: function (input, args) {
var publicKey = args[0], var publicKey = args[0];
displayDecrypt = args[1];
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
@ -463,7 +460,7 @@ var PGP = {
"Signed by: " + verification.author, "Signed by: " + verification.author,
"Signed with: ", "Signed with: ",
"\n", "\n",
displayDecrypt && verification.verified ? verification.message : "", verification.message,
].join("\n")); ].join("\n"));
}) })
.catch(function(err) { .catch(function(err) {

View file

@ -317,47 +317,7 @@ TestRegister.addTests([{
}, },
{ {
op: "PGP Verify", op: "PGP Verify",
args: [alice.pub, bob.sec, bob.password, true], args: [alice.pub, bob.sec, bob.password],
},
],
}]);
});
});
["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],
}, },
], ],
}]); }]);
@ -391,42 +351,7 @@ TestRegister.addTests([{
}, },
{ {
op: "Verify PGP Cleartext", op: "Verify PGP Cleartext",
args: [keyPair.pub, true], args: [keyPair.pub],
},
],
};
})
);
});
["", "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],
}, },
], ],
}; };