Struct PasswordMaker

Source
pub struct PasswordMaker<'a, T: HasherList> { /* private fields */ }
Expand description

A cached instance of validated PasswordMaker settings. See new for details.

Implementations§

Source§

impl<'a, T: HasherList> PasswordMaker<'a, T>

Source

pub fn new( hash_algorithm: HashAlgorithm, use_leet: UseLeetWhenGenerating, characters: &'a str, username: &'a str, modifier: &'a str, password_length: usize, prefix: &'a str, suffix: &'a str, ) -> Result<Self, SettingsError>

Validates user input and returns a PasswordMaker object if the input is valid.

hash_algorithm is a PasswordMaker Pro algorithm selection. use_leet details when to use leet, if at all. characters is the list of output password characters. Actually this is not true. It’s the list of grapheme clusters. username is the “username” field of PasswordMaker Pro. modifier is the “modifier” field of PasswordMaker Pro. password_length is the desired password length to generate. prefix is the prefix to which the password gets appended. Counts towards password_length. suffix is the suffix appended to the password. Counts towards password_length.

§Errors

Fails if characters does not contain at least 2 grapheme clusters. Mapping to output happens by number system conversion, and a number system base 1 or base 0 does not make any sense.

Source

pub fn generate( &self, data: String, key: String, ) -> Result<String, GenerationError>

Generates a password for the given data and key. data is the “text-to-use”, typically the output of UrlParsing. key is the key, also known as “master password”.

§Errors

Fails if either of the parameters has zero-length.

Auto Trait Implementations§

§

impl<'a, T> Freeze for PasswordMaker<'a, T>

§

impl<'a, T> RefUnwindSafe for PasswordMaker<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for PasswordMaker<'a, T>
where T: Send,

§

impl<'a, T> Sync for PasswordMaker<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for PasswordMaker<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for PasswordMaker<'a, T>
where T: UnwindSafe,

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, 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.