n8n/packages/cli/src/services/password.utility.ts
कारतोफ्फेलस्क्रिप्ट™ 39d5e0ff87
refactor(core): Replace typedi with our custom DI system (no-changelog) (#12389)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2025-01-06 10:21:24 +01:00

16 lines
338 B
TypeScript

import { Service as Utility } from '@n8n/di';
import { compare, hash } from 'bcryptjs';
const SALT_ROUNDS = 10;
@Utility()
export class PasswordUtility {
async hash(plaintext: string) {
return await hash(plaintext, SALT_ROUNDS);
}
async compare(plaintext: string, hashed: string) {
return await compare(plaintext, hashed);
}
}