Struct Parser

Source
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

Source

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

Source

pub fn new_default() -> Parser

Source

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

Source

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

Source

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

Source

pub fn get_root_key(&mut self, master_key: &Secret<Vec<u8>>)

Decrypt encrypted_root_key and set it as current root_key

Source

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

Source

pub fn generate_child_key(&mut self) -> Secret<Vec<u8>>

Get the child_key from the current root_key

Source

pub fn new_password_entry( &mut self, key: String, metadata: String, password: Secret<String>, )

Add new entry to the Parser.data

Source

pub fn read_tlv(data: Vec<u8>) -> Result<Vec<Data>, Box<dyn Error>>

Parse the TLV data

Source

pub fn verify_signature(&mut self) -> Result<(), Box<dyn Error>>

Verify whether the signature is correct with the header data

Source

pub fn read_raw_content(&mut self) -> Result<(), Box<dyn Error>>

Parse Parser.raw_content into Parser.data

Source

pub fn write_to_file(&mut self) -> Result<(), Box<dyn Error>>

Write content into file

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V