diff options
author | Neal H. Walfield <neal@pep.foundation> | 2019-12-19 21:47:19 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2019-12-19 21:51:19 +0100 |
commit | b3ba97146f534ac5cf67db7f72d8a633112d0a18 (patch) | |
tree | 581c64936f0a857dd1f0fbf75c7a4ddf243d8656 /guide | |
parent | 2b2b5c8905d0e823d03b5ba2a115298e80e08b74 (diff) |
openpgp: Change KeyIter to return a struct instead of a tuple.
- A tuple is just an unnamed, inflexible struct. Use a struct
instead.
- Fixes #400.
Diffstat (limited to 'guide')
-rw-r--r-- | guide/src/chapter_01.md | 16 | ||||
-rw-r--r-- | guide/src/chapter_02.md | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md index b4a4ccab..6368a9eb 100644 --- a/guide/src/chapter_01.md +++ b/guide/src/chapter_01.md @@ -51,8 +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 keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 -# .clone().mark_parts_secret().unwrap().into_keypair()?; +# let keypair = tsk.keys_valid().for_signing().nth(0).unwrap(). +# key().clone().mark_parts_secret().unwrap().into_keypair()?; # # // Start streaming an OpenPGP message. # let message = Message::new(sink); @@ -196,8 +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 keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 -# .clone().mark_parts_secret().unwrap().into_keypair()?; +# let keypair = tsk.keys_valid().for_signing().nth(0).unwrap(). +# key().clone().mark_parts_secret().unwrap().into_keypair()?; # # // Start streaming an OpenPGP message. # let message = Message::new(sink); @@ -341,8 +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 keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 - .clone().mark_parts_secret().unwrap().into_keypair()?; + let keypair = tsk.keys_valid().for_signing().nth(0).unwrap(). + key().clone().mark_parts_secret().unwrap().into_keypair()?; // Start streaming an OpenPGP message. let message = Message::new(sink); @@ -497,8 +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 keypair = tsk.keys_valid().for_signing().nth(0).unwrap().2 -# .clone().mark_parts_secret().unwrap().into_keypair()?; +# let keypair = tsk.keys_valid().for_signing().nth(0).unwrap(). +# key().clone().mark_parts_secret().unwrap().into_keypair()?; # # // Start streaming an OpenPGP message. # let message = Message::new(sink); diff --git a/guide/src/chapter_02.md b/guide/src/chapter_02.md index cc024348..e1687803 100644 --- a/guide/src/chapter_02.md +++ b/guide/src/chapter_02.md @@ -53,7 +53,7 @@ fn main() { # let mut recipients = # recipient.keys_valid() # .for_transport_encryption() -# .map(|(_, _, key)| key.into()) +# .map(|ka| ka.key().into()) # .collect::<Vec<_>>(); # # // Start streaming an OpenPGP message. @@ -194,7 +194,7 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # let mut recipients = # recipient.keys_valid() # .for_transport_encryption() -# .map(|(_, _, key)| key.into()) +# .map(|ka| ka.key().into()) # .collect::<Vec<_>>(); # # // Start streaming an OpenPGP message. @@ -335,7 +335,7 @@ fn encrypt(sink: &mut Write, plaintext: &str, recipient: &openpgp::Cert) let mut recipients = recipient.keys_valid() .for_transport_encryption() - .map(|(_, _, key)| key.into()) + .map(|ka| ka.key().into()) .collect::<Vec<_>>(); // Start streaming an OpenPGP message. @@ -490,7 +490,7 @@ Decrypted data can be read from this using [`io::Read`]. # let mut recipients = # recipient.keys_valid() # .for_transport_encryption() -# .map(|(_, _, key)| key.into()) +# .map(|ka| ka.key().into()) # .collect::<Vec<_>>(); # # // Start streaming an OpenPGP message. |