@entro314labs/entro-auth-ciba 0.0.0-stage → 1.8.0-beta.12

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.
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2024 - present, Bereket Engida
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the “Software”), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,638 @@
1
+ import { OAuthActorClaim, OAuthAuthorizationDetail, SchemaClient, Scope } from "@entro314labs/entro-auth-oauth-provider";
2
+ import { InferOptionSchema, User } from "@entro314labs/entro-auth/types";
3
+ import { Awaitable, GenericEndpointContext } from "@entro314labs/entro-auth-core";
4
+ /**
5
+ * A backchannel authentication request.
6
+ *
7
+ * Lifecycle: `pending` -> `approved` | `denied`. The token-endpoint poll
8
+ * atomically claims and deletes an approved request (single-use); denied or
9
+ * expired requests are deleted when the client next polls.
10
+ */
11
+ declare const schema: {
12
+ cibaRequest: {
13
+ fields: {
14
+ /**
15
+ * The `auth_req_id`, hashed with the OAuth provider's token storage. The
16
+ * raw value is returned to the client and never stored.
17
+ */
18
+ authReqId: {
19
+ type: "string";
20
+ unique: true;
21
+ required: true;
22
+ };
23
+ clientId: {
24
+ type: "string";
25
+ required: true;
26
+ references: {
27
+ model: string;
28
+ field: string;
29
+ };
30
+ index: true;
31
+ };
32
+ /** The user the `login_hint` identified, the only one who may decide. */
33
+ userId: {
34
+ type: "string";
35
+ required: true;
36
+ references: {
37
+ model: string;
38
+ field: string;
39
+ };
40
+ index: true;
41
+ };
42
+ /** Requested scopes, narrowed to the approved ones on approval. */
43
+ scope: {
44
+ type: "string";
45
+ required: true;
46
+ };
47
+ bindingMessage: {
48
+ type: "string";
49
+ required: false;
50
+ };
51
+ /** ACR values the client requested with `acr_values`, in order. */
52
+ acrValues: {
53
+ type: "string[]";
54
+ required: false;
55
+ };
56
+ /**
57
+ * RFC 9396 authorization details the client requested, narrowed to the
58
+ * granted ones on approval. A JSON array, stored as text: a `json`
59
+ * field is not portable for a top-level array.
60
+ */
61
+ authorizationDetails: {
62
+ type: "string";
63
+ required: false;
64
+ };
65
+ /** RFC 8707 resource indicators the issued token is bound to. */
66
+ resources: {
67
+ type: "string[]";
68
+ required: false;
69
+ };
70
+ /**
71
+ * RFC 8693 `act` claim `resolveActor` returned for the request, issued in
72
+ * the access token so it names the user as `sub` and the actor as `act`.
73
+ */
74
+ actor: {
75
+ type: "json";
76
+ required: false;
77
+ };
78
+ /** One of `pending`, `approved`, `denied`. */
79
+ status: {
80
+ type: "string";
81
+ required: true;
82
+ };
83
+ /**
84
+ * Ping mode only: the client's registered notification endpoint when the
85
+ * request started, which the ping callback calls.
86
+ */
87
+ clientNotificationEndpoint: {
88
+ type: "string";
89
+ required: false;
90
+ };
91
+ /**
92
+ * Ping mode only: the client's `client_notification_token` (CIBA §7.1),
93
+ * encrypted with the server secret, sent back on the ping callback.
94
+ */
95
+ encryptedClientNotificationToken: {
96
+ type: "string";
97
+ required: false;
98
+ };
99
+ /**
100
+ * Ping mode only: the `auth_req_id`, encrypted with the server secret,
101
+ * because the ping callback carries the raw value (CIBA §10.2).
102
+ */
103
+ encryptedAuthReqId: {
104
+ type: "string";
105
+ required: false;
106
+ };
107
+ /** Consent reference the approval recorded, such as an organization. */
108
+ referenceId: {
109
+ type: "string";
110
+ required: false;
111
+ };
112
+ /**
113
+ * Set when the user approved on the consent page, which stored a
114
+ * consent. Redeeming the request then needs that consent to still cover
115
+ * it. `completeCibaRequest` stores no consent and leaves this unset.
116
+ */
117
+ approvedViaConsent: {
118
+ type: "boolean";
119
+ required: false;
120
+ };
121
+ /**
122
+ * Creation time of the approving session, or the time server-side
123
+ * completion states, issued as `auth_time`.
124
+ */
125
+ authTime: {
126
+ type: "date";
127
+ required: false;
128
+ };
129
+ /** The `acr` the approval established, issued in the ID token. */
130
+ acr: {
131
+ type: "string";
132
+ required: false;
133
+ };
134
+ /** The `amr` the approval established, issued in the ID token. */
135
+ amr: {
136
+ type: "string[]";
137
+ required: false;
138
+ };
139
+ lastPolledAt: {
140
+ type: "date";
141
+ required: false;
142
+ };
143
+ expiresAt: {
144
+ type: "date";
145
+ required: true;
146
+ index: true;
147
+ };
148
+ createdAt: {
149
+ type: "date";
150
+ required: true;
151
+ };
152
+ };
153
+ };
154
+ };
155
+ /** CIBA token delivery modes this plugin implements (CIBA §5). */
156
+ type CibaDeliveryMode = "poll" | "ping";
157
+ /** An authorization details type clients may request. */
158
+ interface CibaAuthorizationDetailsType {
159
+ /**
160
+ * Return `true` when the detail is valid for this type. Check every field,
161
+ * and reject unknown fields, invalid values, and missing required fields
162
+ * (RFC 9396 §5): the client receives `invalid_authorization_details`. Runs
163
+ * for each detail a client requests and each one server code approves
164
+ * through `completeCibaRequest`.
165
+ */
166
+ validate: (detail: OAuthAuthorizationDetail, input: {
167
+ client: SchemaClient<Scope[]>;
168
+ }, ctx: GenericEndpointContext) => Awaitable<boolean>;
169
+ }
170
+ /**
171
+ * A request still waiting for the user's decision: what to show the user
172
+ * before they approve or deny it. {@link CibaNotification} carries it, and
173
+ * `auth.api.getCibaRequest` reads it on your own approval page.
174
+ */
175
+ interface CibaPendingRequest {
176
+ /**
177
+ * Identifies the request to `auth.api.getCibaRequest` and
178
+ * `auth.api.completeCibaRequest`, for a deployment that lets the user
179
+ * decide in its own page or app.
180
+ */
181
+ requestId: string;
182
+ clientId: string;
183
+ /** Registered display name of the client, when it has one. */
184
+ clientName?: string | undefined;
185
+ /** The scopes the client requested. */
186
+ scopes: string[];
187
+ /** The RFC 8707 resources the client requested the token for. */
188
+ resources?: string[] | undefined;
189
+ /**
190
+ * Text the client also shows (CIBA §7.1). Display it so the user can
191
+ * confirm the request is the one they expect.
192
+ */
193
+ bindingMessage?: string | undefined;
194
+ /**
195
+ * ACR values the client requested with `acr_values`, in order of
196
+ * preference. A voluntary request: authenticate the user as strongly as
197
+ * these ask when you can, and state what the user actually proved as `acr`
198
+ * when completing the request.
199
+ */
200
+ acrValues?: string[] | undefined;
201
+ /**
202
+ * RFC 9396 details of what the client asks to do, such as a payment to
203
+ * approve. Show them to the user before they decide.
204
+ */
205
+ authorizationDetails?: OAuthAuthorizationDetail[] | undefined;
206
+ /**
207
+ * Who acts for the user when the request is approved, as
208
+ * {@link CibaOptions.resolveActor} returned it. Show it, so the user knows
209
+ * the tokens go to that actor and not to them.
210
+ */
211
+ actor?: OAuthActorClaim | undefined;
212
+ expiresAt: Date;
213
+ }
214
+ /**
215
+ * What {@link CibaOptions.sendNotification} receives to reach the user on a
216
+ * separate device.
217
+ */
218
+ interface CibaNotification extends CibaPendingRequest {
219
+ /** The user the client's `login_hint` identified. */
220
+ user: User;
221
+ /**
222
+ * Absolute link for the user to approve or deny the request. By default it
223
+ * opens the provider's sign-in and consent pages; with
224
+ * {@link CibaOptions.approvalPage} it opens that page, with the request as
225
+ * `ciba_request_id`. Absent when `approvalPage` is `false`.
226
+ */
227
+ url?: string | undefined;
228
+ }
229
+ /**
230
+ * Where the user approves a request: the provider's pages by default, or your
231
+ * own approval path.
232
+ */
233
+ type CibaApprovalOptions = {
234
+ approvalPage?: undefined;
235
+ /**
236
+ * Path or URL of the page the user lands on after deciding through the
237
+ * provider's pages, with `status=approved` or `status=denied`, or with
238
+ * `error` and `error_description` when the link is invalid, expired,
239
+ * or for another account.
240
+ */
241
+ resultPage: string;
242
+ } | {
243
+ /**
244
+ * Approve requests on your own path instead of the provider's sign-in
245
+ * and consent pages: read each request with `auth.api.getCibaRequest`,
246
+ * and record the decision with `auth.api.completeCibaRequest`. A path or URL becomes the
247
+ * notification's `url`, with the request as `ciba_request_id`; `false`
248
+ * sends no `url`, such as when your own app shows the request. Either
249
+ * way, `/oauth2/authorize` no longer approves CIBA requests, so the
250
+ * provider's consent page cannot bypass your checks.
251
+ */
252
+ approvalPage: string | false;
253
+ resultPage?: never;
254
+ };
255
+ /** Options for {@link ciba}. */
256
+ type CibaOptions = CibaSharedOptions & CibaApprovalOptions;
257
+ /** {@link CibaOptions} that do not depend on where the user approves. */
258
+ interface CibaSharedOptions {
259
+ /**
260
+ * Tell the user about a new request on a channel they trust, such as email
261
+ * or a push notification, and include `url` when the notification has one. Runs in the background when
262
+ * `advanced.backgroundTasks` is configured and is awaited otherwise. A
263
+ * failure is logged, and the client still receives its `auth_req_id`.
264
+ */
265
+ sendNotification: (notification: CibaNotification, ctx: GenericEndpointContext) => Awaitable<void>;
266
+ /**
267
+ * Find the user a `login_hint` identifies. Defaults to an email lookup.
268
+ * Return `null` when no user matches, and the client receives
269
+ * `unknown_user_id`. Receives the requesting client, so a deployment with
270
+ * open client registration can resolve only identifiers that client was
271
+ * already given, such as its pairwise `sub`.
272
+ */
273
+ resolveUser?: (input: {
274
+ loginHint: string;
275
+ client: SchemaClient<Scope[]>;
276
+ }, ctx: GenericEndpointContext) => Awaitable<User | null>;
277
+ /**
278
+ * Name who will act for the user, so the access token is a delegated token
279
+ * (RFC 8693 §4.1): `sub` is the user, and `act` is the returned actor. Runs
280
+ * at `/oauth2/bc-authorize` after the client authenticates and the user is
281
+ * found, and the actor is stored with the request. Return `undefined` for a
282
+ * token without `act`, or throw an `APIError` to refuse the request with
283
+ * that error.
284
+ *
285
+ * The actor is the server's own assertion, so return only an actor you have
286
+ * verified, such as the authenticated client itself or an agent whose
287
+ * credential the request carries in `ctx.request`. Set
288
+ * `sub_profile: "service"` on a client or agent actor, or a pairwise client
289
+ * reads its `sub` as a user's pairwise subject.
290
+ *
291
+ * A delegated token gets no refresh token, because refreshed tokens would
292
+ * not carry `act`, so the returned scope leaves out `offline_access`.
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * // The client is an agent acting for the user it names.
297
+ * resolveActor: ({ client }) => ({
298
+ * sub: client.clientId,
299
+ * sub_profile: "service",
300
+ * }),
301
+ * ```
302
+ */
303
+ resolveActor?: (input: {
304
+ client: SchemaClient<Scope[]>;
305
+ user: User;
306
+ scopes: string[];
307
+ }, ctx: GenericEndpointContext) => Awaitable<OAuthActorClaim | undefined>;
308
+ /**
309
+ * Token delivery modes clients may register for, as
310
+ * `backchannel_token_delivery_mode` (CIBA §4). In `ping` mode the server
311
+ * also calls the client's `backchannel_client_notification_endpoint` once
312
+ * the user decides.
313
+ *
314
+ * @default ["poll"]
315
+ */
316
+ deliveryModes?: CibaDeliveryMode[];
317
+ /**
318
+ * Lifetime of a request, in seconds. A client may ask for less with
319
+ * `requested_expiry`.
320
+ *
321
+ * @default 300
322
+ */
323
+ expiresIn?: number;
324
+ /**
325
+ * Minimum time between token polls, in seconds. Returned as `interval`;
326
+ * faster polls receive `slow_down`.
327
+ *
328
+ * @default 5
329
+ */
330
+ interval?: number;
331
+ /**
332
+ * RFC 9396 authorization details types clients may request with
333
+ * `authorization_details`, keyed by `type` and advertised as
334
+ * `authorization_details_types_supported`. Without it, a request that
335
+ * carries `authorization_details` fails with `invalid_authorization_details`.
336
+ *
337
+ * Granted details are returned in the token response and as the
338
+ * `authorization_details` claim of a JWT access token, or at introspection
339
+ * of an opaque one. Refreshed tokens would not carry them, so such a request
340
+ * is issued no refresh token.
341
+ *
342
+ * @example
343
+ * ```ts
344
+ * authorizationDetailsTypes: {
345
+ * payment_initiation: {
346
+ * // A `z.strictObject`, so unknown fields fail.
347
+ * validate: (detail) => paymentSchema.safeParse(detail).success,
348
+ * },
349
+ * }
350
+ * ```
351
+ */
352
+ authorizationDetailsTypes?: Record<string, CibaAuthorizationDetailsType>;
353
+ /** Rename the `cibaRequest` model or its fields. */
354
+ schema?: InferOptionSchema<typeof schema>;
355
+ }
356
+ /**
357
+ * OAuth grant type for the CIBA token-delivery poll, registered with the OAuth
358
+ * provider's token endpoint.
359
+ *
360
+ * @see https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html#rfc.section.7.3
361
+ */
362
+ export declare const CIBA_GRANT_TYPE = "urn:openid:params:grant-type:ciba";
363
+ /**
364
+ * Error descriptions for the backchannel authentication endpoint (CIBA §13),
365
+ * the token poll (CIBA §11), and the approval link.
366
+ */
367
+ export declare const CIBA_ERROR_CODES: {
368
+ INVALID_SCOPE: import("@entro314labs/entro-auth").RawError<"INVALID_SCOPE">;
369
+ RESOURCE_DROPS_OPENID: import("@entro314labs/entro-auth").RawError<"RESOURCE_DROPS_OPENID">;
370
+ UNAPPROVED_RESOURCE: import("@entro314labs/entro-auth").RawError<"UNAPPROVED_RESOURCE">;
371
+ INVALID_BINDING_MESSAGE: import("@entro314labs/entro-auth").RawError<"INVALID_BINDING_MESSAGE">;
372
+ UNKNOWN_USER_ID: import("@entro314labs/entro-auth").RawError<"UNKNOWN_USER_ID">;
373
+ EXACTLY_ONE_HINT: import("@entro314labs/entro-auth").RawError<"EXACTLY_ONE_HINT">;
374
+ UNSUPPORTED_HINT: import("@entro314labs/entro-auth").RawError<"UNSUPPORTED_HINT">;
375
+ UNSUPPORTED_DELIVERY_MODE: import("@entro314labs/entro-auth").RawError<"UNSUPPORTED_DELIVERY_MODE">;
376
+ NOTIFICATION_TOKEN_REQUIRED: import("@entro314labs/entro-auth").RawError<"NOTIFICATION_TOKEN_REQUIRED">;
377
+ INVALID_AUTH_REQ_ID: import("@entro314labs/entro-auth").RawError<"INVALID_AUTH_REQ_ID">;
378
+ EXPIRED_AUTH_REQ_ID: import("@entro314labs/entro-auth").RawError<"EXPIRED_AUTH_REQ_ID">;
379
+ AUTHORIZATION_PENDING: import("@entro314labs/entro-auth").RawError<"AUTHORIZATION_PENDING">;
380
+ POLLING_TOO_FREQUENTLY: import("@entro314labs/entro-auth").RawError<"POLLING_TOO_FREQUENTLY">;
381
+ ACCESS_DENIED: import("@entro314labs/entro-auth").RawError<"ACCESS_DENIED">;
382
+ USER_NOT_FOUND: import("@entro314labs/entro-auth").RawError<"USER_NOT_FOUND">;
383
+ UNKNOWN_REQUEST: import("@entro314labs/entro-auth").RawError<"UNKNOWN_REQUEST">;
384
+ SCOPE_NOT_REQUESTED: import("@entro314labs/entro-auth").RawError<"SCOPE_NOT_REQUESTED">;
385
+ INVALID_AUTHORIZATION_DETAILS: import("@entro314labs/entro-auth").RawError<"INVALID_AUTHORIZATION_DETAILS">;
386
+ AUTHORIZATION_DETAILS_ON_POLL: import("@entro314labs/entro-auth").RawError<"AUTHORIZATION_DETAILS_ON_POLL">;
387
+ INVALID_ACTOR: import("@entro314labs/entro-auth").RawError<"INVALID_ACTOR">;
388
+ UNSUPPORTED_ACR: import("@entro314labs/entro-auth").RawError<"UNSUPPORTED_ACR">;
389
+ };
390
+ declare module "@entro314labs/entro-auth-core" {
391
+ interface EntroAuthPluginRegistry<AuthOptions, Options> {
392
+ ciba: {
393
+ creator: typeof ciba;
394
+ };
395
+ }
396
+ }
397
+ /**
398
+ * OpenID Connect Client-Initiated Backchannel Authentication (CIBA) for
399
+ * `oauthProvider()`. A client names a user with `login_hint` at
400
+ * `/oauth2/bc-authorize`, the user approves on their own device, and the
401
+ * client collects tokens at the token endpoint, by polling or after a ping
402
+ * callback (`deliveryModes`). The user approves through the provider's
403
+ * sign-in and consent pages, or only through your own path with
404
+ * `approvalPage` and `completeCibaRequest`.
405
+ *
406
+ * Requires the `oauth-provider` and `jwt` plugins.
407
+ *
408
+ * @see https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0.html
409
+ */
410
+ export declare const ciba: (options: CibaOptions) => {
411
+ id: "ciba";
412
+ version: string;
413
+ schema: {
414
+ cibaRequest: {
415
+ fields: {
416
+ authReqId: {
417
+ type: "string";
418
+ unique: true;
419
+ required: true;
420
+ };
421
+ clientId: {
422
+ type: "string";
423
+ required: true;
424
+ references: {
425
+ model: string;
426
+ field: string;
427
+ };
428
+ index: true;
429
+ };
430
+ userId: {
431
+ type: "string";
432
+ required: true;
433
+ references: {
434
+ model: string;
435
+ field: string;
436
+ };
437
+ index: true;
438
+ };
439
+ scope: {
440
+ type: "string";
441
+ required: true;
442
+ };
443
+ bindingMessage: {
444
+ type: "string";
445
+ required: false;
446
+ };
447
+ acrValues: {
448
+ type: "string[]";
449
+ required: false;
450
+ };
451
+ authorizationDetails: {
452
+ type: "string";
453
+ required: false;
454
+ };
455
+ resources: {
456
+ type: "string[]";
457
+ required: false;
458
+ };
459
+ actor: {
460
+ type: "json";
461
+ required: false;
462
+ };
463
+ status: {
464
+ type: "string";
465
+ required: true;
466
+ };
467
+ clientNotificationEndpoint: {
468
+ type: "string";
469
+ required: false;
470
+ };
471
+ encryptedClientNotificationToken: {
472
+ type: "string";
473
+ required: false;
474
+ };
475
+ encryptedAuthReqId: {
476
+ type: "string";
477
+ required: false;
478
+ };
479
+ referenceId: {
480
+ type: "string";
481
+ required: false;
482
+ };
483
+ approvedViaConsent: {
484
+ type: "boolean";
485
+ required: false;
486
+ };
487
+ authTime: {
488
+ type: "date";
489
+ required: false;
490
+ };
491
+ acr: {
492
+ type: "string";
493
+ required: false;
494
+ };
495
+ amr: {
496
+ type: "string[]";
497
+ required: false;
498
+ };
499
+ lastPolledAt: {
500
+ type: "date";
501
+ required: false;
502
+ };
503
+ expiresAt: {
504
+ type: "date";
505
+ required: true;
506
+ index: true;
507
+ };
508
+ createdAt: {
509
+ type: "date";
510
+ required: true;
511
+ };
512
+ };
513
+ };
514
+ };
515
+ init(ctx: import("@entro314labs/entro-auth-core").AuthContext): void;
516
+ endpoints: {
517
+ bcAuthorize: import("better-call").StrictEndpoint<"/oauth2/bc-authorize", {
518
+ method: "POST";
519
+ body: import("zod").ZodObject<{
520
+ client_id: import("zod").ZodOptional<import("zod").ZodString>;
521
+ client_secret: import("zod").ZodOptional<import("zod").ZodString>;
522
+ client_assertion: import("zod").ZodOptional<import("zod").ZodString>;
523
+ client_assertion_type: import("zod").ZodOptional<import("zod").ZodString>;
524
+ scope: import("zod").ZodString;
525
+ login_hint: import("zod").ZodOptional<import("zod").ZodString>;
526
+ id_token_hint: import("zod").ZodOptional<import("zod").ZodString>;
527
+ login_hint_token: import("zod").ZodOptional<import("zod").ZodString>;
528
+ binding_message: import("zod").ZodOptional<import("zod").ZodString>;
529
+ acr_values: import("zod").ZodOptional<import("zod").ZodString>;
530
+ authorization_details: import("zod").ZodOptional<import("zod").ZodString>;
531
+ client_notification_token: import("zod").ZodOptional<import("zod").ZodString>;
532
+ requested_expiry: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
533
+ resource: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
534
+ }, import("zod/v4/core").$strip>;
535
+ formParams: {
536
+ repeatable: string[];
537
+ };
538
+ errorCodesByField: {
539
+ binding_message: "invalid_binding_message";
540
+ authorization_details: "invalid_authorization_details";
541
+ resource: {
542
+ invalid: "invalid_target";
543
+ };
544
+ };
545
+ metadata: {
546
+ noStore: boolean;
547
+ allowedMediaTypes: string[];
548
+ openapi: {
549
+ description: string;
550
+ responses: {
551
+ "200": {
552
+ description: string;
553
+ content: {
554
+ "application/json": {
555
+ schema: {
556
+ type: "object";
557
+ properties: {
558
+ auth_req_id: {
559
+ type: string;
560
+ };
561
+ expires_in: {
562
+ type: string;
563
+ };
564
+ interval: {
565
+ type: string;
566
+ };
567
+ };
568
+ required: string[];
569
+ };
570
+ };
571
+ };
572
+ };
573
+ };
574
+ };
575
+ };
576
+ }, {
577
+ auth_req_id: string;
578
+ expires_in: number;
579
+ interval: number;
580
+ }>;
581
+ getCibaRequest: import("better-call").StrictEndpoint<string, {
582
+ method: "POST";
583
+ body: import("zod").ZodObject<{
584
+ requestId: import("zod").ZodString;
585
+ userId: import("zod").ZodString;
586
+ }, import("zod/v4/core").$strip>;
587
+ }, CibaPendingRequest | null>;
588
+ completeCibaRequest: import("better-call").StrictEndpoint<string, {
589
+ method: "POST";
590
+ body: import("zod").ZodObject<{
591
+ requestId: import("zod").ZodString;
592
+ userId: import("zod").ZodString;
593
+ decision: import("zod").ZodEnum<{
594
+ approved: "approved";
595
+ denied: "denied";
596
+ }>;
597
+ scopes: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
598
+ authTime: import("zod").ZodOptional<import("zod").ZodDate>;
599
+ acr: import("zod").ZodOptional<import("zod").ZodString>;
600
+ amr: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
601
+ authorizationDetails: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
602
+ type: import("zod").ZodString;
603
+ }, import("zod/v4/core").$loose>>>;
604
+ }, import("zod/v4/core").$strip>;
605
+ }, {
606
+ status: boolean;
607
+ }>;
608
+ };
609
+ rateLimit: {
610
+ pathMatcher: (path: string) => path is "/oauth2/bc-authorize";
611
+ window: number;
612
+ max: number;
613
+ }[];
614
+ $ERROR_CODES: {
615
+ INVALID_SCOPE: import("@entro314labs/entro-auth").RawError<"INVALID_SCOPE">;
616
+ RESOURCE_DROPS_OPENID: import("@entro314labs/entro-auth").RawError<"RESOURCE_DROPS_OPENID">;
617
+ UNAPPROVED_RESOURCE: import("@entro314labs/entro-auth").RawError<"UNAPPROVED_RESOURCE">;
618
+ INVALID_BINDING_MESSAGE: import("@entro314labs/entro-auth").RawError<"INVALID_BINDING_MESSAGE">;
619
+ UNKNOWN_USER_ID: import("@entro314labs/entro-auth").RawError<"UNKNOWN_USER_ID">;
620
+ EXACTLY_ONE_HINT: import("@entro314labs/entro-auth").RawError<"EXACTLY_ONE_HINT">;
621
+ UNSUPPORTED_HINT: import("@entro314labs/entro-auth").RawError<"UNSUPPORTED_HINT">;
622
+ UNSUPPORTED_DELIVERY_MODE: import("@entro314labs/entro-auth").RawError<"UNSUPPORTED_DELIVERY_MODE">;
623
+ NOTIFICATION_TOKEN_REQUIRED: import("@entro314labs/entro-auth").RawError<"NOTIFICATION_TOKEN_REQUIRED">;
624
+ INVALID_AUTH_REQ_ID: import("@entro314labs/entro-auth").RawError<"INVALID_AUTH_REQ_ID">;
625
+ EXPIRED_AUTH_REQ_ID: import("@entro314labs/entro-auth").RawError<"EXPIRED_AUTH_REQ_ID">;
626
+ AUTHORIZATION_PENDING: import("@entro314labs/entro-auth").RawError<"AUTHORIZATION_PENDING">;
627
+ POLLING_TOO_FREQUENTLY: import("@entro314labs/entro-auth").RawError<"POLLING_TOO_FREQUENTLY">;
628
+ ACCESS_DENIED: import("@entro314labs/entro-auth").RawError<"ACCESS_DENIED">;
629
+ USER_NOT_FOUND: import("@entro314labs/entro-auth").RawError<"USER_NOT_FOUND">;
630
+ UNKNOWN_REQUEST: import("@entro314labs/entro-auth").RawError<"UNKNOWN_REQUEST">;
631
+ SCOPE_NOT_REQUESTED: import("@entro314labs/entro-auth").RawError<"SCOPE_NOT_REQUESTED">;
632
+ INVALID_AUTHORIZATION_DETAILS: import("@entro314labs/entro-auth").RawError<"INVALID_AUTHORIZATION_DETAILS">;
633
+ AUTHORIZATION_DETAILS_ON_POLL: import("@entro314labs/entro-auth").RawError<"AUTHORIZATION_DETAILS_ON_POLL">;
634
+ INVALID_ACTOR: import("@entro314labs/entro-auth").RawError<"INVALID_ACTOR">;
635
+ UNSUPPORTED_ACR: import("@entro314labs/entro-auth").RawError<"UNSUPPORTED_ACR">;
636
+ };
637
+ };
638
+ export type { CibaAuthorizationDetailsType, CibaDeliveryMode, CibaNotification, CibaOptions, CibaPendingRequest };