import { hash , compare } from 'bcrypt' ; import { Injectable } from '@nestjs/common' ; import { ConfigService } from '@nestjs/config' ; @ Injectable ( ) export class EncryptionService { constructor ( private readonly config ) { } async hash ( plain ) { return hash ( plain , parseInt ( this . config . get ( 'HASH_ROUNDS' , '10' ) ) ) ; } async compare ( plain , encrypted ) { return compare ( plain , encrypted ) ; } }