Files
immich/server/libs/infra/src/repositories/crypto.repository.ts
Jason Rasmussen 34d300d1da refactor(server): flatten infra folders (#2120)
* refactor: flatten infra folders

* fix: database migrations

* fix: test related import

* fix: github actions workflow

* chore: rename schemas to typesense-schemas
2023-03-30 14:38:55 -05:00

17 lines
447 B
TypeScript

import { ICryptoRepository } from '@app/domain';
import { Injectable } from '@nestjs/common';
import { compareSync, hash } from 'bcrypt';
import { randomBytes, createHash } from 'crypto';
@Injectable()
export class CryptoRepository implements ICryptoRepository {
randomBytes = randomBytes;
hashBcrypt = hash;
compareBcrypt = compareSync;
hashSha256(value: string) {
return createHash('sha256').update(value).digest('base64');
}
}