diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-05-07 14:16:08 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-05-07 14:26:30 +0200 |
commit | 50b3ed9a61161761f20d134b13c2f8ac07698ea5 (patch) | |
tree | d6d3c6e57acd182ec51832e89d79ebce6b496b20 /guide/src | |
parent | a207220e5a9864b8a205c7e75eee8ea37bdb8c5a (diff) |
openpgp: Use a builder to construct Verifier.
- See #498.
Diffstat (limited to 'guide/src')
-rw-r--r-- | guide/src/chapter_01.md | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md index 0aa5dbf9..3d2af662 100644 --- a/guide/src/chapter_01.md +++ b/guide/src/chapter_01.md @@ -16,7 +16,7 @@ extern crate sequoia_openpgp as openpgp; use openpgp::cert::prelude::*; use openpgp::serialize::stream::*; use openpgp::packet::prelude::*; -use openpgp::parse::stream::*; +use openpgp::parse::{Parse, stream::*}; use openpgp::policy::Policy; use openpgp::policy::StandardPolicy as P; @@ -92,7 +92,8 @@ fn main() { # }; # # // Now, create a verifier with a helper using the given Certs. -# let mut verifier = Verifier::from_bytes(policy, signed_message, helper, None)?; +# let mut verifier = VerifierBuilder::from_bytes(signed_message)? +# .with_policy(policy, None, helper)?; # # // Verify the data. # io::copy(&mut verifier, sink)?; @@ -164,7 +165,7 @@ create it: # use openpgp::cert::prelude::*; # use openpgp::serialize::stream::*; # use openpgp::packet::prelude::*; -# use openpgp::parse::stream::*; +# use openpgp::parse::{Parse, stream::*}; # use openpgp::policy::Policy; # use openpgp::policy::StandardPolicy as P; # @@ -240,7 +241,8 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # }; # # // Now, create a verifier with a helper using the given Certs. -# let mut verifier = Verifier::from_bytes(policy, signed_message, helper, None)?; +# let mut verifier = VerifierBuilder::from_bytes(signed_message)? +# .with_policy(policy, None, helper)?; # # // Verify the data. # io::copy(&mut verifier, sink)?; @@ -312,7 +314,7 @@ implements [`io::Write`], and we simply write the plaintext to it. # use openpgp::cert::prelude::*; # use openpgp::serialize::stream::*; # use openpgp::packet::prelude::*; -# use openpgp::parse::stream::*; +# use openpgp::parse::{Parse, stream::*}; # use openpgp::policy::Policy; # use openpgp::policy::StandardPolicy as P; # @@ -388,7 +390,8 @@ fn sign(policy: &dyn Policy, # }; # # // Now, create a verifier with a helper using the given Certs. -# let mut verifier = Verifier::from_bytes(policy, signed_message, helper, None)?; +# let mut verifier = VerifierBuilder::from_bytes(signed_message)? +# .with_policy(policy, None, helper)?; # # // Verify the data. # io::copy(&mut verifier, sink)?; @@ -471,7 +474,7 @@ Verified data can be read from this using [`io::Read`]. # use openpgp::cert::prelude::*; # use openpgp::serialize::stream::*; # use openpgp::packet::prelude::*; -# use openpgp::parse::stream::*; +# use openpgp::parse::{Parse, stream::*}; # use openpgp::policy::Policy; # use openpgp::policy::StandardPolicy as P; # @@ -547,7 +550,8 @@ fn verify(policy: &dyn Policy, }; // Now, create a verifier with a helper using the given Certs. - let mut verifier = Verifier::from_bytes(policy, signed_message, helper, None)?; + let mut verifier = VerifierBuilder::from_bytes(signed_message)? + .with_policy(policy, None, helper)?; // Verify the data. io::copy(&mut verifier, sink)?; |