mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-10-19 22:00:15 -04:00
AuthService: randomString does not need to by async
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
ba4825a99f
commit
b5281991ef
1 changed files with 3 additions and 3 deletions
|
@ -62,7 +62,7 @@ export class AuthService {
|
||||||
return await compare(cleartext, password);
|
return await compare(cleartext, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async randomString(length: number): Promise<Buffer> {
|
randomString(length: number): Buffer {
|
||||||
if (length <= 0) {
|
if (length <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -93,8 +93,8 @@ export class AuthService {
|
||||||
`User '${user.userName}' has already 200 tokens and can't have anymore`,
|
`User '${user.userName}' has already 200 tokens and can't have anymore`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const secret = this.bufferToBase64Url(await this.randomString(54));
|
const secret = this.bufferToBase64Url(this.randomString(54));
|
||||||
const keyId = this.bufferToBase64Url(await this.randomString(8));
|
const keyId = this.bufferToBase64Url(this.randomString(8));
|
||||||
const accessToken = await this.hashPassword(secret);
|
const accessToken = await this.hashPassword(secret);
|
||||||
let token;
|
let token;
|
||||||
// Tokens can only be valid for a maximum of 2 years
|
// Tokens can only be valid for a maximum of 2 years
|
||||||
|
|
Loading…
Reference in a new issue