refactor(server): new password repo method (#8208)

This commit is contained in:
Jason Rasmussen
2024-03-23 14:33:25 -04:00
committed by GitHub
parent 604b8ff17c
commit 787eebcf1e
9 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export class APIKeyService {
) {}
async create(auth: AuthDto, dto: APIKeyCreateDto): Promise<APIKeyCreateResponseDto> {
const secret = this.crypto.randomBytes(32).toString('base64').replaceAll(/\W/g, '');
const secret = this.crypto.newPassword(32);
const entity = await this.repository.create({
key: this.crypto.hashSha256(secret),
name: dto.name || 'API Key',