From b5281991ef40c91b878979118cb6dfb57b376cca Mon Sep 17 00:00:00 2001 From: David Mehren Date: Tue, 23 Feb 2021 22:16:27 +0100 Subject: [PATCH] AuthService: randomString does not need to by async Signed-off-by: David Mehren --- src/auth/auth.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 5d746eb61..0439686bc 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -62,7 +62,7 @@ export class AuthService { return await compare(cleartext, password); } - async randomString(length: number): Promise { + randomString(length: number): Buffer { if (length <= 0) { return null; } @@ -93,8 +93,8 @@ export class AuthService { `User '${user.userName}' has already 200 tokens and can't have anymore`, ); } - const secret = this.bufferToBase64Url(await this.randomString(54)); - const keyId = this.bufferToBase64Url(await this.randomString(8)); + const secret = this.bufferToBase64Url(this.randomString(54)); + const keyId = this.bufferToBase64Url(this.randomString(8)); const accessToken = await this.hashPassword(secret); let token; // Tokens can only be valid for a maximum of 2 years