diff --git a/src/session/mod.ts b/src/session/mod.ts index dfd1f43..17c6b59 100644 --- a/src/session/mod.ts +++ b/src/session/mod.ts @@ -11,7 +11,7 @@ export class SessionStore { static get maxAge() { const halfHour = 30 * 60 * 1_000 - return Date.now() - halfHour + return Date.now() + halfHour } static createSession(): Session { return new Session(this.#store) @@ -19,13 +19,15 @@ export class SessionStore { static getSession(uuid: string): Session | undefined { // Check session validity + const halfHour = 30 * 60 * 1_000 + const maxOld = Date.now() - halfHour const session = this.#store.get(uuid) if (session === undefined) { return undefined } - if (session.timestamp < this.maxAge) { + if (session.timestamp < maxOld) { session.destroy() return undefined }