import { Nullable } from "../../types/utils.js"; //#region src/modules/regex/regexChecker.d.ts /** * @public */ declare class RegexChecker { /** * 用户名正则 * 数字字母,连接符,下划线 */ readonly usernamePattern: RegExp; /** *正数 */ readonly positivePattern: RegExp; /** * 负数 */ readonly negativePattern: RegExp; /** * 邮箱,允许中文邮箱 */ readonly emailPatternCN: RegExp; readonly emailPattern: RegExp; /** *手机号码 */ readonly mobilePattern: RegExp; } /** * @public */ declare const regexChecker: RegexChecker; /** * @public */ interface PasswordStrengthRule { key: string; regex: RegExp; desp: string; } /** * @public */ declare const passwordStrengthRule: readonly PasswordStrengthRule[]; /** * @public */ type PasswordStrengthRuleKey = (typeof passwordStrengthRule)[number]['key']; /** * @public */ type AnalyzePasswordStrenthOptions = { minLength?: number; }; /** * 检查密码强度,返回多个判断的结果对象 * @param password - 要检查的密码 * @param options - 检查选项 * @returns 密码强度分析结果 * @public */ declare function analyzePasswordStrength(password: Nullable, options?: AnalyzePasswordStrenthOptions): Record; /** * @public */ type PasswordStrengthLevelStrategy = (analyzeResult: Record) => OUT; /** * @public */ declare const passwordStrengthLevelStrategys: Record; /** * @public */ type CalculatePasswordStrengthLevelOptions = { strategy?: PasswordStrengthLevelStrategy; } & AnalyzePasswordStrenthOptions; /** * 计算密码强度等级,可以切换不同的策略 * 有一个默认策略,若密码强度小于minlength,则返回0 * 处理minLength以外,其他规则若有一项符合则强度+1,比如大写字母,小写字母,特殊字符,数字 * @param password - 要检查的密码 * @param options - 计算选项 * @returns 密码强度等级 * @public */ declare function calculatePasswordStrengthLevel(password: string, options?: CalculatePasswordStrengthLevelOptions): number; //#endregion export { type AnalyzePasswordStrenthOptions, type CalculatePasswordStrengthLevelOptions, type PasswordStrengthLevelStrategy, type PasswordStrengthRule, type PasswordStrengthRuleKey, RegexChecker, analyzePasswordStrength, calculatePasswordStrengthLevel, passwordStrengthLevelStrategys, passwordStrengthRule, regexChecker };