0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-28 00:59:18 -05:00
immich/server/libs/infra/src/auth/crypto.repository.ts

17 lines
447 B
TypeScript
Raw Normal View History

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');
}
}