diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-12-18 14:44:53 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-12-18 16:21:46 +0100 |
commit | 7a6701001a9408a8eae6faedc91b5d2c42611c5c (patch) | |
tree | 21c0080676d791996043ddc133e0fa96879c144e /guide | |
parent | 1e19e63f9a717df2c3dbb50b18665844e64cef9a (diff) |
openpgp: Make type aliases for keys pub(crate).
- They can still be used as a convenience, but the documentation
will refer to them as their expanded counterparts.
- This makes the structure of they Key<_, _> type more visible.
Diffstat (limited to 'guide')
-rw-r--r-- | guide/src/chapter_01.md | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md index 932f2dc8..b4a4ccab 100644 --- a/guide/src/chapter_01.md +++ b/guide/src/chapter_01.md @@ -51,9 +51,8 @@ fn main() { # fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::Cert) # -> openpgp::Result<()> { # // Get the keypair to do the signing from the Cert. -# let key : key::UnspecifiedSecret -# = tsk.keys_valid().for_signing().nth(0).unwrap().2.clone().try_into()?; -# let keypair = key.into_keypair()?; +# let keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 +# .clone().mark_parts_secret().unwrap().into_keypair()?; # # // Start streaming an OpenPGP message. # let message = Message::new(sink); @@ -197,9 +196,8 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::Cert) # -> openpgp::Result<()> { # // Get the keypair to do the signing from the Cert. -# let key : key::UnspecifiedSecret -# = tsk.keys_valid().for_signing().nth(0).unwrap().2.clone().try_into()?; -# let keypair = key.into_keypair()?; +# let keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 +# .clone().mark_parts_secret().unwrap().into_keypair()?; # # // Start streaming an OpenPGP message. # let message = Message::new(sink); @@ -343,9 +341,8 @@ implements [`io::Write`], and we simply write the plaintext to it. fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::Cert) -> openpgp::Result<()> { // Get the keypair to do the signing from the Cert. - let key : key::UnspecifiedSecret - = tsk.keys_valid().for_signing().nth(0).unwrap().2.clone().try_into()?; - let keypair = key.into_keypair()?; + let keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 + .clone().mark_parts_secret().unwrap().into_keypair()?; // Start streaming an OpenPGP message. let message = Message::new(sink); @@ -500,9 +497,8 @@ Verified data can be read from this using [`io::Read`]. # fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::Cert) # -> openpgp::Result<()> { # // Get the keypair to do the signing from the Cert. -# let key : key::UnspecifiedSecret -# = tsk.keys_valid().for_signing().nth(0).unwrap().2.clone().try_into()?; -# let keypair = key.into_keypair()?; +# let keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 +# .clone().mark_parts_secret().unwrap().into_keypair()?; # # // Start streaming an OpenPGP message. # let message = Message::new(sink); |