Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleanup passphrase and hidden impl to use tari_utils #67

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mfm_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ zeroize = "1.7.0"
serde_json = "1.0.108"
serde_derive = "1.0.193"
anyhow = "1.0.75"
tari_utilities = "0.7.0"
23 changes: 19 additions & 4 deletions mfm_core/src/config/authentication/wallet.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use tari_utilities::SafePassword;

use crate::password::{deserialize_safe_password, SafePassword};

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Wallet {
#[serde(deserialize_with = "deserialize_safe_password")]
pub private_key: SafePassword,
pub not_encrypted: bool,
pub env_password: Option<String>,
}

impl PartialEq for Wallet {
fn eq(&self, other: &Self) -> bool {
self.not_encrypted == other.not_encrypted && self.env_password == other.env_password
}
}

impl Eq for Wallet {}

fn deserialize_safe_password<'de, D>(deserializer: D) -> Result<SafePassword, D::Error>
where
D: serde::Deserializer<'de>,
{
let password: String = Deserialize::deserialize(deserializer)?;
Ok(SafePassword::from(password))
}
72 changes: 0 additions & 72 deletions mfm_core/src/hidden/mod.rs

This file was deleted.

3 changes: 0 additions & 3 deletions mfm_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
pub mod config;
pub mod contexts;
pub mod hidden;
pub mod password;
pub mod states;
pub mod tasks;
61 changes: 0 additions & 61 deletions mfm_core/src/password/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion mfm_core/src/tasks/mod.rs

This file was deleted.

Loading