@codecot/pw-checker
Version:
A comprehensive CLI tool to audit passwords locally using HIBP and import from Chrome/Bitwarden
63 lines (62 loc) • 1.85 kB
TypeScript
export interface RiskWeights {
compromisedPassword: number;
emailBreachesPerBreach: number;
criticalAccountCategory: number;
oldPasswordAge: number;
weakPassword: number;
duplicatePassword: number;
noTwoFactorAuth: number;
}
export declare const DEFAULT_RISK_WEIGHTS: RiskWeights;
export interface RiskLevel {
score: number;
label: "Low" | "Medium" | "High" | "Critical";
color: string;
description: string;
}
export interface PasswordEntry {
id: number;
name: string;
url: string;
username: string;
password: string;
compromised: boolean | null;
source: string;
last_checked_at: string | null;
notes: string | null;
breach_info: string | null;
risk_score?: number;
risk_label?: string;
risk_factors?: string[];
}
/**
* Determine risk level based on score
*/
export declare function getRiskLevel(score: number): RiskLevel;
/**
* Check if account is in a critical category
*/
export declare function isCriticalAccount(name: string, url: string): boolean;
/**
* Calculate password strength score (0-100, lower is weaker)
*/
export declare function calculatePasswordStrength(password: string): number;
/**
* Check if password is older than specified months
*/
export declare function isPasswordOld(lastCheckedAt: string | null, monthsThreshold?: number): boolean;
/**
* Calculate comprehensive risk score for a password entry
*/
export declare function calculateRiskScore(entry: PasswordEntry, allEntries: PasswordEntry[], weights?: RiskWeights): {
score: number;
factors: string[];
};
/**
* Update risk scores for all entries in the database
*/
export declare function updateAllRiskScores(): Promise<void>;
/**
* Get entries sorted by risk score
*/
export declare function getEntriesByRisk(limit?: number): Promise<PasswordEntry[]>;