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;

View File

@ -59,7 +59,7 @@ export function assert_keystore_state (): void {
}
/* eslint-enable dot-notation */
export function clock_setup ():void {
export function clock_setup (): void {
assert_keystore_state ();
const date = (new Date);
@ -70,7 +70,7 @@ export function clock_setup ():void {
.mockDate (date);
}
export function clock_finalize ():void {
export function clock_finalize (): void {
jasmine.clock ()
.tick (30 * 24 * 60 * 60 * 1000);
// eslint-disable-next-line dot-notation

View File

@ -20,7 +20,7 @@ describe ('key store', () => {
clock_finalize ();
});
const keys: {key:string, sign:string, iat:number}[] = [];
const keys: {key: string, sign: string, iat: number}[] = [];
it ('should generate a new key', async () => {
const iat = (new Date)