summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-18 14:44:53 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-18 16:21:46 +0100
commit7a6701001a9408a8eae6faedc91b5d2c42611c5c (patch)
tree21c0080676d791996043ddc133e0fa96879c144e /openpgp
parent1e19e63f9a717df2c3dbb50b18665844e64cef9a (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 'openpgp')
-rw-r--r--openpgp/src/cert/bindings.rs5
-rw-r--r--openpgp/src/packet/key/mod.rs24
2 files changed, 16 insertions, 13 deletions
diff --git a/openpgp/src/cert/bindings.rs b/openpgp/src/cert/bindings.rs
index bfaa0534..d06dbfa6 100644
--- a/openpgp/src/cert/bindings.rs
+++ b/openpgp/src/cert/bindings.rs
@@ -39,8 +39,9 @@ impl<P: key::KeyParts> Key<P, key::SubordinateRole> {
/// assert_eq!(cert.keys_valid().key_flags(flags.clone()).count(), 0);
///
/// // Generate a subkey and a binding signature.
- /// let subkey : key::SecretSubkey
- /// = Key4::generate_ecc(false, Curve::Cv25519)?.into();
+ /// let subkey: Key<_, key::SubordinateRole> =
+ /// Key4::generate_ecc(false, Curve::Cv25519)?
+ /// .into();
/// let builder = signature::Builder::new(SignatureType::SubkeyBinding)
/// .set_key_flags(&flags)?;
/// let binding = subkey.bind(&mut keypair, &cert, builder, None)?;
diff --git a/openpgp/src/packet/key/mod.rs b/openpgp/src/packet/key/mod.rs
index 0b06cd21..6d8b58ac 100644
--- a/openpgp/src/packet/key/mod.rs
+++ b/openpgp/src/packet/key/mod.rs
@@ -43,10 +43,10 @@
//! // Get a handle to the Cert's primary key that allows using the
//! // secret key material.
//! use std::convert::TryInto;
-//! let sk : &key::SecretKey = cert.primary().try_into()?;
+//! let sk: &Key<key::SecretParts, key::PrimaryRole> = cert.primary().try_into()?;
//!
//! // Make the conversion explicit.
-//! let sk : &key::SecretKey = cert.primary().mark_parts_secret_ref()?;
+//! let sk = cert.primary().mark_parts_secret_ref()?;
//! # Ok(())
//! # }
//! ```
@@ -131,29 +131,31 @@ pub struct UnspecifiedRole;
impl KeyRole for UnspecifiedRole {}
/// A Public Key.
-pub type PublicKey = Key<PublicParts, PrimaryRole>;
+pub(crate) type PublicKey = Key<PublicParts, PrimaryRole>;
/// A Public Subkey.
-pub type PublicSubkey = Key<PublicParts, SubordinateRole>;
+pub(crate) type PublicSubkey = Key<PublicParts, SubordinateRole>;
/// A Secret Key.
-pub type SecretKey = Key<SecretParts, PrimaryRole>;
+pub(crate) type SecretKey = Key<SecretParts, PrimaryRole>;
/// A Secret Subkey.
-pub type SecretSubkey = Key<SecretParts, SubordinateRole>;
+pub(crate) type SecretSubkey = Key<SecretParts, SubordinateRole>;
/// A key with public parts, and an unspecified role
/// (`UnspecifiedRole`).
-pub type UnspecifiedPublic = Key<PublicParts, UnspecifiedRole>;
+pub(crate) type UnspecifiedPublic = Key<PublicParts, UnspecifiedRole>;
/// A key with secret parts, and an unspecified role
/// (`UnspecifiedRole`).
-pub type UnspecifiedSecret = Key<SecretParts, UnspecifiedRole>;
+pub(crate) type UnspecifiedSecret = Key<SecretParts, UnspecifiedRole>;
/// A primary key with unspecified parts (`UnspecifiedParts`).
-pub type UnspecifiedPrimary = Key<UnspecifiedParts, PrimaryRole>;
+#[allow(dead_code)]
+pub(crate) type UnspecifiedPrimary = Key<UnspecifiedParts, PrimaryRole>;
/// A subkey key with unspecified parts (`UnspecifiedParts`).
-pub type UnspecifiedSecondary = Key<UnspecifiedParts, SubordinateRole>;
+#[allow(dead_code)]
+pub(crate) type UnspecifiedSecondary = Key<UnspecifiedParts, SubordinateRole>;
/// A key whose parts and role are unspecified
/// (`UnspecifiedParts`, `UnspecifiedRole`).
-pub type UnspecifiedKey = Key<UnspecifiedParts, UnspecifiedRole>;
+pub(crate) type UnspecifiedKey = Key<UnspecifiedParts, UnspecifiedRole>;
macro_rules! convert {
( $x:ident ) => {