auth.provider API
    Preparing search index...

    Interface SubjectSessionIndex

    Subject-keyed index of the session ids belonging to one principal (#296).

    Every other index here is keyed by sid — they answer "what does this session own?". This one answers the inverse, "what sessions does this subject have?", which is the question a credential change asks: the Store has just written a new password and every session established with the old one has to go, without the caller knowing a single sid.

    UserSessionStore cannot answer it — it is create / get(sid) / delete(sid) — so without this index revokeAllForSubject has nothing to enumerate.

    Mutability: append-only per (subject, sid), idempotent on duplicates. Per-member removal (removeSid) is exposed because a single session ending must not erase the subject's other sessions — unlike the sid-keyed indexes, where the whole key dies with the session.

    TTL contract: every addSid MUST be called with the session's expiresAt, so an abandoned session ages out of the index rather than accumulating against a long-lived user.

    interface SubjectSessionIndex {
        kind: string;
        addSid(subject: string, sid: string, expiresAt: Date): Promise<void>;
        listSids(subject: string): Promise<readonly string[]>;
        removeBySubject(subject: string): Promise<void>;
        removeSid(subject: string, sid: string): Promise<void>;
    }
    Index
    kind: string
    • Expiry encoding: Date per A4 two-tier design — see UserSession for rationale.

      Parameters

      • subject: string
      • sid: string
      • expiresAt: Date

      Returns Promise<void>

    • Remove one session from the subject's set, leaving the others.

      Parameters

      • subject: string
      • sid: string

      Returns Promise<void>