MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / resolveAuthHint

Function resolveAuthHint

apps/cloud/src/auth/ssr-gate.ts:112–142  ·  view source on GitHub ↗
(
  session: VerifiedSession,
  cookieHeader: string | null,
)

Source from the content-addressed store, hash-verified

110 * fields (which would ping-pong with the client's authoritative write).
111 */
112const resolveAuthHint = async (
113 session: VerifiedSession,
114 cookieHeader: string | null,
115): Promise<{ hint: AuthHint; mint: boolean }> => {
116 const existing = decodeAuthHint(parseCookie(cookieHeader, AUTH_HINT_COOKIE));
117 if (
118 existing &&
119 existing.user.id === session.userId &&
120 (existing.organization?.id ?? null) === session.organizationId
121 ) {
122 return { hint: existing, mint: false };
123 }
124 return {
125 hint: {
126 v: 1,
127 user: {
128 id: session.userId,
129 email: session.email,
130 name: session.name,
131 avatarUrl: session.avatarUrl,
132 },
133 organization: session.organizationId
134 ? {
135 id: session.organizationId,
136 ...(await organizationDisplay(session.organizationId)),
137 }
138 : null,
139 },
140 mint: true,
141 };
142};
143
144// The sealed session carries the org ID but not its name/slug; the local
145// mirror has both (every org row is born with a slug — see

Callers 1

ssr-gate.tsFile · 0.85

Calls 3

decodeAuthHintFunction · 0.90
parseCookieFunction · 0.90
organizationDisplayFunction · 0.85

Tested by

no test coverage detected