diff --git a/src/commands/auth.rs b/src/commands/auth.rs index 62a2221..f4fb977 100644 --- a/src/commands/auth.rs +++ b/src/commands/auth.rs @@ -1,7 +1,7 @@ use super::*; use crate::{ sdk::api_url, - utils::{auth::get_token, config::get_config}, + utils::{auth::get_token, config::Config}, }; use anyhow::bail; use reqwest::header; @@ -19,7 +19,7 @@ pub struct Args { } pub async fn command(args: Args) -> anyhow::Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let client = reqwest::Client::new(); diff --git a/src/commands/config/set/keyring_expiry.rs b/src/commands/config/set/keyring_expiry.rs index f02bca8..30b8bdd 100644 --- a/src/commands/config/set/keyring_expiry.rs +++ b/src/commands/config/set/keyring_expiry.rs @@ -1,4 +1,4 @@ -use crate::utils::config::get_config; +use crate::utils::config::Config; use super::*; @@ -18,7 +18,7 @@ pub async fn command(args: Args) -> Result<()> { } else { println!("Setting keyring expiry to {} days", args.days); } - let mut config = get_config()?; + let mut config = Config::get()?; let mut settings = config.get_settings()?; if args.days == 0 { diff --git a/src/commands/config/set/primary_key.rs b/src/commands/config/set/primary_key.rs index 1d9249c..911ed4d 100644 --- a/src/commands/config/set/primary_key.rs +++ b/src/commands/config/set/primary_key.rs @@ -1,5 +1,5 @@ use super::*; -use crate::utils::{config::get_config, prompt::prompt_select}; +use crate::utils::{config::Config, prompt::prompt_select}; /// Set the primary key in the global config #[derive(Parser)] @@ -10,7 +10,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let mut config = get_config()?; + let mut config = Config::get()?; let fingerprint = match args.key { Some(k) => k, diff --git a/src/commands/config/set/unsafe_password.rs b/src/commands/config/set/unsafe_password.rs index 3e618e2..5c390db 100644 --- a/src/commands/config/set/unsafe_password.rs +++ b/src/commands/config/set/unsafe_password.rs @@ -1,6 +1,6 @@ use super::*; use crate::utils::{ - config::{get_config, get_config_path}, + config::{get_config_path, Config}, prompt::{prompt_confirm, prompt_password}, }; @@ -19,7 +19,7 @@ pub async fn command(args: Args) -> Result<()> { println!("This command is VERY insecure. It will store your password in PLAIN TEXT in the config file."); prompt_confirm("Are you sure you want to continue?")?; - let mut config = get_config()?; + let mut config = Config::get()?; let password = match args.password { Some(k) => k, diff --git a/src/commands/decrypt.rs b/src/commands/decrypt.rs index 4b0e4f3..9a660ce 100644 --- a/src/commands/decrypt.rs +++ b/src/commands/decrypt.rs @@ -1,5 +1,5 @@ use super::*; -use crate::utils::{config::get_config, rpgp::decrypt_full}; +use crate::utils::{config::Config, rpgp::decrypt_full}; use anyhow::{Context, Result}; /// Decrypt a string using GPG @@ -9,7 +9,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let decrypted = decrypt_full(args.message, &config)?; diff --git a/src/commands/delete/key.rs b/src/commands/delete/key.rs index 01a492e..868f104 100644 --- a/src/commands/delete/key.rs +++ b/src/commands/delete/key.rs @@ -2,6 +2,7 @@ use super::*; use crate::{ sdk::SDK, utils::{ + config::Config, key::Key, prompt::{prompt_confirm, prompt_multi_options}, }, @@ -24,8 +25,7 @@ pub struct Args { // TODO: fix configuration race condition while deleting multiple keys pub async fn command(args: Args) -> Result<()> { - let mut config = - crate::utils::config::get_config().context("Failed to get config")?; + let mut config = Config::get().context("Failed to get config")?; let kl_arc = std::sync::Arc::new(&config.keys); let primary_key = &config.primary_key; diff --git a/src/commands/delete/project.rs b/src/commands/delete/project.rs index 3016e23..c879fae 100644 --- a/src/commands/delete/project.rs +++ b/src/commands/delete/project.rs @@ -1,6 +1,6 @@ use crate::{ sdk::SDK, - utils::{choice::Choice, config::get_config}, + utils::{choice::Choice, config::Config}, }; use super::*; @@ -16,7 +16,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let mut config = get_config()?; + let mut config = Config::get()?; let key = config.get_key_or_default(args.key)?; let project_id = diff --git a/src/commands/encrypt.rs b/src/commands/encrypt.rs index 7f9a1eb..8fa1d81 100644 --- a/src/commands/encrypt.rs +++ b/src/commands/encrypt.rs @@ -1,7 +1,7 @@ use anyhow::Context; use crate::utils::{ - config::get_config, + config::Config, rpgp::{encrypt, get_vault_location}, }; @@ -18,7 +18,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let primary_key = config.primary_key.clone(); diff --git a/src/commands/export.rs b/src/commands/export.rs index 06c7ce5..7e0ef93 100644 --- a/src/commands/export.rs +++ b/src/commands/export.rs @@ -1,7 +1,5 @@ use super::*; -use crate::utils::{ - config::get_config, key::VecKeyTrait, prompt::prompt_options, -}; +use crate::utils::{config::Config, key::VecKeyTrait, prompt::prompt_options}; /// Export a public or secret key #[derive(Parser)] @@ -16,7 +14,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let keys: Vec<&str> = config.keys.all_fingerprints(); diff --git a/src/commands/gen.rs b/src/commands/gen.rs index c2051ef..39b0bd7 100644 --- a/src/commands/gen.rs +++ b/src/commands/gen.rs @@ -75,7 +75,7 @@ fn email_validator(email: &str) -> anyhow::Result<(), anyhow::Error> { } pub async fn command(args: Args) -> Result<()> { - let mut config = config::get_config().context("Failed to get config")?; + let mut config = config::Config::get().context("Failed to get config")?; let settings = config.get_settings()?; let name = args diff --git a/src/commands/get/config.rs b/src/commands/get/config.rs index 1d7f40b..0716c4b 100644 --- a/src/commands/get/config.rs +++ b/src/commands/get/config.rs @@ -1,6 +1,6 @@ use super::*; use crate::utils::btreemap::ToBTreeMap; -use crate::utils::config::get_config; +use crate::utils::config::Config; use crate::utils::table::Table; use anyhow::Context; use anyhow::Result; @@ -16,7 +16,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; if args.json { let json = serde_json::to_string_pretty(&config) diff --git a/src/commands/get/keys.rs b/src/commands/get/keys.rs index 833083e..9827511 100644 --- a/src/commands/get/keys.rs +++ b/src/commands/get/keys.rs @@ -1,5 +1,5 @@ use super::*; -use crate::utils::config::get_config; +use crate::utils::config::Config; /// List all keys in the config #[derive(Parser)] @@ -10,7 +10,7 @@ pub struct Args { } pub async fn command(_args: Args) -> Result<()> { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; println!("Keys:"); for key in config.keys.iter() { diff --git a/src/commands/get/project.rs b/src/commands/get/project.rs index 3218311..acff250 100644 --- a/src/commands/get/project.rs +++ b/src/commands/get/project.rs @@ -1,5 +1,5 @@ use super::*; -use crate::utils::config::get_config; +use crate::utils::config::Config; use crate::{sdk::SDK, utils::choice::Choice}; /// Get all environment variables for a project @@ -20,7 +20,7 @@ pub struct Args { // TODO: Pretty print project info (in a table?) pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let project_id = Choice::try_project(args.project_id, &key.fingerprint).await?; diff --git a/src/commands/get/projects.rs b/src/commands/get/projects.rs index 0c9100a..15bb798 100644 --- a/src/commands/get/projects.rs +++ b/src/commands/get/projects.rs @@ -1,4 +1,4 @@ -use crate::{sdk::SDK, utils::config::get_config}; +use crate::{sdk::SDK, utils::config::Config}; use super::*; @@ -9,7 +9,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(None)?; let local_projects = config.projects.clone(); diff --git a/src/commands/keyring/clear.rs b/src/commands/keyring/clear.rs index 1c07ddf..7923a3a 100644 --- a/src/commands/keyring/clear.rs +++ b/src/commands/keyring/clear.rs @@ -1,5 +1,5 @@ use crate::utils::{ - config::get_config, keyring::clear_password, prompt::prompt_select, + config::Config, keyring::clear_password, prompt::prompt_select, }; use super::*; @@ -15,7 +15,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let fingerprint = match args.key { Some(key) => config.get_key(&key)?.fingerprint, diff --git a/src/commands/keyring/view.rs b/src/commands/keyring/view.rs index ce85d73..9d7f8ad 100644 --- a/src/commands/keyring/view.rs +++ b/src/commands/keyring/view.rs @@ -1,5 +1,5 @@ use crate::utils::{ - config::get_config, + config::Config, keyring::get_password, prompt::{prompt_confirm_with_default, prompt_select}, }; @@ -21,7 +21,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let fingerprint = match args.key { Some(key) => config.get_key(&key)?.fingerprint, diff --git a/src/commands/link.rs b/src/commands/link.rs index 412ac80..7e42443 100644 --- a/src/commands/link.rs +++ b/src/commands/link.rs @@ -1,6 +1,6 @@ use super::*; use crate::utils::choice::Choice; -use crate::utils::config::get_config; +use crate::utils::config::Config; /// Get all environment variables for a project #[derive(Parser)] @@ -19,7 +19,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let mut config = get_config()?; + let mut config = Config::get()?; let projects = &config.projects; let cwd = std::env::current_dir()?; diff --git a/src/commands/new/project.rs b/src/commands/new/project.rs index 30e65fd..3552e23 100644 --- a/src/commands/new/project.rs +++ b/src/commands/new/project.rs @@ -1,6 +1,6 @@ use super::*; use crate::utils::prompt::prompt_text; -use crate::{sdk::SDK, utils::config::get_config}; +use crate::{sdk::SDK, utils::config::Config}; /// Create a new project #[derive(Parser)] @@ -18,7 +18,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; // check if nn flag is set diff --git a/src/commands/project/add_user.rs b/src/commands/project/add_user.rs index e799d3b..9b04c49 100644 --- a/src/commands/project/add_user.rs +++ b/src/commands/project/add_user.rs @@ -4,7 +4,7 @@ use crate::{ utils::{ auth::get_token, choice::Choice, - config::get_config, + config::Config, prompt::prompt_text, rpgp::encrypt_multi, variable::{EncryptedVariable, ToKVPair}, @@ -39,7 +39,7 @@ pub async fn command(args: Args) -> Result<()> { }; let user_id = user_id.trim().to_string(); - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let uuid = key diff --git a/src/commands/project/list_users.rs b/src/commands/project/list_users.rs index 2d61c47..db0ce32 100644 --- a/src/commands/project/list_users.rs +++ b/src/commands/project/list_users.rs @@ -1,6 +1,6 @@ use super::*; use crate::types::PartialUser; -use crate::utils::config::get_config; +use crate::utils::config::Config; use crate::{sdk::SDK, utils::choice::Choice}; /// Get all environment variables for a project @@ -25,7 +25,7 @@ pub struct Args { // TODO: Pretty print project info (in a table?) pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let project_id = Choice::try_project(args.project_id, &key.fingerprint).await?; diff --git a/src/commands/project/remove_user.rs b/src/commands/project/remove_user.rs index 6a098b9..95f6712 100644 --- a/src/commands/project/remove_user.rs +++ b/src/commands/project/remove_user.rs @@ -13,7 +13,7 @@ use crate::{ utils::{ auth::get_token, choice::Choice, - config::get_config, + config::Config, prompt::prompt_multi_options, rpgp::encrypt_multi, variable::{EncryptedVariable, ToKVPair}, @@ -37,7 +37,7 @@ pub struct Args { } pub async fn command(args: Args) -> anyhow::Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let uuid = key diff --git a/src/commands/run.rs b/src/commands/run.rs index 1958224..158fb83 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -1,5 +1,5 @@ use super::*; -use crate::utils::choice::Choice; +use crate::utils::{choice::Choice, config::Config}; use anyhow::bail; use std::collections::BTreeMap; @@ -19,7 +19,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = crate::utils::config::get_config()?; + let config = Config::get()?; let key = match args.key { Some(k) => k.to_owned(), None => config.primary_key.clone(), diff --git a/src/commands/set.rs b/src/commands/set.rs index 6a46dd3..905bac1 100644 --- a/src/commands/set.rs +++ b/src/commands/set.rs @@ -5,7 +5,7 @@ use crate::{ sdk::SDK, utils::{ choice::Choice, - config::get_config, + config::Config, kvpair::KVPair, // partial_variable::ToParsed, prompt::prompt_confirm, @@ -39,7 +39,7 @@ pub async fn command(args: Args) -> Result<()> { ); } - let config = get_config()?; + let config = Config::get()?; let key = match &args.key { Some(k) => k, None => &config.primary_key, diff --git a/src/commands/shell.rs b/src/commands/shell.rs index f8de57a..6c949a6 100644 --- a/src/commands/shell.rs +++ b/src/commands/shell.rs @@ -1,4 +1,5 @@ use crate::utils::choice::Choice; +use crate::utils::config::Config; use super::*; use std::collections::BTreeMap; @@ -40,7 +41,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = crate::utils::config::get_config()?; + let config = Config::get()?; let key = match args.key { Some(k) => k.to_owned(), None => config.primary_key.clone(), diff --git a/src/commands/sign.rs b/src/commands/sign.rs index 1728c76..4f9d284 100644 --- a/src/commands/sign.rs +++ b/src/commands/sign.rs @@ -1,4 +1,4 @@ -use crate::utils::{config::get_config, keyring::try_get_password}; +use crate::utils::{config::Config, keyring::try_get_password}; use super::*; use anyhow::Ok; @@ -16,7 +16,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let key = config .keys diff --git a/src/commands/unlink.rs b/src/commands/unlink.rs index dc0ff7f..46f4138 100644 --- a/src/commands/unlink.rs +++ b/src/commands/unlink.rs @@ -1,12 +1,12 @@ use super::*; -use crate::utils::config::get_config; +use crate::utils::config::Config; /// Unset the current project #[derive(Parser)] pub struct Args {} pub async fn command(_args: Args) -> Result<()> { - let mut config = get_config()?; + let mut config = Config::get()?; let unset = config.unlink_project()?; config.write()?; diff --git a/src/commands/unset.rs b/src/commands/unset.rs index bb76c7b..ae99e12 100644 --- a/src/commands/unset.rs +++ b/src/commands/unset.rs @@ -1,7 +1,7 @@ use super::*; use crate::utils::choice::Choice; use crate::utils::prompt; -use crate::{sdk::SDK, utils::config::get_config}; +use crate::{sdk::SDK, utils::config::Config}; /// Unset (delete) an environment variable #[derive(Parser)] @@ -22,7 +22,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let project_id = match args.all { true => None, diff --git a/src/commands/upload.rs b/src/commands/upload.rs index 9c72b87..5268805 100644 --- a/src/commands/upload.rs +++ b/src/commands/upload.rs @@ -1,7 +1,7 @@ use super::*; use crate::{ sdk::SDK, - utils::{config::get_config, prompt::prompt_text}, + utils::{config::Config, prompt::prompt_text}, }; /// If your key is not in the database, use this command to upload it @@ -17,7 +17,7 @@ pub struct Args { } pub async fn command(args: Args) -> Result<()> { - let mut config = get_config()?; + let mut config = Config::get()?; let key = config.get_key(&args.key)?; diff --git a/src/commands/variables.rs b/src/commands/variables.rs index 646f667..e2715cb 100644 --- a/src/commands/variables.rs +++ b/src/commands/variables.rs @@ -2,7 +2,7 @@ use super::*; use crate::{ sdk::SDK, utils::{ - btreemap::ToBTreeMap, choice::Choice, config::get_config, table::Table, + btreemap::ToBTreeMap, choice::Choice, config::Config, table::Table, variable::ToKVPair, }, }; @@ -31,7 +31,7 @@ pub struct Args { pub async fn command(args: Args) -> Result<()> { let mode = Mode::from_args(&args); - let config = get_config()?; + let config = Config::get()?; let key = config.get_key_or_default(args.key)?; let project_id = Choice::try_project(args.project_id, &key.fingerprint).await?; diff --git a/src/main.rs b/src/main.rs index d524aa8..f070067 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,11 +4,7 @@ use anyhow::Result; use clap::{error::ErrorKind, Parser, Subcommand}; use commands::*; use home::home_dir; -use tokio::task::JoinHandle; -use utils::{ - compare_semver, - config::{get_config, Config}, -}; +use utils::{compare_semver, config::Config}; mod commands; mod constants; @@ -96,7 +92,7 @@ async fn main() -> Result<()> { } let check_updates_handle = if std::io::stdout().is_terminal() { - let mut config = get_config()?; + let mut config = Config::get()?; if let Some(new_version) = &config.new_version_available { if matches!( diff --git a/src/sdk.rs b/src/sdk.rs index 20bd029..66c3bc4 100644 --- a/src/sdk.rs +++ b/src/sdk.rs @@ -4,7 +4,7 @@ use crate::{ types::ProjectInfo, utils::{ auth::get_token, - config::get_config, + config::Config, kvpair::KVPair, rpgp::{decrypt_full_many, encrypt_multi}, variable::{DecryptedVariable, EncryptedVariable, ToKVPair}, @@ -32,7 +32,7 @@ pub fn api_url() -> Url { if dev_mode { return Ok(Url::parse("http://localhost:3000")?); } - let url = get_config()? + let url = Config::get()? .sdk_url .unwrap_or("https://api.envx.sh".into()); let url = Url::parse(&url)?; @@ -50,7 +50,7 @@ pub fn api_url() -> Url { pub(crate) struct SDK {} impl SDK { async fn auth_header(partial_fingerprint: &str) -> Result { - let config = get_config()?; + let config = Config::get()?; let key = config.get_key(partial_fingerprint)?; let Some(uuid) = key.uuid else { bail!("No UUID for key {}\nTry envx upload", partial_fingerprint) @@ -167,7 +167,7 @@ impl SDK { // ) -> Result<(Vec, Vec)> { ) -> Result> { // GET /user/:id/variables - let config = get_config()?; + let config = Config::get()?; let key = config.get_key(partial_fingerprint)?; let client = reqwest::Client::new(); @@ -196,7 +196,7 @@ impl SDK { .iter() .map(|e| e.value.clone()) .collect::>(), - &get_config()?, + &Config::get()?, )?; let kvpairs = decrypted @@ -249,7 +249,7 @@ impl SDK { .iter() .map(|e| e.value.clone()) .collect::>(), - &get_config()?, + &Config::get()?, )?; let kvpairs = decrypted @@ -494,7 +494,7 @@ impl SDK { // DELETE /user/:id let client = reqwest::Client::new(); - let config = get_config()?; + let config = Config::get()?; let key = config.get_key(partial_fingerprint)?; let uuid = key.uuid.context("No UUID for key, try `envx upload`")?; diff --git a/src/utils/auth.rs b/src/utils/auth.rs index 6de62a1..2bb1915 100644 --- a/src/utils/auth.rs +++ b/src/utils/auth.rs @@ -1,4 +1,4 @@ -use crate::utils::config::get_config; +use crate::utils::config::Config; use anyhow::{anyhow, Context}; use chrono::Utc; use pgp::composed::message::Message; @@ -11,7 +11,7 @@ pub async fn get_token( fingerprint: &str, token: &str, ) -> anyhow::Result { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let key = config .keys .iter() diff --git a/src/utils/choice.rs b/src/utils/choice.rs index 387ca68..1cb4d9f 100644 --- a/src/utils/choice.rs +++ b/src/utils/choice.rs @@ -2,15 +2,12 @@ use anyhow::{Context, Result}; use crate::sdk::SDK; -use super::{ - config::{get_config, Config}, - key::Key, -}; +use super::{config::Config, key::Key}; pub struct Choice {} impl Choice { pub fn get_key(partial_fingerprint: &str) -> Result<(Key, Config)> { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let key = config.get_key(partial_fingerprint)?; Ok((key, config)) } @@ -67,7 +64,7 @@ impl Choice { match project_id { Some(p) => Ok(p), None => { - let config = get_config().context("Failed to get config")?; + let config = Config::get().context("Failed to get config")?; let project = config.get_project(); match project { diff --git a/src/utils/config.rs b/src/utils/config.rs index 847cfcd..25ab955 100644 --- a/src/utils/config.rs +++ b/src/utils/config.rs @@ -324,9 +324,3 @@ pub fn get_config_path() -> Result { } Ok(path) } - -/// Read the configuration file and parse it into a Config struct -#[deprecated] -pub fn get_config() -> Result { - Config::get() -} diff --git a/src/utils/keyring.rs b/src/utils/keyring.rs index b1515b8..99292e6 100644 --- a/src/utils/keyring.rs +++ b/src/utils/keyring.rs @@ -1,7 +1,4 @@ -use super::{ - config::{get_config, Config}, - prompt::prompt_password, -}; +use super::{config::Config, prompt::prompt_password}; use crate::utils::settings::KeyringExpiry; use crate::{ constants::MINIMUM_PASSWORD_LENGTH, utils::prompt::prompt_confirm, @@ -49,7 +46,7 @@ pub fn set_password( } pub fn get_password(fingerprint: &str) -> anyhow::Result { - let config = get_config()?; + let config = Config::get()?; let settings = config.get_settings()?; if fingerprint == config.primary_key { diff --git a/src/utils/rpgp.rs b/src/utils/rpgp.rs index e1b2f69..7d2f3d8 100644 --- a/src/utils/rpgp.rs +++ b/src/utils/rpgp.rs @@ -1,4 +1,4 @@ -use super::config::{get_config, Config}; +use super::config::Config; use super::keyring::try_get_password; use anyhow::{anyhow, Context, Ok, Result}; use colored::Colorize; @@ -142,8 +142,13 @@ pub fn hash_string(input: &str) -> String { } pub fn generate_hashed_primary_user_id(name: String, email: String) -> String { - hash_string(&format!("{}{}{}", name, email, &get_config().unwrap().salt)) - .to_uppercase() + hash_string(&format!( + "{}{}{}", + name, + email, + &Config::get().unwrap().salt + )) + .to_uppercase() } pub fn decrypt_full(message: String, config: &Config) -> Result {