Skip to content

Commit

Permalink
Merge pull request #201 from Eyob94/chore/change_secrecy_to_shush
Browse files Browse the repository at this point in the history
Move from `secrecy` to `shush`
  • Loading branch information
Eyob94 committed Sep 16, 2024
2 parents 29eb741 + 401e12e commit 3a4043d
Show file tree
Hide file tree
Showing 27 changed files with 473 additions and 417 deletions.
519 changes: 282 additions & 237 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ rpassword = "7.3.1"
anyhow = "1.0.82"
argon2 = "0.5.3"
keyring = "2.3.2"
secrecy = "0.8.0"
retainer = "0.3.0"
num-format = "0.4.4"
ring = "0.17.8"
Expand All @@ -57,6 +56,7 @@ blake3 = "=0.1.3"
thread_local = "1.1.8"
subtle = "2.6.1"
bon = "2.2.0"
shush-rs = "0.1.10"

[target.'cfg(target_os = "linux")'.dependencies]
fuse3 = { version = "0.7.2", features = ["tokio-runtime", "unprivileged"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/change_password.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::str::FromStr;
use rencfs::crypto::Cipher;
use rencfs::encryptedfs::{EncryptedFs, FsError};
use secrecy::SecretString;
use shush_rs::SecretString;
use std::env::args;
use std::path::Path;

Expand Down
10 changes: 5 additions & 5 deletions examples/change_password_cli.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::env::args;
use std::io;
use std::io::Write;
use std::{env::args, str::FromStr};

use rpassword::read_password;
use secrecy::{ExposeSecret, SecretString};
use shush_rs::{ExposeSecret, SecretString};
use tracing::{error, info};

use rencfs::encryptedfs::{EncryptedFs, FsError};
Expand All @@ -21,13 +21,13 @@ async fn main() {
use rencfs::crypto::Cipher;
print!("Enter old password: ");
io::stdout().flush().unwrap();
let old_password = SecretString::new(read_password().unwrap());
let old_password = SecretString::from_str(&read_password().unwrap()).unwrap();
print!("Enter new password: ");
io::stdout().flush().unwrap();
let new_password = SecretString::new(read_password().unwrap());
let new_password = SecretString::from_str(&read_password().unwrap()).unwrap();
print!("Confirm new password: ");
io::stdout().flush().unwrap();
let new_password2 = SecretString::new(read_password().unwrap());
let new_password2 = SecretString::from_str(&read_password().unwrap()).unwrap();
if new_password.expose_secret() != new_password2.expose_secret() {
error!("Passwords do not match");
return;
Expand Down
4 changes: 2 additions & 2 deletions examples/crypto_speed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{fs, io};

use anyhow::Result;
use rand_core::RngCore;
use secrecy::SecretVec;
use shush_rs::SecretVec;

use rencfs::crypto;
use rencfs::crypto::write::{CryptoInnerWriter, CryptoWrite};
Expand Down Expand Up @@ -156,5 +156,5 @@ where
fn get_key(cipher: Cipher) -> io::Result<SecretVec<u8>> {
let mut key = vec![0; cipher.key_len()];
crypto::create_rng().fill_bytes(key.as_mut_slice());
Ok(SecretVec::new(key))
Ok(SecretVec::from(key))
}
4 changes: 2 additions & 2 deletions examples/crypto_write_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::fs::File;
use std::io;
use std::path::Path;

use secrecy::SecretVec;
use shush_rs::SecretVec;
use tracing::info;

use rencfs::crypto;
Expand All @@ -18,7 +18,7 @@ fn main() -> Result<()> {
let cipher = Cipher::ChaCha20Poly1305;
let mut key = vec![0; cipher.key_len()];
crypto::create_rng().fill_bytes(key.as_mut_slice());
let key = SecretVec::new(key);
let key = SecretVec::from(key);

let mut args = args();
// skip the program name
Expand Down
2 changes: 1 addition & 1 deletion examples/encryptedfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs;
use std::path::Path;

use anyhow::Result;
use secrecy::SecretString;
use shush_rs::SecretString;

use rencfs::crypto::Cipher;
use rencfs::encryptedfs::write_all_string_to_fs;
Expand Down
2 changes: 1 addition & 1 deletion examples/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::io;
use std::path::Path;

use anyhow::Result;
use secrecy::SecretString;
use shush_rs::SecretString;
use tracing::info;

use rencfs::crypto::Cipher;
Expand Down
29 changes: 16 additions & 13 deletions java-bridge/Cargo.lock

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

2 changes: 1 addition & 1 deletion java-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ tracing = "0.1.40"
tracing-subscriber = "0.3.18"
tracing-appender = "0.2.3"
tokio = { version = "1.39.2", features = ["full"] }
secrecy = "0.8.0"
shush-rs = "0.1.10"
ctrlc = { version = "3.1.9", features = ["termination"] }
4 changes: 2 additions & 2 deletions java-bridge/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate jni;
extern crate rencfs;
extern crate secrecy;
extern crate shush_rs;
extern crate tokio;
extern crate tracing;

Expand All @@ -13,7 +13,7 @@ use rencfs::crypto::Cipher;
use rencfs::encryptedfs::PasswordProvider;
use rencfs::log::log_init;
use rencfs::mount::{create_mount_point, umount, MountHandle};
use secrecy::SecretString;
use shush_rs::SecretString;
use std::collections::BTreeMap;
use std::ops::Add;
use std::path::Path;
Expand Down
Loading

0 comments on commit 3a4043d

Please sign in to comment.