diff --git a/rustcryptfs-linux/src/encrypted_filesystem.rs b/rustcryptfs-linux/src/encrypted_filesystem.rs index e2ca24c..2098494 100644 --- a/rustcryptfs-linux/src/encrypted_filesystem.rs +++ b/rustcryptfs-linux/src/encrypted_filesystem.rs @@ -1,13 +1,12 @@ -use std::{fs, path::Path}; +use std::path::Path; use fuser::Filesystem; -use rustcryptfs_lib::{config::CryptConf, filename::FilenameDecoder}; +use rustcryptfs_lib::GocryptFs; use crate::error::Result; pub struct EncryptedFs { - master_key: Vec, - filename_decoder: FilenameDecoder, + fs: GocryptFs, } impl EncryptedFs { @@ -15,22 +14,9 @@ impl EncryptedFs { where P: AsRef, { - let path = path.as_ref(); + let fs = GocryptFs::open(path, password)?; - let conf_path = path.join("gocryptfs.conf"); - - let content = fs::read_to_string(conf_path)?; - - let conf: CryptConf = serde_json::from_str(&content)?; - - let master_key = conf.get_master_key(password.as_bytes())?; - - let filename_decoder = FilenameDecoder::new(&master_key)?; - - Ok(Self { - master_key, - filename_decoder, - }) + Ok(Self { fs }) } pub fn mount

(self, mountpoint: P)