use core::str::FromStr;
use std::env::args;
use std::io;
use std::path::Path;
use anyhow::Result;
use shush_rs::SecretString;
use tracing::info;
use rencfs::crypto::Cipher;
use rencfs::encryptedfs::PasswordProvider;
use rencfs::mount::create_mount_point;
use rencfs::mount::MountPoint;
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt().init();
let mut args = args();
args.next(); let mount_path = args.next().expect("mount_path expected");
let data_path = args.next().expect("data_path expected");
println!("mount_path: {mount_path}");
println!("data_path: {data_path}");
struct PasswordProviderImpl {}
impl PasswordProvider for PasswordProviderImpl {
fn get_password(&self) -> Option<SecretString> {
Some(SecretString::from_str("a").unwrap())
}
}
let mount_point = create_mount_point(
Path::new(&mount_path),
Path::new(&data_path),
Box::new(PasswordProviderImpl {}),
Cipher::ChaCha20Poly1305,
false,
false,
false,
);
let handle = mount_point.mount().await?;
let mut buffer = String::new();
io::stdin().read_line(&mut buffer)?;
info!("Unmounting...");
info!("Bye!");
handle.umount().await?;
Ok(())
}