UNPKG

passwords-sqnfa-web

Version:

This library implements the recommendations that apply to client-side password handling from NIST and OWASP. The purpose of this library is to provide an easy pluggable client-side password preprocessor.

43 lines (42 loc) 1.76 kB
import { Result } from '../result'; import { Handler, HaveibeenpwnedHttpClient } from '../types/sqnfa'; export declare class HaveibeenpwnedConfiguration { /** * Bring your own http client that does the actual call to the API. */ readonly httpClient: HaveibeenpwnedHttpClient; /** * The enpoint to he pwned passwords range search that ensures k-anonymity while looking for breaches. */ pwnedPasswordsUrl: string; constructor( /** * Bring your own http client that does the actual call to the API. */ httpClient: HaveibeenpwnedHttpClient); } export declare class HaveibeenpwnedHandler implements Handler { private config; readonly name = "HaveibeenpwnedHandler"; /** * NIST 800-63B: * Password complexity: Users’ password choices are very predictable, * so attackers are likely to guess passwords that have been successful * in the past. For this reason, it is recommended that passwords chosen * by users be compared against a “black list” of unacceptable passwords. * This list should include passwords from previous breach corpuses. * * The web service haveibeenpwned.com is a free resource for anyone to * quickly assess if they may have been put at risk due to an online * account of theirs having been compromised or "pwned" in a data breach. */ constructor(config: HaveibeenpwnedConfiguration); /** * Uses the pwned passwords range search that ensures k-anonymity while looking for breaches. * * @param password The password to check. * @returns Successful result if the password is not found or a failure otherwise. */ handle(password: string): Promise<Result>; private constructUrl; }