MCPcopy Create free account
hub / github.com/MemTensor/MemOS / isValidSession

Method isValidSession

packages/memos-core/src/viewer/server.ts:271–280  ·  view source on GitHub ↗
(req: http.IncomingMessage)

Source from the content-addressed store, hash-verified

269 }
270
271 private isValidSession(req: http.IncomingMessage): boolean {
272 const cookie = req.headers.cookie ?? "";
273 const re = new RegExp(`${this.cookieName}=([a-f0-9]+)`);
274 const match = cookie.match(re);
275 if (!match) return false;
276 const expiry = this.auth.sessions.get(match[1]);
277 if (!expiry) return false;
278 if (Date.now() > expiry) { this.auth.sessions.delete(match[1]); return false; }
279 return true;
280 }
281
282 private get needsSetup(): boolean {
283 return this.auth.passwordHash === null;

Callers 1

handleRequestMethod · 0.95

Calls 3

matchMethod · 0.80
getMethod · 0.65
deleteMethod · 0.45

Tested by

no test coverage detected