diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2020-04-29 11:16:05 +0200 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2020-04-29 12:28:38 +0200 |
commit | 253a3a6951687ca3099fbb4a3a716716496b71b4 (patch) | |
tree | e5f01db897bb881986dd7516640eb68c64f54449 | |
parent | 4ec978c15e2e729b6b90fe589b1d61bfab5ebbb9 (diff) |
openpgp: Reduce visibility of CertValidator.
- Make CertValidator `pub(crate)` instead of `pub`.
- Remove unused methods.
- Mark `push_token` as `#[cfg(test)]` as it is used only in tests.
-rw-r--r-- | openpgp/src/cert/mod.rs | 3 | ||||
-rw-r--r-- | openpgp/src/cert/parser/mod.rs | 26 | ||||
-rw-r--r-- | openpgp/src/cert/prelude.rs | 1 | ||||
-rw-r--r-- | openpgp/src/parse.rs | 1 |
4 files changed, 5 insertions, 26 deletions
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index 0a745d7e..a86537f6 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -193,9 +193,10 @@ pub use parser::{ KeyringValidator, CertParser, CertValidity, - CertValidator, }; +pub(crate) use parser::CertValidator; + pub use revoke::{ SubkeyRevocationBuilder, CertRevocationBuilder, diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index 50cc7e5a..56d8ef9e 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -287,7 +287,7 @@ impl CertValidity { /// Used to help validate that a packet sequence is a valid Cert. #[derive(Debug)] -pub struct CertValidator(KeyringValidator); +pub(crate) struct CertValidator(KeyringValidator); impl Default for CertValidator { fn default() -> Self { @@ -301,30 +301,8 @@ impl CertValidator { CertValidator(Default::default()) } - /// Returns whether the packet sequence is a valid Cert. - /// - /// Note: a `CertValidator` will only return this after - /// `CertValidator::finish` has been called. - pub fn is_cert(&self) -> bool { - self.check().is_cert() - } - - /// Returns whether the packet sequence forms a valid Cert - /// prefix. - /// - /// Note: a `CertValidator` will only return this before - /// `CertValidator::finish` has been called. - pub fn is_cert_prefix(&self) -> bool { - self.check().is_cert_prefix() - } - - /// Returns whether the packet sequence is definitely not a valid - /// Cert. - pub fn is_err(&self) -> bool { - self.check().is_err() - } - /// Add the token `token` to the token stream. + #[cfg(test)] pub fn push_token(&mut self, token: Token) { self.0.push_token(token) } diff --git a/openpgp/src/cert/prelude.rs b/openpgp/src/cert/prelude.rs index 8bc23c35..7b70d5bd 100644 --- a/openpgp/src/cert/prelude.rs +++ b/openpgp/src/cert/prelude.rs @@ -18,7 +18,6 @@ pub use crate::cert::{ CertBuilder, CertParser, CertRevocationBuilder, - CertValidator, CertValidity, CipherSuite, KeyringValidator, diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index 35dcbcc4..7a75b36b 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -103,6 +103,7 @@ use ::buffered_reader::*; use crate::{ cert::prelude::*, + cert::CertValidator, crypto::{aead, hash::Hash}, Result, packet::header::{ |