This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user