pub struct Parser {
pub header: Header,
pub data: Vec<Data>,
pub signature_key: Secret<Vec<u8>>,
pub root_key: Secret<Vec<u8>>,
pub filepath: String,
pub config: Config,
/* private fields */
}
Fields§
§header: Header
§data: Vec<Data>
§signature_key: Secret<Vec<u8>>
§root_key: Secret<Vec<u8>>
§filepath: String
§config: Config
Implementations§
Source§impl Parser
impl Parser
pub fn new( signature_key: Secret<Vec<u8>>, root_key: Secret<Vec<u8>>, master_salt: Vec<u8>, encrypted_root_key: Option<Vec<u8>>, nonce: Option<Vec<u8>>, ) -> Parser
pub fn new_default() -> Parser
Sourcepub fn read_from_file(&mut self, filepath: &str) -> Result<(), Box<dyn Error>>
pub fn read_from_file(&mut self, filepath: &str) -> Result<(), Box<dyn Error>>
Read db from file and store the content. Only header section will be parsed
Sourcepub fn verify_password_from_file(
filepath: &str,
master_password: Secret<String>,
) -> Result<(Secret<Vec<u8>>, Secret<Vec<u8>>), Box<dyn Error>>
pub fn verify_password_from_file( filepath: &str, master_password: Secret<String>, ) -> Result<(Secret<Vec<u8>>, Secret<Vec<u8>>), Box<dyn Error>>
Verify password without having to read the whole file content
Sourcepub fn derive_master_key(
master_password: Secret<String>,
salt: &[u8],
algorithm: String,
iterations: u8,
threads: u8,
memory: u32,
) -> (Secret<Vec<u8>>, Secret<Vec<u8>>)
pub fn derive_master_key( master_password: Secret<String>, salt: &[u8], algorithm: String, iterations: u8, threads: u8, memory: u32, ) -> (Secret<Vec<u8>>, Secret<Vec<u8>>)
Derive master_key
and signature_key
from master_password
Sourcepub fn get_root_key(&mut self, master_key: &Secret<Vec<u8>>)
pub fn get_root_key(&mut self, master_key: &Secret<Vec<u8>>)
Decrypt encrypted_root_key
and set it as current root_key
Sourcepub fn generate_root_key(
master_key: Secret<Vec<u8>>,
encryption_alg: u8,
) -> (Secret<Vec<u8>>, Vec<u8>, [u8; 12])
pub fn generate_root_key( master_key: Secret<Vec<u8>>, encryption_alg: u8, ) -> (Secret<Vec<u8>>, Vec<u8>, [u8; 12])
Generate new random root_key
and its encrypted form
Sourcepub fn generate_child_key(&mut self) -> Secret<Vec<u8>>
pub fn generate_child_key(&mut self) -> Secret<Vec<u8>>
Get the child_key
from the current root_key
Sourcepub fn new_password_entry(
&mut self,
key: String,
metadata: String,
password: Secret<String>,
)
pub fn new_password_entry( &mut self, key: String, metadata: String, password: Secret<String>, )
Add new entry to the Parser.data
Sourcepub fn verify_signature(&mut self) -> Result<(), Box<dyn Error>>
pub fn verify_signature(&mut self) -> Result<(), Box<dyn Error>>
Verify whether the signature is correct with the header data
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more