@absolutejs/auth 0.55.4 → 0.55.6

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 (52) hide show
  1. package/README.md +6 -1
  2. package/dist/agents/context.d.ts +8 -8
  3. package/dist/agents/index.js +36 -6
  4. package/dist/agents/index.js.map +6 -5
  5. package/dist/agents/routes.d.ts +134 -27
  6. package/dist/apikeys/routes.d.ts +2 -2
  7. package/dist/authContext.d.ts +193 -0
  8. package/dist/authorization/protectPermission.d.ts +4 -4
  9. package/dist/compliance/routes.d.ts +2 -2
  10. package/dist/credentials/login.d.ts +6 -6
  11. package/dist/credentials/register.d.ts +2 -2
  12. package/dist/credentials/routes.d.ts +6 -6
  13. package/dist/htmx/configuredRoutes.d.ts +542 -0
  14. package/dist/htmx/routes.d.ts +4 -4
  15. package/dist/index.d.ts +3399 -8
  16. package/dist/index.js +658 -508
  17. package/dist/index.js.map +15 -12
  18. package/dist/mfa/challenge.d.ts +2 -2
  19. package/dist/mfa/management.d.ts +2 -2
  20. package/dist/mfa/routes.d.ts +4 -4
  21. package/dist/mfa/sms.d.ts +4 -4
  22. package/dist/mfa/totp.d.ts +2 -2
  23. package/dist/oidc/routes.d.ts +14 -14
  24. package/dist/organizations/routes.d.ts +4 -3
  25. package/dist/passwordless/routes.d.ts +7 -6
  26. package/dist/pluginIdentity.d.ts +2 -0
  27. package/dist/portal/routes.d.ts +3 -3
  28. package/dist/roles/routes.d.ts +4 -3
  29. package/dist/routes/callback.d.ts +2 -2
  30. package/dist/routes/profile.d.ts +2 -2
  31. package/dist/routes/protectRoute.d.ts +6 -6
  32. package/dist/routes/refresh.d.ts +3 -3
  33. package/dist/routes/revoke.d.ts +3 -3
  34. package/dist/routes/sessions.d.ts +5 -5
  35. package/dist/routes/signout.d.ts +3 -3
  36. package/dist/routes/stepUp.d.ts +4 -4
  37. package/dist/routes/userStatus.d.ts +2 -2
  38. package/dist/server.d.ts +4 -3
  39. package/dist/server.js +657 -508
  40. package/dist/server.js.map +16 -13
  41. package/dist/session/access.d.ts +3 -3
  42. package/dist/session/cleanup.d.ts +3 -3
  43. package/dist/session/state.d.ts +3 -3
  44. package/dist/session/types.d.ts +1 -0
  45. package/dist/sso/discoveryRoute.d.ts +1 -1
  46. package/dist/sso/oidcRoutes.d.ts +4 -4
  47. package/dist/sso/samlIdpRoutes.d.ts +3 -3
  48. package/dist/sso/samlRoutes.d.ts +7 -6
  49. package/dist/webauthn/routes.d.ts +2 -2
  50. package/package.json +1 -1
  51. package/dist/authInstance.d.ts +0 -7
  52. package/dist/session/internalData.d.ts +0 -34
@@ -1,6 +1,6 @@
1
1
  import type { Cookie } from 'elysia';
2
2
  import type { SessionData, SessionRecord, UnregisteredSessionRecord, UserSessionId } from '../types';
3
- import type { AuthSessionStore } from './types';
3
+ import type { AuthSessionSource, AuthSessionStore } from './types';
4
4
  export declare const createSessionCompatibilityLayer: <UserType>({ authSessionStore, userSessionId }: {
5
5
  authSessionStore?: AuthSessionStore<UserType>;
6
6
  userSessionId?: UserSessionId;
@@ -10,7 +10,7 @@ export declare const createSessionCompatibilityLayer: <UserType>({ authSessionSt
10
10
  persist: () => Promise<void>;
11
11
  }>;
12
12
  export declare const getStatusFromSource: <UserType>({ authSessionStore, session, user_session_id }: {
13
- authSessionStore?: AuthSessionStore<UserType>;
13
+ authSessionStore?: AuthSessionSource<UserType>;
14
14
  session?: SessionRecord<UserType>;
15
15
  user_session_id: Cookie<UserSessionId | undefined>;
16
16
  }) => Promise<{
@@ -26,7 +26,7 @@ export declare const getStatusFromSource: <UserType>({ authSessionStore, session
26
26
  user: NonNullable<UserType> | null;
27
27
  }>;
28
28
  export declare const loadSessionFromSource: <UserType>({ authSessionStore, session, userSessionId, removeExpired }: {
29
- authSessionStore?: AuthSessionStore<UserType>;
29
+ authSessionStore?: AuthSessionSource<UserType>;
30
30
  session?: SessionRecord<UserType>;
31
31
  userSessionId?: UserSessionId;
32
32
  removeExpired?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { Elysia } from 'elysia';
2
- import type { OnSessionCleanup } from '../types';
2
+ import type { OnSessionCleanup, SessionRecord, UnregisteredSessionRecord } from '../types';
3
3
  import type { AuthSessionStore } from './types';
4
4
  type SessionCleanupProps<UserType> = {
5
5
  authSessionStore?: AuthSessionStore<UserType>;
@@ -10,8 +10,8 @@ type SessionCleanupProps<UserType> = {
10
10
  export declare const sessionCleanup: <UserType>({ authSessionStore, cleanupIntervalMs, maxSessions, onSessionCleanup }: SessionCleanupProps<UserType>) => Elysia<"", {
11
11
  decorator: {};
12
12
  store: {
13
- session: import("./internalData").InternalSessionRecord<UserType>;
14
- unregisteredSession: import("./internalData").InternalUnregisteredSessionRecord;
13
+ session: SessionRecord<UserType>;
14
+ unregisteredSession: UnregisteredSessionRecord;
15
15
  };
16
16
  derive: {
17
17
  readonly cleanupSessions: () => Promise<void>;
@@ -1,10 +1,10 @@
1
1
  import { Elysia } from 'elysia';
2
- import type { InternalSessionRecord, InternalUnregisteredSessionRecord } from './internalData';
2
+ import type { SessionRecord, UnregisteredSessionRecord } from '../types';
3
3
  export declare const sessionStore: <UserType>() => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: InternalSessionRecord<UserType>;
7
- unregisteredSession: InternalUnregisteredSessionRecord;
6
+ session: SessionRecord<UserType>;
7
+ unregisteredSession: UnregisteredSessionRecord;
8
8
  };
9
9
  derive: {};
10
10
  resolve: {};
@@ -18,3 +18,4 @@ export type AuthSessionStore<UserType> = {
18
18
  deleteExpired?: () => Promise<number>;
19
19
  deleteExpiredUnregistered?: () => Promise<number>;
20
20
  };
21
+ export type AuthSessionSource<UserType> = Pick<AuthSessionStore<UserType>, 'getSession' | 'removeSession'>;
@@ -33,8 +33,8 @@ export declare const ssoDiscoveryRoute: ({ getOrganizationByEmailDomain, ssoConn
33
33
  headers: unknown;
34
34
  response: {
35
35
  400: "An \"email\" query parameter is required" | "A valid email address is required";
36
- 200: Response;
37
36
  404: "No SSO organization is configured for this email domain" | "No SSO connection is configured for this organization";
37
+ 200: Response;
38
38
  422: {
39
39
  type: "validation";
40
40
  on: string;
@@ -8,8 +8,8 @@ type OidcRoutesProps<UserType> = SSOConfig<UserType> & {
8
8
  export declare const oidcSsoRoutes: <UserType>({ authSessionStore, cookieSecure, getSsoUser, onSsoCallbackError, onSsoCallbackSuccess, sessionDurationMs, ssoConnectionStore, ssoRoute }: OidcRoutesProps<UserType>) => Elysia<"", {
9
9
  decorator: {};
10
10
  store: {
11
- session: import("../session/internalData").InternalSessionRecord<UserType>;
12
- unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
11
+ session: import("..").SessionRecord<UserType>;
12
+ unregisteredSession: import("..").UnregisteredSessionRecord;
13
13
  };
14
14
  derive: {};
15
15
  resolve: {};
@@ -33,8 +33,8 @@ export declare const oidcSsoRoutes: <UserType>({ authSessionStore, cookieSecure,
33
33
  query: unknown;
34
34
  headers: unknown;
35
35
  response: {
36
- 200: Response;
37
36
  404: "No OIDC connection is configured for this organization";
37
+ 200: Response;
38
38
  422: {
39
39
  type: "validation";
40
40
  on: string;
@@ -61,8 +61,8 @@ export declare const oidcSsoRoutes: <UserType>({ authSessionStore, cookieSecure,
61
61
  headers: unknown;
62
62
  response: {
63
63
  400: "SSO session cookies are missing" | "Invalid SSO callback request" | "SSO organization mismatch" | "OIDC token response is missing an id_token";
64
- 200: Response;
65
64
  404: "No OIDC connection is configured for this organization";
65
+ 200: Response;
66
66
  422: {
67
67
  type: "validation";
68
68
  on: string;
@@ -1,6 +1,6 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import type { AuthSessionStore } from '../session/types';
3
- import type { RouteString } from '../types';
3
+ import type { RouteString, SessionRecord } from '../types';
4
4
  import { type SamlIdpAdapter } from './config';
5
5
  import type { SamlServiceProviderStore } from './types';
6
6
  type SamlIdpRoutesProps<UserType> = {
@@ -16,8 +16,8 @@ type SamlIdpRoutesProps<UserType> = {
16
16
  export declare const samlIdpRoutes: <UserType>({ authSessionStore, getNameId, getSamlAttributes, idpAdapter, idpEntityId, loginUrl, samlServiceProviderStore, ssoRoute }: SamlIdpRoutesProps<UserType>) => Elysia<"", {
17
17
  decorator: {};
18
18
  store: {
19
- session: import("../session/internalData").InternalSessionRecord<UserType>;
20
- unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
19
+ session: SessionRecord<UserType>;
20
+ unregisteredSession: import("..").UnregisteredSessionRecord;
21
21
  };
22
22
  derive: {};
23
23
  resolve: {};
@@ -1,5 +1,6 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import type { AuthSessionStore } from '../session/types';
3
+ import type { SessionRecord } from '../types';
3
4
  import { type SamlAdapter, type SSOConfig } from './config';
4
5
  type SamlRoutesProps<UserType> = SSOConfig<UserType> & {
5
6
  authSessionStore?: AuthSessionStore<UserType>;
@@ -9,8 +10,8 @@ type SamlRoutesProps<UserType> = SSOConfig<UserType> & {
9
10
  export declare const samlSsoRoutes: <UserType>({ authSessionStore, cookieSecure, getSsoUser, onSsoCallbackError, onSsoCallbackSuccess, samlAdapter, sessionDurationMs, ssoConnectionStore, ssoRoute }: SamlRoutesProps<UserType>) => Elysia<"", {
10
11
  decorator: {};
11
12
  store: {
12
- session: import("../session/internalData").InternalSessionRecord<UserType>;
13
- unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
13
+ session: SessionRecord<UserType>;
14
+ unregisteredSession: import("..").UnregisteredSessionRecord;
14
15
  };
15
16
  derive: {};
16
17
  resolve: {};
@@ -34,8 +35,8 @@ export declare const samlSsoRoutes: <UserType>({ authSessionStore, cookieSecure,
34
35
  query: unknown;
35
36
  headers: unknown;
36
37
  response: {
37
- 200: Response;
38
38
  404: "No SAML connection is configured for this organization";
39
+ 200: Response;
39
40
  422: {
40
41
  type: "validation";
41
42
  on: string;
@@ -61,8 +62,8 @@ export declare const samlSsoRoutes: <UserType>({ authSessionStore, cookieSecure,
61
62
  query: unknown;
62
63
  headers: unknown;
63
64
  response: {
64
- 200: Response;
65
65
  404: "No SAML connection is configured for this organization";
66
+ 200: Response;
66
67
  422: {
67
68
  type: "validation";
68
69
  on: string;
@@ -86,8 +87,8 @@ export declare const samlSsoRoutes: <UserType>({ authSessionStore, cookieSecure,
86
87
  query: unknown;
87
88
  headers: unknown;
88
89
  response: {
89
- 200: Response;
90
90
  404: "No SAML connection is configured for this organization";
91
+ 200: Response;
91
92
  422: {
92
93
  type: "validation";
93
94
  on: string;
@@ -140,9 +141,9 @@ export declare const samlSsoRoutes: <UserType>({ authSessionStore, cookieSecure,
140
141
  headers: unknown;
141
142
  response: {
142
143
  400: "Missing SAMLRequest or SAMLResponse" | "Invalid SAML LogoutRequest";
143
- 200: Response;
144
144
  501: "SAML Single Logout is not configured";
145
145
  404: "No SAML connection is configured for this organization";
146
+ 200: Response;
146
147
  422: {
147
148
  type: "validation";
148
149
  on: string;
@@ -3,8 +3,8 @@ import { type WebAuthnRouteProps } from './config';
3
3
  export declare const webauthnRoutes: <UserType>({ authSessionStore, challengeDurationMs, cookieSecure, credentialStore, emit, getUserDisplayName, getUserId, getUserName, getWebAuthnUser, onWebAuthnAuthenticated, onWebAuthnRegistered, origin, rpId, rpName, sessionDurationMs, webauthnAdapter, webauthnRoute }: WebAuthnRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: import("../session/internalData").InternalSessionRecord<UserType>;
7
- unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
6
+ session: import("..").SessionRecord<UserType>;
7
+ unregisteredSession: import("..").UnregisteredSessionRecord;
8
8
  };
9
9
  derive: {};
10
10
  resolve: {};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.55.4",
2
+ "version": "0.55.6",
3
3
  "name": "@absolutejs/auth",
4
4
  "description": "An authorization library for absolutejs",
5
5
  "repository": {
@@ -1,7 +0,0 @@
1
- import type { protectRoutePlugin } from './routes/protectRoute';
2
- /** The consumer-facing context contributed by `auth()`. Configurable auth
3
- * routes are available at runtime but intentionally omitted from this type:
4
- * their user-defined paths cannot form useful literal route declarations.
5
- * Optional step-up and agent contexts remain available through their explicit
6
- * plugins without multiplying the default application's Elysia type graph. */
7
- export type AuthInstance<UserType> = ReturnType<typeof protectRoutePlugin<UserType>>;
@@ -1,34 +0,0 @@
1
- export type InternalUserSessionId = `${string}-${string}-${string}-${string}-${string}`;
2
- type InternalImpersonator = {
3
- actorEmail?: string;
4
- actorId: string;
5
- readOnly?: boolean;
6
- reason: string;
7
- returnToSessionId?: InternalUserSessionId;
8
- startedAt: number;
9
- suppressSideEffects?: boolean;
10
- };
11
- type InternalSessionData<UserType> = {
12
- accessToken?: string;
13
- anonymous?: boolean;
14
- authenticatedAt?: number;
15
- expiresAt: number;
16
- impersonator?: InternalImpersonator;
17
- refreshToken?: string;
18
- samlLogout?: {
19
- connectionId: string;
20
- nameId: string;
21
- sessionIndex?: string;
22
- };
23
- user: UserType;
24
- };
25
- export type InternalSessionRecord<UserType> = Record<InternalUserSessionId, InternalSessionData<UserType>>;
26
- type InternalUnregisteredSessionData = {
27
- accessToken?: string;
28
- expiresAt: number;
29
- refreshToken?: string;
30
- sessionInformation?: Record<string, unknown>;
31
- userIdentity?: Record<string, unknown>;
32
- };
33
- export type InternalUnregisteredSessionRecord = Record<InternalUserSessionId, InternalUnregisteredSessionData>;
34
- export {};