Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 15 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {Injectable} from '@nestjs/common'; |
||
2 | import * as argon2 from 'argon2'; |
||
3 | import {IPasswordEncoder} from 'src/Application/IPasswordEncoder'; |
||
4 | |||
5 | @Injectable() |
||
6 | export class PasswordEncoderAdapter implements IPasswordEncoder { |
||
7 | public hash(payload: string): Promise<string> { |
||
8 | return argon2.hash(payload); |
||
9 | } |
||
10 | |||
11 | public compare(hash: string, payload: string): Promise<boolean> { |
||
12 | return argon2.verify(hash, payload); |
||
13 | } |
||
14 | } |
||
15 |