@fewer/password
Version:
A pipe that handles hashing passwords
11 lines (10 loc) • 463 B
TypeScript
import { Pipe } from 'fewer';
declare type StringPropertyNames<T> = Exclude<{
[K in keyof T]: Exclude<T[K], undefined> extends string ? K : never;
}[keyof T], undefined>;
export declare function withPassword<Instance, Virtual extends string>(virtualField: Virtual, hashedField: StringPropertyNames<Instance>, saltRounds?: number): Pipe<Instance, {
[P in Virtual]?: string;
} & {
authenticate(passwordToCheck: string): Promise<boolean>;
}>;
export {};