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.

44 lines (43 loc) 1.77 kB
import { Result } from '../result'; import { HandlerSync } from '../types/sqnfa'; export declare class BlackListConfiguration { /** * A list of black listed words. Both the password and every words are compared with toLocaleUpperCase. */ readonly caseInsensitiveWords: string[]; /** * The ratio between the length of the password over the length of the black listed word. * 0.75 would imply that 6 out of 8 consecutive characters cannot be on the black list. */ readonly ratioThreshold: number; /** * */ constructor( /** * A list of black listed words. Both the password and every words are compared with toLocaleUpperCase. */ caseInsensitiveWords: string[], /** * The ratio between the length of the password over the length of the black listed word. * 0.75 would imply that 6 out of 8 consecutive characters cannot be on the black list. */ ratioThreshold: number); } export declare class BlackListHandler implements HandlerSync { private readonly config; readonly name: string; /** * 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 dictionary words, and specific words (such as * the name of the service itself) that users are likely to choose. * * This handler black lists passwords containing parts of black listed words. */ constructor(config: BlackListConfiguration); handleSync(password: string): Result; }