This commit is contained in:
parent
872661a926
commit
6cf6286fb8
@ -100,4 +100,5 @@ class Authority {
|
|||||||
|
|
||||||
const auth = (new Authority);
|
const auth = (new Authority);
|
||||||
|
|
||||||
|
export { Authority };
|
||||||
export default auth;
|
export default auth;
|
||||||
|
@ -17,25 +17,25 @@ class Blacklist {
|
|||||||
this._signatures = [];
|
this._signatures = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public clear_before (date: Date) {
|
public clear_before (date: Date):void {
|
||||||
for (let i = this._signatures.length - 1; i >= 0; i--) {
|
for (let i = this._signatures.length - 1; i >= 0; i--) {
|
||||||
if (this._signatures[i].iat < date)
|
if (this._signatures[i].iat < date)
|
||||||
this._signatures.splice (i, 1);
|
this._signatures.splice (i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public add_signature (hash: string) {
|
public add_signature (hash: string):void {
|
||||||
this._signatures.push ({ iat: (new Date), hash });
|
this._signatures.push ({ iat: (new Date), hash });
|
||||||
}
|
}
|
||||||
|
|
||||||
public remove_signature (hash:string) {
|
public remove_signature (hash:string):void {
|
||||||
for (let i = this._signatures.length - 1; i >= 0; i--) {
|
for (let i = this._signatures.length - 1; i >= 0; i--) {
|
||||||
if (this._signatures[i].hash === hash)
|
if (this._signatures[i].hash === hash)
|
||||||
this._signatures.splice (i, 1);
|
this._signatures.splice (i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public is_valid (hash: string) {
|
public is_valid (hash: string):boolean {
|
||||||
for (const sig of this._signatures) {
|
for (const sig of this._signatures) {
|
||||||
if (sig.hash === hash)
|
if (sig.hash === hash)
|
||||||
return false;
|
return false;
|
||||||
@ -46,4 +46,6 @@ class Blacklist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bl = (new Blacklist);
|
const bl = (new Blacklist);
|
||||||
|
|
||||||
|
export { Blacklist };
|
||||||
export default bl;
|
export default bl;
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
"LICENSE",
|
"LICENSE",
|
||||||
"*.js",
|
"*.js",
|
||||||
"*.ts",
|
"*.ts",
|
||||||
"*.d.ts"
|
"*.d.ts",
|
||||||
|
"*.map"
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"authentication",
|
"authentication",
|
||||||
|
@ -9,5 +9,6 @@
|
|||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
}
|
},
|
||||||
|
"exclude": ["test/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user