docs(auth): document what readSubject must return and the fail-closed default (R3-3)

readSubject/getSubject must be an opaque, non-empty id that is stable per
user and never a token. Without it, every authenticated notification
clears server state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-24 15:15:26 +09:00
co-authored by Claude Opus 5.5
parent 55721f075a
commit e0b20f50db
2 changed files with 19 additions and 2 deletions
+5 -2
View File
@@ -9,8 +9,11 @@ export type SessionGateway = Readonly<{
/**
* 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. An authenticated session that returns `null` or omits this is
* treated as possibly switched and still fences on every notification.
* 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.
*/
getSubject?(): string | null;
subscribe(listener: () => void): () => void;