pub struct Attributes<H, R> { /* private fields */ }Expand description
Attributes represent a collection of attribute values and that
can be hardened into a Keyspace.
Implementations§
Source§impl<H, R> Attributes<H, R>where
H: PasswordHasher<PasswordHash> + Sync,
R: SeedableRng + Rng + Sync,
R::Seed: AsMut<[u8]> + Default + Zeroize,
impl<H, R> Attributes<H, R>where
H: PasswordHasher<PasswordHash> + Sync,
R: SeedableRng + Rng + Sync,
R::Seed: AsMut<[u8]> + Default + Zeroize,
Sourcepub fn new(arr: Vec<Vec<u8>>, password_hasher: H) -> Result<Self, AttrkeyError>
pub fn new(arr: Vec<Vec<u8>>, password_hasher: H) -> Result<Self, AttrkeyError>
Construct a new collection of Attributes.
Requires at least two attribute values, and a password hasher. Returns an error when fewer than two attributes are provided.
Sourcepub fn harden(
&self,
constraint: u8,
context: Option<&[u8]>,
) -> Result<Keyspace<R>, AttrkeyError>
pub fn harden( &self, constraint: u8, context: Option<&[u8]>, ) -> Result<Keyspace<R>, AttrkeyError>
Harden the attributes into a cryptographic Keyspace.
Applies password hashing to harden all attributes in parallel with salts derived from each attribute and its position. All hardened attributes are used to produce a keyspace, from which attribute-based keys can be selected.
Returns a Keyspace of the hardened attributes on success, or an error
if password hashing fails.
Sourcepub fn harden_with_salts(
&self,
salts: &[Vec<u8>],
constraint: u8,
context: Option<&[u8]>,
) -> Result<Keyspace<R>, AttrkeyError>
pub fn harden_with_salts( &self, salts: &[Vec<u8>], constraint: u8, context: Option<&[u8]>, ) -> Result<Keyspace<R>, AttrkeyError>
Harden the attributes into a cryptographic Keyspace.
Applies password hashing to harden all attributes in parallel with provided salts. All hardened attributes are used to produce a keyspace, from which attribute-based keys can be selected.
Returns a Keyspace of the hardened attributes on success, or an error
if password hashing fails.
Trait Implementations§
Source§impl<H: Clone, R: Clone> Clone for Attributes<H, R>
impl<H: Clone, R: Clone> Clone for Attributes<H, R>
Source§fn clone(&self) -> Attributes<H, R>
fn clone(&self) -> Attributes<H, R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<H, R> Drop for Attributes<H, R>
impl<H, R> Drop for Attributes<H, R>
Auto Trait Implementations§
impl<H, R> Freeze for Attributes<H, R>where
H: Freeze,
impl<H, R> RefUnwindSafe for Attributes<H, R>where
H: RefUnwindSafe,
R: RefUnwindSafe,
impl<H, R> Send for Attributes<H, R>
impl<H, R> Sync for Attributes<H, R>
impl<H, R> Unpin for Attributes<H, R>
impl<H, R> UnsafeUnpin for Attributes<H, R>where
H: UnsafeUnpin,
impl<H, R> UnwindSafe for Attributes<H, R>where
H: UnwindSafe,
R: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more