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.

36 lines (35 loc) 1.33 kB
import { Result } from '../result'; import { HandlerSync } from '../types/sqnfa'; export declare class LengthConfiguration { /** * The minimum number of characters in the password. */ minLength: number; /** * The maximum number of bytes the password is represented in UTF8 code units. */ maxByteSize: number; } export declare class LengthHandler implements HandlerSync { private config; readonly name: string; /** * NIST 800-63B: * Password length has been found to be a primary factor in characterizing * password strength. [...] Extremely long passwords (perhaps megabytes in * length) could conceivably require excessive processing time to hash, so * it is reasonable to have some limit. [...] Accordingly, at LOA2, * SP 800-63-2 permitted the use of randomly generated PINs with 6 or more * digits while requiring user-chosen memorized secrets to be a minimum of * 8 characters long. */ constructor(config?: LengthConfiguration); /** * Checks that the password is minimum minLength and takes up at most * maxBytesSize encoded in UTF-8. * * @param password The password to check. * @returns Successful result is within the limits or a failure otherwise. */ handleSync(password: string): Result; }