Enum holochain::prelude::dependencies::kitsune_p2p_types::dependencies::lair_keystore_api::prelude::PwHashLimits
source · pub enum PwHashLimits {
Minimum,
Interactive,
Moderate,
Sensitive,
}
Expand description
Enum to specify limits (difficulty) for argon2id pwhashing algorithm.
Ops in this library don’t take explicit limit parameters. Instead, they check the current context, if not set using the default “Moderate” limits.
To set the context for the scope of the “with_exec” callback:
let _my_result = PwHashLimits::Sensitive.with_exec(|| {
// execute my function that needs "Sensitive" limits
});
Variants§
Minimum
minimum limits (UNIT TESTING ONLY)
Interactive
low cpu/mem limits
Moderate
middle cpu/mem limits (default)
Sensitive
high cpu/mem limits
Implementations§
source§impl PwHashLimits
impl PwHashLimits
sourcepub fn current() -> PwHashLimits
pub fn current() -> PwHashLimits
Get the current set limits
or the default “Moderate” limits if none are set by with_exec()
.
sourcepub fn with_exec<R, F>(self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn with_exec<R, F>(self, f: F) -> Rwhere
F: FnOnce() -> R,
Execute a closure with these pwhash limits set.
sourcepub fn as_mem_limit(&self) -> u32
pub fn as_mem_limit(&self) -> u32
translate into mem limit
sourcepub fn as_ops_limit(&self) -> u32
pub fn as_ops_limit(&self) -> u32
translate into cpu limit
Trait Implementations§
source§impl Clone for PwHashLimits
impl Clone for PwHashLimits
source§fn clone(&self) -> PwHashLimits
fn clone(&self) -> PwHashLimits
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PwHashLimits
impl Debug for PwHashLimits
source§impl PartialEq for PwHashLimits
impl PartialEq for PwHashLimits
source§fn eq(&self, other: &PwHashLimits) -> bool
fn eq(&self, other: &PwHashLimits) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for PwHashLimits
impl Eq for PwHashLimits
impl StructuralPartialEq for PwHashLimits
Auto Trait Implementations§
impl RefUnwindSafe for PwHashLimits
impl Send for PwHashLimits
impl Sync for PwHashLimits
impl Unpin for PwHashLimits
impl UnwindSafe for PwHashLimits
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.source§impl<T> Upcastable for T
impl<T> Upcastable for T
source§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
source§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref