@cfxlabsinc/b2b-services
    Preparing search index...

    One dashboard's server-side sessions, satisfying the SessionStore the dashboards inject; table picks the dashboard. It mints each session's id and cookie, and stores only the id's hash and the values encrypted under a key the id derives. Pass a WRITER db: a replica read can miss a row just created on the writer and sign a fresh session out. Methods throw on infrastructure failure instead of returning Result, since the store contract has no functional errors.

    Index
    • Starts a session under a new id. Returns the id and the cookie naming it, which expires with the row maxAgeSeconds from now. adminUserId marks CFX staff signed in through cfx-admin; omitted, a member.

      Parameters

      • __namedParameters: {
            adminUserId?: string | null;
            client: SessionClient;
            cognitoSub: string;
            email: string;
            maxAgeSeconds: number;
            method: SignInMethod;
            now?: Date;
            values: SessionValues;
        }

      Returns Promise<{ cookie: string; id: string }>

    • Ends a live session; the row stays. Idempotent: an ended or unknown one is a no-op.

      Parameters

      • __namedParameters: { id: string; reason: "replaced" | "signed-out" | "expired" | "revoked" }

      Returns Promise<void>

    • Ends, as REVOKED, every live session of cognitoSub but keepId's. Not Cognito GlobalSignOut: it would kill the kept session's refresh token too, and an ended row's tokens are gone with its encryptedTokens, which only that browser's cookie could open.

      Parameters

      • __namedParameters: { cognitoSub: string; keepId: string }

      Returns Promise<{ ended: number }>

    • Ends, as REVOKED, every live session a staff admin user signed in to this dashboard: for when the admin user is disabled or loses user-shadow:r.

      Parameters

      • __namedParameters: { adminUserId: string }

      Returns Promise<{ ended: number }>

    • The live session, neither expired nor idle, or null; so is a row that won't unseal under id. adminUserId names the pool that issued it.

      Parameters

      • __namedParameters: { id: string }

      Returns Promise<
          | { adminUserId: string
          | null; expiresAt: Date; values: SessionValues }
          | null,
      >