MCPcopy Create free account
hub / github.com/tiann/hapi / resolveSessionAccess

Method resolveSessionAccess

hub/src/sync/sessionCache.ts:47–60  ·  view source on GitHub ↗
(
        sessionId: string,
        namespace: string
    )

Source from the content-addressed store, hash-verified

45 }
46
47 resolveSessionAccess(
48 sessionId: string,
49 namespace: string
50 ): { ok: true; sessionId: string; session: Session } | { ok: false; reason: 'not-found' | 'access-denied' } {
51 const session = this.sessions.get(sessionId) ?? this.refreshSession(sessionId)
52 if (session) {
53 if (session.namespace !== namespace) {
54 return { ok: false, reason: 'access-denied' }
55 }
56 return { ok: true, sessionId, session }
57 }
58
59 return { ok: false, reason: 'not-found' }
60 }
61
62 getActiveSessions(): Session[] {
63 return this.getSessions().filter((session) => session.active)

Callers

nothing calls this directly

Calls 2

refreshSessionMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected