diff options
Diffstat (limited to 'src/lib/token.ts')
-rw-r--r-- | src/lib/token.ts | 9 |
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(); |