formatting
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Hocker
2021-05-10 12:41:00 +02:00
parent e7ad5656e3
commit 3bc5538a69
4 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ import keystore from './KeyStore';
import blacklist from './Blacklist';
// eslint-disable-next-line no-shadow
type TokenType = 'access_token'|'refresh_token'|'part_token'|'none'
type TokenType = 'access_token' | 'none' | 'part_token' | 'refresh_token'
interface VerificationResult {
authorized: boolean;

View File

@ -17,25 +17,25 @@ class Blacklist {
this._signatures = [];
}
public clear (before: number = Number.POSITIVE_INFINITY):void {
public clear (before: number = Number.POSITIVE_INFINITY): void {
for (let i = this._signatures.length - 1; i >= 0; i--) {
if (this._signatures[i].iat < before)
this._signatures.splice (i, 1);
}
}
public add_signature (hash: string):void {
public add_signature (hash: string): void {
this._signatures.push ({ iat: Date.now (), hash });
}
public remove_signature (hash:string):void {
public remove_signature (hash: string): void {
for (let i = this._signatures.length - 1; i >= 0; i--) {
if (this._signatures[i].hash === hash)
this._signatures.splice (i, 1);
}
}
public is_valid (hash: string):boolean {
public is_valid (hash: string): boolean {
for (const sig of this._signatures) {
if (sig.hash === hash)
return false;