@idp.global/sdk 19.4.0 → 19.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,13 @@ import type { IOidcCompletion, TOidcCompletionFailureStage, TOidcPrompt, TOidcTo
2
2
  import type { TRelyingPartyBearerClientKind } from './contract.bearer.js';
3
3
 
4
4
  export type {
5
+ IRelyingPartyBearerClaimRequest,
5
6
  IRelyingPartyBearerErrorAnswer,
7
+ IRelyingPartyBearerLoginQuery,
6
8
  IRelyingPartyBearerLogoutAnswer,
9
+ IRelyingPartyBearerLogoutRequest,
7
10
  IRelyingPartyBearerMessage,
11
+ IRelyingPartyBearerRefreshRequest,
8
12
  IRelyingPartyBearerSessionAnswer,
9
13
  IRelyingPartyBearerSessionInfo,
10
14
  IRelyingPartyBearerTokenAnswer,
@@ -156,6 +160,37 @@ export interface IRelyingPartyBearerHandoff {
156
160
  expiresAt: number;
157
161
  }
158
162
 
163
+ /**
164
+ * A bearer session the application opened for a device it paired
165
+ * (`openBearerHandoff`): the session, which has no provider login of its own
166
+ * (`idpSubject` and `loginAttemptId` are absent), and the single-use code the
167
+ * device claims at `bearer/claim` with the verifier of its challenge. The
168
+ * code is no token; only its hash is stored.
169
+ */
170
+ export interface IRelyingPartyBearerHandoffOpening {
171
+ session: IRelyingPartySession;
172
+ code: string;
173
+ /** epoch milliseconds, at most `BEARER_HANDOFF_MAX_AGE_SECONDS` after the opening and never past the session */
174
+ expiresAt: number;
175
+ }
176
+
177
+ /**
178
+ * What `eraseSessionsOfPrincipal` removed of one principal: the sessions it
179
+ * ended first, and the rows it deleted.
180
+ */
181
+ export interface IRelyingPartySessionsErasure {
182
+ /** sessions not revoked yet (an expired one too) that it ended, each with `onSessionEnded` and its provider tokens handed back */
183
+ endedSessions: number;
184
+ /** session rows, live or ended */
185
+ deletedSessions: number;
186
+ /** the sign-in transactions the provider sessions came out of */
187
+ deletedLoginAttempts: number;
188
+ /** bearer hand-offs, claimed or not */
189
+ deletedBearerHandoffs: number;
190
+ /** bearer token generations, current or rotated */
191
+ deletedBearerTokens: number;
192
+ }
193
+
159
194
  /**
160
195
  * The relying party's own tokens of a bearer session. The refresh token
161
196
  * rotates on every use; a rotated one coming back ends the session.
@@ -298,20 +333,22 @@ export interface IRelyingPartyHooks {
298
333
  * A provider login opened a session, linked to its attempt. Runs before the
299
334
  * login answers; a throw fails the login: the session is revoked, the
300
335
  * provider tokens are handed back and the original error is rethrown.
336
+ * `delivery` is where a bearer login's outcome goes (its client kind, return
337
+ * target and the client's `state`); a cookie login has none.
301
338
  */
302
- onProviderSessionOpened?(eventArg: { session: IRelyingPartySession }): Promise<void>;
339
+ onProviderSessionOpened?(eventArg: { session: IRelyingPartySession; delivery?: IRelyingPartyBearerDelivery }): Promise<void>;
303
340
  /**
304
341
  * A session ended, or a caller tried to end one that was already over
305
342
  * (`revokedHere: false`). Close its live connections when `revokedHere`,
306
343
  * drop cached authority either way. Must not wait. A throw (or a rejected
307
344
  * promise) is reported as a `hook_failed` event and never stops the end:
308
- * the provider tokens go back regardless.
345
+ * the provider tokens go back regardless. An end that revoked the session
346
+ * here names its principal (`principalId`); one that found it over already
347
+ * does not.
309
348
  */
310
- onSessionEnded?(eventArg: {
311
- sessionId: string;
312
- reason: TRelyingPartySessionEndReason;
313
- revokedHere: boolean;
314
- }): void;
349
+ onSessionEnded?(eventArg:
350
+ | { sessionId: string; reason: TRelyingPartySessionEndReason; revokedHere: true; principalId: string }
351
+ | { sessionId: string; reason: TRelyingPartySessionEndReason; revokedHere: false }): void;
315
352
  /**
316
353
  * Structured diagnostics; the default writes one JSON line to
317
354
  * `console.error`. A throwing sink never interrupts the step that reported: