From 2c7ede141d66fb1340e404ed3d7bea4f86b1df86 Mon Sep 17 00:00:00 2001 From: damnmicrowave <34608186+damnmicrowave@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:58:30 +0200 Subject: [PATCH 1/3] fix: `exp` type & overriding default `exp` value --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 0e70509..14023f7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,7 +22,7 @@ export interface JWTPayloadSpec { aud?: string | string[] jti?: string nbf?: number - exp?: number + exp?: number | string iat?: number } @@ -145,6 +145,7 @@ JWTOption) => { if (nbf) jwt = jwt.setNotBefore(nbf) if (exp) jwt = jwt.setExpirationTime(exp) + if (morePayload.exp) jwt = jwt.setExpirationTime(morePayload.exp) return jwt.sign(key) }, From 60ca3ef51d43eb74acc074dd261de57487cfcb18 Mon Sep 17 00:00:00 2001 From: damnmicrowave <34608186+damnmicrowave@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:05:15 +0200 Subject: [PATCH 2/3] Update index.ts --- src/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index d87df88..3b46e81 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,13 +17,13 @@ type UnwrapSchema< > = Schema extends TSchema ? Static> : Fallback export interface JWTPayloadSpec { - iss?: string - sub?: string - aud?: string | string[] - jti?: string - nbf?: number - exp?: number | string - iat?: number + iss?: string + sub?: string + aud?: string | string[] + jti?: string + nbf?: number + exp?: number + iat?: number } export interface JWTOption< From 31eaa9cb368b8a75ef7b2c8a8d2b55dfff0b947d Mon Sep 17 00:00:00 2001 From: damnmicrowave <34608186+damnmicrowave@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:06:09 +0200 Subject: [PATCH 3/3] Update index.ts --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 3b46e81..a2123d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,7 +22,7 @@ export interface JWTPayloadSpec { aud?: string | string[] jti?: string nbf?: number - exp?: number + exp?: number | string iat?: number }