@absolutejs/auth 0.54.9 → 0.55.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.
Files changed (44) hide show
  1. package/README.md +19 -5
  2. package/dist/agents/config.d.ts +16 -0
  3. package/dist/agents/idJag.d.ts +49 -0
  4. package/dist/agents/inMemoryStores.d.ts +2 -1
  5. package/dist/agents/index.d.ts +5 -2
  6. package/dist/agents/index.js +1391 -66
  7. package/dist/agents/index.js.map +12 -8
  8. package/dist/agents/postgresStores.d.ts +280 -1
  9. package/dist/agents/registration.d.ts +162 -0
  10. package/dist/agents/registrationClient.d.ts +50 -0
  11. package/dist/agents/routes.d.ts +112 -1
  12. package/dist/agents/types.d.ts +59 -0
  13. package/dist/apikeys/routes.d.ts +2 -2
  14. package/dist/cli/migrate.js +57 -8
  15. package/dist/cli/migrate.js.map +4 -4
  16. package/dist/credentials/login.d.ts +4 -4
  17. package/dist/credentials/routes.d.ts +4 -4
  18. package/dist/index.d.ts +185 -2
  19. package/dist/index.js +1388 -102
  20. package/dist/index.js.map +15 -12
  21. package/dist/manifest.js +12 -6
  22. package/dist/manifest.js.map +4 -4
  23. package/dist/manifest.json +2 -2
  24. package/dist/mfa/routes.d.ts +2 -2
  25. package/dist/mfa/sms.d.ts +2 -2
  26. package/dist/oidc/clientAuth.d.ts +6 -2
  27. package/dist/oidc/config.d.ts +19 -5
  28. package/dist/oidc/keys.d.ts +7 -3
  29. package/dist/oidc/logout.d.ts +2 -2
  30. package/dist/oidc/routes.d.ts +13 -11
  31. package/dist/organizations/routes.d.ts +1 -1
  32. package/dist/portal/routes.d.ts +3 -3
  33. package/dist/roles/routes.d.ts +1 -1
  34. package/dist/routes/refresh.d.ts +1 -1
  35. package/dist/routes/revoke.d.ts +1 -1
  36. package/dist/routes/sessions.d.ts +3 -3
  37. package/dist/sso/discoveryRoute.d.ts +1 -1
  38. package/dist/sso/oidcRoutes.d.ts +2 -2
  39. package/dist/sso/samlRoutes.d.ts +4 -4
  40. package/docs/AGENT-AUTH.md +54 -0
  41. package/docs/MIGRATE-FROM-LUCIA.md +235 -0
  42. package/docs/OAUTH-PROVIDER-QUIRKS.md +150 -0
  43. package/docs/UI-COMPONENTS.md +226 -0
  44. package/package.json +6 -3
package/dist/index.d.ts CHANGED
@@ -234,6 +234,186 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
234
234
  schema: {};
235
235
  standaloneSchema: {};
236
236
  response: {};
237
+ }> | Elysia<"", {
238
+ decorator: {};
239
+ store: {
240
+ session: import("./types").SessionRecord<UserType>;
241
+ unregisteredSession: import("./types").UnregisteredSessionRecord;
242
+ };
243
+ derive: {
244
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
245
+ readonly code: "Bad Request";
246
+ readonly message: "Cookies are missing";
247
+ } | {
248
+ readonly code: "Unauthorized";
249
+ readonly message: "User is not authenticated";
250
+ }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
251
+ };
252
+ resolve: {};
253
+ } & {
254
+ decorator: {};
255
+ store: {
256
+ session: import("./types").SessionRecord<UserType>;
257
+ unregisteredSession: import("./types").UnregisteredSessionRecord;
258
+ };
259
+ derive: {
260
+ readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
261
+ readonly code: "Unauthorized";
262
+ readonly message: "Recent authentication required";
263
+ }) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
264
+ };
265
+ resolve: {};
266
+ } & {
267
+ decorator: {};
268
+ store: {};
269
+ derive: {
270
+ readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
271
+ code: "Forbidden" | "Unauthorized";
272
+ message: "Agent is not authenticated" | "Insufficient agent scopes";
273
+ }) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
274
+ };
275
+ resolve: {};
276
+ }, {
277
+ typebox: {};
278
+ error: {};
279
+ }, {
280
+ schema: import("elysia").UnwrapRoute<{
281
+ cookie: import("@sinclair/typebox").TObject<{
282
+ user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
283
+ }>;
284
+ }, {}, "">;
285
+ standaloneSchema: {};
286
+ macro: {};
287
+ macroFn: {};
288
+ parser: {};
289
+ response: import("elysia").ExtractErrorFromHandle<{
290
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
291
+ readonly code: "Bad Request";
292
+ readonly message: "Cookies are missing";
293
+ } | {
294
+ readonly code: "Unauthorized";
295
+ readonly message: "User is not authenticated";
296
+ }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
297
+ }>;
298
+ } & {
299
+ schema: import("elysia").UnwrapRoute<{
300
+ cookie: import("@sinclair/typebox").TObject<{
301
+ user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
302
+ }>;
303
+ }, {}, "">;
304
+ standaloneSchema: {};
305
+ macro: {};
306
+ macroFn: {};
307
+ parser: {};
308
+ response: import("elysia").ExtractErrorFromHandle<{
309
+ readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
310
+ readonly code: "Unauthorized";
311
+ readonly message: "Recent authentication required";
312
+ }) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
313
+ }>;
314
+ } & {
315
+ schema: {};
316
+ standaloneSchema: {};
317
+ macro: {};
318
+ macroFn: {};
319
+ parser: {};
320
+ response: import("elysia").ExtractErrorFromHandle<{
321
+ readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
322
+ code: "Forbidden" | "Unauthorized";
323
+ message: "Agent is not authenticated" | "Insufficient agent scopes";
324
+ }) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
325
+ }>;
326
+ }, {
327
+ [x: string]: {
328
+ get: {
329
+ body: unknown;
330
+ params: {};
331
+ query: unknown;
332
+ headers: unknown;
333
+ response: {
334
+ 200: {
335
+ resource: string;
336
+ scopes_supported: string[];
337
+ resource_name?: string | undefined;
338
+ resource_logo_uri?: string | undefined;
339
+ authorization_servers: string[];
340
+ bearer_methods_supported: string[];
341
+ };
342
+ };
343
+ };
344
+ };
345
+ } & {
346
+ [x: string]: {
347
+ get: {
348
+ body: unknown;
349
+ params: {};
350
+ query: unknown;
351
+ headers: unknown;
352
+ response: {
353
+ 200: Response;
354
+ };
355
+ };
356
+ };
357
+ } & {
358
+ [x: string]: {
359
+ get: {
360
+ body: unknown;
361
+ params: {};
362
+ query: unknown;
363
+ headers: unknown;
364
+ response: {
365
+ 200: Response;
366
+ };
367
+ };
368
+ };
369
+ } & {
370
+ [x: string]: {
371
+ post: {
372
+ body: unknown;
373
+ params: {};
374
+ query: unknown;
375
+ headers: unknown;
376
+ response: {
377
+ 200: Response;
378
+ };
379
+ };
380
+ };
381
+ } & {
382
+ [x: string]: {
383
+ post: {
384
+ body: unknown;
385
+ params: {};
386
+ query: unknown;
387
+ headers: unknown;
388
+ response: {
389
+ 200: Response;
390
+ };
391
+ };
392
+ };
393
+ } & {
394
+ [x: string]: {
395
+ post: {
396
+ body: unknown;
397
+ params: {};
398
+ query: unknown;
399
+ headers: unknown;
400
+ response: {
401
+ 200: Response;
402
+ };
403
+ };
404
+ };
405
+ }, {
406
+ derive: {};
407
+ resolve: {};
408
+ schema: {};
409
+ standaloneSchema: {};
410
+ response: {};
411
+ }, {
412
+ derive: {};
413
+ resolve: {};
414
+ schema: {};
415
+ standaloneSchema: {};
416
+ response: {};
237
417
  }>>;
238
418
  export * from './actions';
239
419
  export * from './types';
@@ -355,11 +535,14 @@ export * from './apikeys/types';
355
535
  export { apiKeysRoutes } from './apikeys/routes';
356
536
  export * from './agents/config';
357
537
  export * from './agents/types';
538
+ export * from './agents/registration';
539
+ export * from './agents/registrationClient';
540
+ export * from './agents/idJag';
358
541
  export { agentAuthPlugin, agentAuthChallenge } from './agents/routes';
359
542
  export { resolveAgentPrincipal, agentHasScopes } from './agents/principal';
360
543
  export { createOidcAgentCredentialVerifier } from './agents/oidcAdapter';
361
- export { createInMemoryAgentDelegationStore, createInMemoryAgentRegistrationStore } from './agents/inMemoryStores';
362
- export { agentDelegationsTable, agentRegistrationsTable, createNeonAgentDelegationStore, createNeonAgentRegistrationStore, createPostgresAgentDelegationStore, createPostgresAgentRegistrationStore } from './agents/postgresStores';
544
+ export { createInMemoryAgentDelegationStore, createInMemoryAgentIdentityRegistrationStore, createInMemoryAgentRegistrationStore } from './agents/inMemoryStores';
545
+ export { agentDelegationsTable, agentIdentityRegistrationsTable, agentRegistrationsTable, createNeonAgentDelegationStore, createNeonAgentIdentityRegistrationStore, createNeonAgentRegistrationStore, createPostgresAgentDelegationStore, createPostgresAgentIdentityRegistrationStore, createPostgresAgentRegistrationStore } from './agents/postgresStores';
363
546
  export { createInMemoryAccessTokenStore, createInMemoryApiClientStore, createInMemoryApiKeyStore } from './apikeys/inMemoryStores';
364
547
  export { accessTokensTable, apiClientsTable, apiKeysTable, createNeonAccessTokenStore, createNeonApiClientStore, createNeonApiKeyStore, createPostgresAccessTokenStore, createPostgresApiClientStore, createPostgresApiKeyStore } from './apikeys/postgresStores';
365
548
  export * from './oidc/config';