diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-05-05 11:43:26 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-05-05 11:43:26 +0200 |
commit | b67cf1c60b76b6d9b54b10a021c10e4c4e55b498 (patch) | |
tree | e7bb42a8c7f8d7a5fb65abdf4e07577fbbb19113 | |
parent | 6e182cad61c49dae93ce067cf360555ee4e00520 (diff) |
openpgp: Don't export internal data structures.
- Don't export CertValidity, KeyringValidator, KeyringValidity, or
MessageValidity.
- Fixes #490.
-rw-r--r-- | openpgp/src/cert/mod.rs | 10 | ||||
-rw-r--r-- | openpgp/src/cert/parser/mod.rs | 12 | ||||
-rw-r--r-- | openpgp/src/cert/prelude.rs | 3 | ||||
-rw-r--r-- | openpgp/src/message/mod.rs | 3 | ||||
-rw-r--r-- | openpgp/src/parse.rs | 4 |
5 files changed, 20 insertions, 12 deletions
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index ee289f91..bcee398b 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -189,13 +189,15 @@ mod revoke; pub use self::builder::{CertBuilder, CipherSuite}; pub use parser::{ - KeyringValidity, - KeyringValidator, CertParser, - CertValidity, }; -pub(crate) use parser::CertValidator; +pub(crate) use parser::{ + CertValidator, + CertValidity, + KeyringValidator, + KeyringValidity, +}; pub use revoke::{ SubkeyRevocationBuilder, diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index 81efc92f..a4faa6c0 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -32,8 +32,10 @@ use low_level::{ use super::TRACE; /// Whether a packet sequence is a valid keyring. +/// +/// This is used #[derive(Debug)] -pub enum KeyringValidity { +pub(crate) enum KeyringValidity { /// The packet sequence is a valid keyring. Keyring, /// The packet sequence is a valid keyring prefix. @@ -42,6 +44,7 @@ pub enum KeyringValidity { Error(anyhow::Error), } +#[allow(unused)] impl KeyringValidity { /// Returns whether the packet sequence is a valid keyring. /// @@ -80,7 +83,7 @@ impl KeyringValidity { /// Used to help validate that a packet sequence is a valid keyring. #[derive(Debug)] -pub struct KeyringValidator { +pub(crate) struct KeyringValidator { tokens: Vec<Token>, n_keys: usize, n_packets: usize, @@ -96,6 +99,7 @@ impl Default for KeyringValidator { } } +#[allow(unused)] impl KeyringValidator { /// Instantiates a new `KeyringValidator`. pub fn new() -> Self { @@ -240,7 +244,8 @@ impl KeyringValidator { /// Whether a packet sequence is a valid Cert. #[derive(Debug)] -pub enum CertValidity { +#[allow(unused)] +pub(crate) enum CertValidity { /// The packet sequence is a valid Cert. Cert, /// The packet sequence is a valid Cert prefix. @@ -249,6 +254,7 @@ pub enum CertValidity { Error(anyhow::Error), } +#[allow(unused)] impl CertValidity { /// Returns whether the packet sequence is a valid Cert. /// diff --git a/openpgp/src/cert/prelude.rs b/openpgp/src/cert/prelude.rs index 7b70d5bd..f79f8714 100644 --- a/openpgp/src/cert/prelude.rs +++ b/openpgp/src/cert/prelude.rs @@ -18,10 +18,7 @@ pub use crate::cert::{ CertBuilder, CertParser, CertRevocationBuilder, - CertValidity, CipherSuite, - KeyringValidator, - KeyringValidity, Preferences as _, SubkeyRevocationBuilder, UserAttributeRevocationBuilder, diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs index cc3b6508..1fd5ecb2 100644 --- a/openpgp/src/message/mod.rs +++ b/openpgp/src/message/mod.rs @@ -73,7 +73,7 @@ impl From<MessageParserError> for anyhow::Error { /// Represents the status of a parsed message. #[derive(Debug)] -pub enum MessageValidity { +pub(crate) enum MessageValidity { /// The packet sequence is a valid OpenPGP message. Message, /// The packet sequence appears to be a valid OpenPGP message that @@ -84,6 +84,7 @@ pub enum MessageValidity { Error(anyhow::Error), } +#[allow(unused)] impl MessageValidity { /// Returns whether the packet sequence is a valid message. /// diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index 271de8d4..b5e38747 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -65,8 +65,10 @@ use std::path::Path; use ::buffered_reader::*; use crate::{ - cert::prelude::*, cert::CertValidator, + cert::CertValidity, + cert::KeyringValidator, + cert::KeyringValidity, crypto::{aead, hash::Hash}, Result, packet::header::{ |