From bffe934accbefb7c3deffc14bcead1acaf08fbe4 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 27 Aug 2023 19:59:28 +0000 Subject: [PATCH 1/2] refactor: hide accounts.rs constants from public API --- src/accounts.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accounts.rs b/src/accounts.rs index 9c214b371..77770049f 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -296,10 +296,10 @@ impl Accounts { } /// Configuration file name. -pub const CONFIG_NAME: &str = "accounts.toml"; +const CONFIG_NAME: &str = "accounts.toml"; /// Database file name. -pub const DB_NAME: &str = "dc.db"; +const DB_NAME: &str = "dc.db"; /// Account manager configuration file. #[derive(Debug, Clone, PartialEq)] From 62aed13880c4b71a0cd25b9393399e3537cfd48c Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 27 Aug 2023 20:24:24 +0000 Subject: [PATCH 2/2] refactor: hide pgp module from public API --- src/key.rs | 2 +- src/keyring.rs | 4 ---- src/lib.rs | 2 +- src/pgp.rs | 3 ++- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/key.rs b/src/key.rs index 2965cfb55..32deec2e3 100644 --- a/src/key.rs +++ b/src/key.rs @@ -260,7 +260,7 @@ pub(crate) async fn load_keypair( }) } -/// Use of a [KeyPair] for encryption or decryption. +/// Use of a key pair for encryption or decryption. /// /// This is used by [store_self_keypair] to know what kind of key is /// being saved. diff --git a/src/keyring.rs b/src/keyring.rs index fa5e9b5f4..e354d2348 100644 --- a/src/keyring.rs +++ b/src/keyring.rs @@ -44,10 +44,6 @@ where self.keys.push(key); } - pub fn len(&self) -> usize { - self.keys.len() - } - pub fn is_empty(&self) -> bool { self.keys.is_empty() } diff --git a/src/lib.rs b/src/lib.rs index 28778eb19..057231a8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,7 +79,7 @@ pub mod mimeparser; pub mod oauth2; mod param; pub mod peerstate; -pub mod pgp; +mod pgp; pub mod provider; pub mod qr; pub mod qr_code_generator; diff --git a/src/pgp.rs b/src/pgp.rs index 43ea19f9a..a4ae1f014 100644 --- a/src/pgp.rs +++ b/src/pgp.rs @@ -24,7 +24,8 @@ use crate::keyring::Keyring; use crate::tools::EmailAddress; #[allow(missing_docs)] -pub const HEADER_AUTOCRYPT: &str = "autocrypt-prefer-encrypt"; +#[cfg(test)] +pub(crate) const HEADER_AUTOCRYPT: &str = "autocrypt-prefer-encrypt"; #[allow(missing_docs)] pub const HEADER_SETUPCODE: &str = "passphrase-begin";