summaryrefslogtreecommitdiffstats
path: root/guide
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-02-19 12:18:01 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-02-19 12:46:58 +0100
commitef396882bc35a97d778e985cd69ebd5181852d8c (patch)
tree6e7945e1394ff82e5a72badc933ddac710c108cc /guide
parent32174f69cd4d94b4f621f3273781d487e97fa031 (diff)
openpgp: Split VerificationResult.
- Split VerificationResult into Result<GoodChecksum, VerificationError>. - Fixes #416.
Diffstat (limited to 'guide')
-rw-r--r--guide/src/chapter_01.md52
1 files changed, 12 insertions, 40 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md
index 0c891aab..75bc6896 100644
--- a/guide/src/chapter_01.md
+++ b/guide/src/chapter_01.md
@@ -126,17 +126,10 @@ fn main() {
# // whether the signature checks out mathematically, we apply
# // our policy.
# match results.into_iter().next() {
-# Some(VerificationResult::GoodChecksum { .. }) =>
+# Some(Ok(_)) =>
# good = true,
-# Some(VerificationResult::NotAlive { .. }) =>
-# return Err(failure::err_msg(
-# "Good, but not alive signature")),
-# Some(VerificationResult::MissingKey { .. }) =>
-# return Err(failure::err_msg(
-# "Missing key to verify signature")),
-# Some(VerificationResult::Error { error, .. }) =>
-# return Err(failure::err_msg(
-# format!("Bad signature: {:?}", error))),
+# Some(Err(e)) =>
+# return Err(openpgp::Error::from(e).into()),
# None =>
# return Err(failure::err_msg("No signature")),
# }
@@ -281,17 +274,10 @@ fn generate() -> openpgp::Result<openpgp::Cert> {
# // whether the signature checks out mathematically, we apply
# // our policy.
# match results.into_iter().next() {
-# Some(VerificationResult::GoodChecksum { .. }) =>
+# Some(Ok(_)) =>
# good = true,
-# Some(VerificationResult::NotAlive { .. }) =>
-# return Err(failure::err_msg(
-# "Good, but not alive signature")),
-# Some(VerificationResult::MissingKey { .. }) =>
-# return Err(failure::err_msg(
-# "Missing key to verify signature")),
-# Some(VerificationResult::Error { error, .. }) =>
-# return Err(failure::err_msg(
-# format!("Bad signature: {:?}", error))),
+# Some(Err(e)) =>
+# return Err(openpgp::Error::from(e).into()),
# None =>
# return Err(failure::err_msg("No signature")),
# }
@@ -436,17 +422,10 @@ fn sign(policy: &dyn Policy,
# // whether the signature checks out mathematically, we apply
# // our policy.
# match results.into_iter().next() {
-# Some(VerificationResult::GoodChecksum { .. }) =>
+# Some(Ok(_)) =>
# good = true,
-# Some(VerificationResult::NotAlive { .. }) =>
-# return Err(failure::err_msg(
-# "Good, but not alive signature")),
-# Some(VerificationResult::MissingKey { .. }) =>
-# return Err(failure::err_msg(
-# "Missing key to verify signature")),
-# Some(VerificationResult::Error { error, .. }) =>
-# return Err(failure::err_msg(
-# format!("Bad signature: {:?}", error))),
+# Some(Err(e)) =>
+# return Err(openpgp::Error::from(e).into()),
# None =>
# return Err(failure::err_msg("No signature")),
# }
@@ -602,17 +581,10 @@ impl<'a> VerificationHelper for Helper<'a> {
// whether the signature checks out mathematically, we apply
// our policy.
match results.into_iter().next() {
- Some(VerificationResult::GoodChecksum { .. }) =>
+ Some(Ok(_)) =>
good = true,
- Some(VerificationResult::NotAlive { .. }) =>
- return Err(failure::err_msg(
- "Good, but not alive signature")),
- Some(VerificationResult::MissingKey { .. }) =>
- return Err(failure::err_msg(
- "Missing key to verify signature")),
- Some(VerificationResult::Error { error, .. }) =>
- return Err(failure::err_msg(
- format!("Bad signature: {:?}", error))),
+ Some(Err(e)) =>
+ return Err(openpgp::Error::from(e).into()),
None =>
return Err(failure::err_msg("No signature")),
}