From 771f944af447c202eba045936a36dee71ab797ac Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Sep 2024 11:32:05 +0100 Subject: refactor: fix imports, etc based on restructure move some functions out of ngit and into lib/mod and lib/git_events remove MockConnect from binaries so it is only used in the library. this was done: * mainly because automocks were not being imported from lib into each binary * but also because the these functions were being tested with MockConnect --- src/lib/login/mod.rs | 7 +++++-- src/lib/login/user.rs | 8 -------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'src/lib/login') diff --git a/src/lib/login/mod.rs b/src/lib/login/mod.rs index 19bb97c..7364edf 100644 --- a/src/lib/login/mod.rs +++ b/src/lib/login/mod.rs @@ -19,11 +19,14 @@ use crate::{ Interactor, InteractorPrompt, PromptConfirmParms, PromptInputParms, PromptPasswordParms, }, client::{fetch_public_key, get_event_from_global_cache, Connect}, - config::{UserMetadata, UserRef, UserRelayRef, UserRelays}, git::{Repo, RepoActions}, - key_handling::encryption::{decrypt_key, encrypt_key}, }; +mod key_encryption; +use key_encryption::{decrypt_key, encrypt_key}; +mod user; +use user::{UserMetadata, UserRef, UserRelayRef, UserRelays}; + /// handles the encrpytion and storage of key material #[allow(clippy::too_many_arguments)] pub async fn launch( diff --git a/src/lib/login/user.rs b/src/lib/login/user.rs index 547fe7e..46652db 100644 --- a/src/lib/login/user.rs +++ b/src/lib/login/user.rs @@ -1,15 +1,7 @@ -use anyhow::{anyhow, Result}; -use directories::ProjectDirs; use nostr::PublicKey; use nostr_sdk::Timestamp; use serde::{self, Deserialize, Serialize}; -pub fn get_dirs() -> Result { - ProjectDirs::from("", "", "ngit").ok_or(anyhow!( - "should find operating system home directories with rust-directories crate" - )) -} - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] pub struct UserRef { pub public_key: PublicKey, -- cgit v1.2.3