Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnotmitt committed Jun 27, 2019
1 parent 4c27a46 commit c46928a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/operations/PGPDecryptAndVerify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class PGPDecryptAndVerify extends Operation {
text += "\n";
}
text += [
`PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`,
`PGP key ID: ${km.get_pgp_short_key_id()}`,
`PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`,
`Signed on ${new Date(ds.sig.when_generated() * 1000).toUTCString()}`,
"----------------------------------\n"
].join("\n");
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/PGPVerify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class PGPVerify extends Operation {
text += "\n";
}
text += [
`PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`,
`PGP key ID: ${km.get_pgp_short_key_id()}`,
`PGP fingerprint: ${km.get_pgp_fingerprint().toString("hex")}`,
`Signed on ${new Date(ds.sig.when_generated() * 1000).toUTCString()}`,
"----------------------------------\n"
].join("\n");
Expand Down
29 changes: 28 additions & 1 deletion tests/operations/tests/PGP.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ IOE1W/Zqmqzq+4frwnzWwYv9/U1RwIs/qlFVnzliREOzW+om8EncSSd7fQ==
=fEAT
-----END PGP MESSAGE-----
`,
expectedOutput: `Signed by PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485
expectedOutput: `Signed by PGP key ID: DF98E485
PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485
Signed on Tue, 29 May 2018 15:44:52 GMT
----------------------------------
${UTF8_TEXT}`,
Expand Down Expand Up @@ -282,4 +283,30 @@ H2qMY1O7hezH3fp+EZzCAccJMtK7VPk13WAgMRH22HirG4aK1i75IVOtjBgObzDh
}
]
},
{
name: "PGP Verify: ASCII, Alice",
input: `-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-----BEGIN PGP SIGNATURE-----
iLMEAQEIAB0WIQRLbJy6MLpYOr9qojE+2VNAUiMLOgUCXRTsvwAKCRA+2VNAUiML
OuaHBADMMNtsuN92Fb+UrDimsv6TDQpbJhDkwp9kZdKYP5HAmSYAhXBG7N+YCMw+
v2FSpUu9jJiPBm1K1SEwLufQVexoRv6RsBNolRFB07sArau0s0DnIXUchCZWvyTP
1KsjBnDr84U2b11H58g4DlTT4gQrz30rFuHz9AGmPAtDHbSXIA==
=vnk/
-----END PGP SIGNATURE-----`,
expectedOutput: `Signed by PGP key ID: DF98E485
PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485
Signed on Thu, 27 Jun 2019 16:20:15 GMT
----------------------------------
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.`,
recipeConfig: [
{
"op": "PGP Verify",
"args": [ALICE_PUBLIC]
}
]
}
]);

0 comments on commit c46928a

Please sign in to comment.