MCPcopy
hub / github.com/garrytan/gstack / validatePtySessionToken

Function validatePtySessionToken

browse/src/pty-session-cookie.ts:49–62  ·  view source on GitHub ↗
(token: string | null | undefined)

Source from the content-addressed store, hash-verified

47 * every call so the registry stays bounded under reconnect pressure.
48 */
49export function validatePtySessionToken(token: string | null | undefined): boolean {
50 if (!token) return false;
51 const s = sessions.get(token);
52 if (!s) {
53 pruneExpired(Date.now());
54 return false;
55 }
56 if (Date.now() > s.expiresAt) {
57 sessions.delete(token);
58 pruneExpired(Date.now());
59 return false;
60 }
61 return true;
62}
63
64/**
65 * Drop a session token (called on WS close so a leaked cookie can't be

Callers 1

Calls 2

pruneExpiredFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected