pub struct CipherRiskClient {
pub(crate) client: Client,
}Expand description
Client for evaluating credential risk for login ciphers.
Fields§
§client: ClientImplementations§
Source§impl CipherRiskClient
impl CipherRiskClient
Sourcepub fn password_reuse_map(
&self,
login_details: Vec<CipherLoginDetails>,
) -> PasswordReuseMap
pub fn password_reuse_map( &self, login_details: Vec<CipherLoginDetails>, ) -> PasswordReuseMap
Build password reuse map for a list of login ciphers.
Returns a map where keys are passwords and values are the number of times
each password appears in the provided list. This map can be passed to compute_risk()
to enable password reuse detection.
Sourceasync fn to_cipher_risk(
http_client: Client,
details: CipherLoginDetails,
password_map: Option<Arc<PasswordReuseMap>>,
check_exposed: bool,
base_url: String,
) -> CipherRiskResult
async fn to_cipher_risk( http_client: Client, details: CipherLoginDetails, password_map: Option<Arc<PasswordReuseMap>>, check_exposed: bool, base_url: String, ) -> CipherRiskResult
Convert a single login details to CipherRisk.
For the cipher:
- Calculates password strength (0-4) using zxcvbn with cipher-specific context
- Optionally checks if the password has been exposed via Have I Been Pwned API
- Counts how many times the password is reused in the provided
password_map
Sourcepub async fn compute_risk(
&self,
login_details: Vec<CipherLoginDetails>,
options: CipherRiskOptions,
) -> Result<Vec<CipherRiskResult>, CipherRiskError>
pub async fn compute_risk( &self, login_details: Vec<CipherLoginDetails>, options: CipherRiskOptions, ) -> Result<Vec<CipherRiskResult>, CipherRiskError>
Evaluate security risks for multiple login ciphers concurrently.
For each cipher:
- Calculates password strength (0-4) using zxcvbn with cipher-specific context
- Optionally checks if the password has been exposed via Have I Been Pwned API
- Counts how many times the password is reused in the provided
password_map
Returns a vector of CipherRisk results, one for each input cipher.
§HIBP Check Results (exposed_result field)
The exposed_result field uses the ExposedPasswordResult enum with three possible states:
NotChecked: Password exposure check was not performed because:check_exposedoption wasfalse, or- Password was empty
Found(n): Successfully checked via HIBP API, password appears inndata breachesError(msg): HIBP API request failed with error messagemsg
§Errors
This method only returns Err for internal logic failures. HIBP API errors are
captured per-cipher in the exposed_result field as ExposedPasswordResult::Error(msg).
Trait Implementations§
Source§impl From<CipherRiskClient> for JsValue
impl From<CipherRiskClient> for JsValue
Source§fn from(value: CipherRiskClient) -> Self
fn from(value: CipherRiskClient) -> Self
Source§impl FromWasmAbi for CipherRiskClient
impl FromWasmAbi for CipherRiskClient
Source§impl IntoWasmAbi for CipherRiskClient
impl IntoWasmAbi for CipherRiskClient
Source§impl OptionFromWasmAbi for CipherRiskClient
impl OptionFromWasmAbi for CipherRiskClient
Source§impl OptionIntoWasmAbi for CipherRiskClient
impl OptionIntoWasmAbi for CipherRiskClient
Source§impl RefFromWasmAbi for CipherRiskClient
impl RefFromWasmAbi for CipherRiskClient
Source§type Anchor = RcRef<CipherRiskClient>
type Anchor = RcRef<CipherRiskClient>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for CipherRiskClient
impl RefMutFromWasmAbi for CipherRiskClient
Source§impl TryFromJsValue for CipherRiskClient
impl TryFromJsValue for CipherRiskClient
Source§impl VectorFromWasmAbi for CipherRiskClient
impl VectorFromWasmAbi for CipherRiskClient
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[CipherRiskClient]>
Source§impl VectorIntoWasmAbi for CipherRiskClient
impl VectorIntoWasmAbi for CipherRiskClient
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[CipherRiskClient]>) -> Self::Abi
Source§impl WasmDescribe for CipherRiskClient
impl WasmDescribe for CipherRiskClient
impl SupportsConstructor for CipherRiskClient
impl SupportsInstanceProperty for CipherRiskClient
impl SupportsStaticProperty for CipherRiskClient
Auto Trait Implementations§
impl Freeze for CipherRiskClient
impl !RefUnwindSafe for CipherRiskClient
impl Send for CipherRiskClient
impl Sync for CipherRiskClient
impl Unpin for CipherRiskClient
impl !UnwindSafe for CipherRiskClient
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.