This commit is contained in:
@ -7,7 +7,7 @@
|
||||
|
||||
interface Signature {
|
||||
hash: string;
|
||||
iat: Date;
|
||||
iat: number;
|
||||
}
|
||||
|
||||
class Blacklist {
|
||||
@ -17,15 +17,15 @@ class Blacklist {
|
||||
this._signatures = [];
|
||||
}
|
||||
|
||||
public clear_before (date: Date):void {
|
||||
public clear (before: number = Number.POSITIVE_INFINITY):void {
|
||||
for (let i = this._signatures.length - 1; i >= 0; i--) {
|
||||
if (this._signatures[i].iat < date)
|
||||
if (this._signatures[i].iat < before)
|
||||
this._signatures.splice (i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public add_signature (hash: string):void {
|
||||
this._signatures.push ({ iat: (new Date), hash });
|
||||
this._signatures.push ({ iat: Date.now (), hash });
|
||||
}
|
||||
|
||||
public remove_signature (hash:string):void {
|
||||
|
@ -144,6 +144,11 @@ class KeyStore {
|
||||
}
|
||||
this.garbage_collect ();
|
||||
}
|
||||
|
||||
public reset_instance (): void {
|
||||
this._instance = to_b58 (random_hex (16), 'hex');
|
||||
this._keys = {};
|
||||
}
|
||||
}
|
||||
|
||||
const ks: KeyStore = (new KeyStore);
|
||||
|
Reference in New Issue
Block a user