ESLint: Enable @typescript-eslint/return-await rule

This ensures stack traces are helpful at the cost of a slightly
lower performance (one more tick in the event loop).

Fixes #838

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-02-20 20:14:36 +01:00
parent 6a6dc7ea21
commit 6ffeb2e9c9
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
8 changed files with 26 additions and 20 deletions

View file

@ -49,17 +49,17 @@ export class AuthService {
}
const accessToken = await this.getAuthTokenAndValidate(keyId, secret);
await this.setLastUsedToken(keyId);
return this.usersService.getUserByUsername(accessToken.user.userName);
return await this.usersService.getUserByUsername(accessToken.user.userName);
}
async hashPassword(cleartext: string): Promise<string> {
// hash the password with bcrypt and 2^12 iterations
// this was decided on the basis of https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#bcrypt
return hash(cleartext, 12);
return await hash(cleartext, 12);
}
async checkPassword(cleartext: string, password: string): Promise<boolean> {
return compare(cleartext, password);
return await compare(cleartext, password);
}
async randomString(length: number): Promise<Buffer> {
@ -209,13 +209,13 @@ export class AuthService {
// Delete all non valid tokens every sunday on 3:00 AM
@Cron('0 0 3 * * 0')
async handleCron() {
return this.removeInvalidTokens();
return await this.removeInvalidTokens();
}
// Delete all non valid tokens 5 sec after startup
@Timeout(5000)
async handleTimeout() {
return this.removeInvalidTokens();
return await this.removeInvalidTokens();
}
async removeInvalidTokens() {