2023-01-23 23:13:42 -05:00
|
|
|
import { JwtSignOptions, JwtVerifyOptions } from '@nestjs/jwt';
|
|
|
|
|
|
2023-01-18 09:40:15 -05:00
|
|
|
export const ICryptoRepository = 'ICryptoRepository';
|
|
|
|
|
|
|
|
|
|
export interface ICryptoRepository {
|
|
|
|
|
randomBytes(size: number): Buffer;
|
|
|
|
|
hash(data: string | Buffer, saltOrRounds: string | number): Promise<string>;
|
|
|
|
|
compareSync(data: Buffer | string, encrypted: string): boolean;
|
2023-01-23 23:13:42 -05:00
|
|
|
signJwt(payload: string | Buffer | object, options?: JwtSignOptions): string;
|
|
|
|
|
verifyJwtAsync<T extends object = any>(token: string, options?: JwtVerifyOptions): Promise<T>;
|
2023-01-18 09:40:15 -05:00
|
|
|
}
|