summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-03-31 11:01:45 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-03-31 11:53:06 +0200
commitebf143bfa906769ff096f1a60f8d98b688c681dd (patch)
tree69fee8b860c6581dc358040ad3eb834659abbb8a
parent7f4eb0b55bb20b771d8ccfc5e0541ff95f83757c (diff)
openpgp: Move definition of struct KeyID.
-rw-r--r--openpgp/src/keyid.rs18
-rw-r--r--openpgp/src/lib.rs18
2 files changed, 18 insertions, 18 deletions
diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs
index e7e262fd..306e9648 100644
--- a/openpgp/src/keyid.rs
+++ b/openpgp/src/keyid.rs
@@ -3,9 +3,25 @@ use quickcheck::{Arbitrary, Gen};
use crate::Error;
use crate::Fingerprint;
-use crate::KeyID;
use crate::Result;
+/// Holds a KeyID.
+///
+/// A KeyID is a fingerprint fragment. It identifies a public key,
+/// but is easy to forge. For more details about how a KeyID is
+/// generated, see [Section 12.2 of RFC 4880].
+///
+/// [Section 12.2 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-12.2
+#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
+pub enum KeyID {
+ /// Lower 8 byte SHA-1 hash.
+ V4([u8;8]),
+ /// Used for holding fingerprints that we don't understand. For
+ /// instance, we don't grok v3 fingerprints. And, it is possible
+ /// that the Issuer subpacket contains the wrong number of bytes.
+ Invalid(Box<[u8]>)
+}
+
impl fmt::Display for KeyID {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.convert_to_string(true))
diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs
index 0cd474da..8a993d26 100644
--- a/openpgp/src/lib.rs
+++ b/openpgp/src/lib.rs
@@ -165,6 +165,7 @@ use crate::types::{
mod fingerprint;
mod keyid;
+pub use keyid::KeyID;
mod keyhandle;
pub use keyhandle::KeyHandle;
pub mod policy;
@@ -462,20 +463,3 @@ pub enum Fingerprint {
/// that the Issuer subpacket contains the wrong number of bytes.
Invalid(Box<[u8]>)
}
-
-/// Holds a KeyID.
-///
-/// A KeyID is a fingerprint fragment. It identifies a public key,
-/// but is easy to forge. For more details about how a KeyID is
-/// generated, see [Section 12.2 of RFC 4880].
-///
-/// [Section 12.2 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-12.2
-#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
-pub enum KeyID {
- /// Lower 8 byte SHA-1 hash.
- V4([u8;8]),
- /// Used for holding fingerprints that we don't understand. For
- /// instance, we don't grok v3 fingerprints. And, it is possible
- /// that the Issuer subpacket contains the wrong number of bytes.
- Invalid(Box<[u8]>)
-}