summaryrefslogtreecommitdiff
path: root/src/lib/token.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/token.ts')
-rw-r--r--src/lib/token.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/token.ts b/src/lib/token.ts
index 93ec0cf..f27df28 100644
--- a/src/lib/token.ts
+++ b/src/lib/token.ts
@@ -59,6 +59,15 @@ export default class Token {
return this.decode()?.exp;
}
+ expired() {
+ const exp = this.decode()?.exp;
+
+ if(!exp)
+ return true;
+
+ return exp < Math.floor(Date.now() / 1000);
+ }
+
private decode(): { data: string; aud: string; jti: string; exp: number; } | null {
const token = this.get();