Skip to main content

Master

Struct Master 

Source
pub struct Master { /* private fields */ }
Expand description

Key derived from a master passphrase, which the passphrases for all domains and users are derived from.

Implementations§

Source§

impl Master

Source

pub fn derive( version: u32, level: u32, passphrase: &str, seed: &[u8], ) -> Result<Self, Error>

Derives the key from a master passphrase, with the cost of a level. With a seed (which can be empty for none), the master passphrase alone is not enough to derive anything.

This takes a while, and as much memory as the level says.

Source

pub fn derive_with_cost( version: u32, cost: Cost, passphrase: &str, seed: &[u8], ) -> Result<Self, Error>

Derives the key from a master passphrase with a cost that is not that of a level.

Nothing else derives the same from the master passphrase. This is for tests, which can use a cost that is small.

Source

pub fn hash(&self) -> [u8; 32]

Hash of the key, which tells whether a master passphrase is the right one without storing it. Only the start of it should be stored: the more of it there is, the more it helps someone who is guessing the master passphrase.

Source

pub fn hash_hex(&self) -> String

The hash in hex, in lower case.

Source

pub fn random(&self, domain: &str, user: &str) -> ChaCha20

The source of randomness for a domain (such as example.com) and a user (such as the name of an account), both of which can be empty. They are used as they are, so example.com and Example.com are different domains.

Trait Implementations§

Source§

impl Clone for Master

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Master

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Master

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Master

Auto Trait Implementations§

§

impl Forget for Master

§

impl Freeze for Master

§

impl Move for Master

§

impl RefUnwindSafe for Master

§

impl Send for Master

§

impl Sync for Master

§

impl Unpin for Master

§

impl UnsafeUnpin for Master

§

impl UnwindSafe for Master

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Is for T
where T: ?Sized,

Source§

type EqTo = T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.