Merge fix/session-subject-required: require readSubject on the external session owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
donghyeon-ka
2026-09-27 13:32:40 +09:00
co-authored by Claude Opus 5.5
10 changed files with 250 additions and 50 deletions
+10 -8
View File
@@ -7,15 +7,17 @@ export type SessionState =
export type SessionGateway = Readonly<{
getState(): SessionState;
/**
* Optional opaque identifier of the signed-in subject. The server-state scope
* fences only when (state, subject) changes, so a token refresh does not clear
* the cache. Return a non-empty string that is stable for one user across
* refreshes and differs between users (for example a hashed account id), or
* `null` when nobody is signed in. Never return a token or other credential.
* An authenticated session that returns `null`, `""` or omits this is treated
* as possibly switched: every notification fences and clears server state.
* Opaque identifier of the signed-in subject. The server-state scope fences
* only when (state, subject) changes, so a token refresh does not clear the
* cache. Return a non-empty string that is stable for one user across
* refreshes and differs between users (OIDC `sub`, Supabase
* `session.user.id`, Firebase `user.uid`), or `null` when nobody is signed
* in. Never return a token or other credential. An authenticated session that
* returns `null` or `""` is treated as possibly switched: every notification
* fences, clears server state and records `cache.operation.failed` with
* reason `SUBJECT_MISSING`.
*/
getSubject?(): string | null;
getSubject(): string | null;
subscribe(listener: () => void): () => void;
beginSignIn(returnTo?: string): Promise<void>;
signOut(): Promise<void>;