mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-04 02:37:46 +02:00
16 lines
338 B
TypeScript
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);
|
|
}
|
|
}
|