@absolutejs/auth 0.54.9 → 0.55.1

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.
@@ -3,10 +3,10 @@
3
3
  "identity": {
4
4
  "accent": "#6366f1",
5
5
  "category": "auth",
6
- "description": "OAuth/OIDC sign-in for 60+ providers, email/password, magic links, passkeys, MFA, enterprise SSO/SCIM, organizations, roles, and API keys — one Elysia plugin backed by your Postgres database.",
6
+ "description": "OAuth/OIDC sign-in for people and AI agents, including open auth.md registration, scoped delegation, agent account linking, 60+ providers, passkeys, MFA, enterprise SSO/SCIM, organizations, roles, and API keys.",
7
7
  "docsUrl": "https://github.com/absolutejs/auth",
8
8
  "name": "@absolutejs/auth",
9
- "tagline": "Let people create accounts and sign in."
9
+ "tagline": "Let people and agents create accounts and sign in."
10
10
  },
11
11
  "implements": [
12
12
  {
@@ -10,6 +10,10 @@ export declare const verifyJwtSignedByClient: ({ jwt, client }: {
10
10
  client: OAuthClient;
11
11
  jwt: string;
12
12
  }) => Promise<{
13
- header: any;
14
- payload: any;
13
+ header: {
14
+ [k: string]: any;
15
+ };
16
+ payload: {
17
+ [k: string]: any;
18
+ };
15
19
  } | undefined>;
@@ -4,7 +4,21 @@ import type { OnClientRegistered, OnClientRegistration } from './registration';
4
4
  import type { VciConfig } from './vci';
5
5
  import type { AuthorizationCodeStore, BackchannelAuthStore, ClientAssertionJtiStore, ClientRegistrationTokenStore, DeviceAuthorizationStore, InitialAccessTokenStore, LogoutDeliveryStore, OAuthClient, OAuthClientStore, OidcRefreshTokenStore, PushedAuthorizationRequestStore } from './types';
6
6
  export declare const DEFAULT_OIDC_ROUTE: RouteString;
7
+ export type PublicTokenGrantResult = {
8
+ body: Record<string, unknown>;
9
+ status: number;
10
+ };
7
11
  export type OidcProviderConfig<UserType> = {
12
+ /** Additional non-conflicting RFC 8414 metadata. Reserved core OAuth keys
13
+ * cannot be replaced. Used by profiles such as open agent registration. */
14
+ additionalDiscoveryMetadata?: Record<string, unknown>;
15
+ /** Public extension grants whose bearer material is carried in their body
16
+ * (for example an agent claim_token). They run before OAuth client auth. */
17
+ publicTokenGrantTypes?: string[];
18
+ handlePublicTokenGrant?: (context: {
19
+ body: Record<string, string | undefined>;
20
+ request: Request;
21
+ }) => Promise<PublicTokenGrantResult | undefined>;
8
22
  accessTokenTtlMs?: number | ((context: {
9
23
  scopes: string[];
10
24
  }) => number);
@@ -158,11 +172,11 @@ export declare const introspectToken: <UserType>({ config, hint, now, token }: {
158
172
  active: false;
159
173
  } | {
160
174
  active: true;
161
- client_id: any;
162
- exp: any;
163
- iat: any;
164
- scope: any;
165
- sub: any;
175
+ client_id: string;
176
+ exp: number;
177
+ iat: number;
178
+ scope: string;
179
+ sub: string;
166
180
  token_type: "access_token";
167
181
  } | {
168
182
  active: true;
@@ -5,7 +5,7 @@ export type SigningKey = {
5
5
  };
6
6
  export declare const generateSigningKey: () => Promise<SigningKey>;
7
7
  export declare const jwkThumbprint: (jwk: JsonWebKey) => Promise<string>;
8
- export declare const signJwt: (payload: Record<string, unknown>, signing: SigningKey) => Promise<string>;
8
+ export declare const signJwt: (payload: Record<string, unknown>, signing: SigningKey, typ?: string) => Promise<string>;
9
9
  export declare const toPublicJwk: (key: SigningKey) => {
10
10
  alg: string;
11
11
  crv: string | undefined;
@@ -16,6 +16,10 @@ export declare const toPublicJwk: (key: SigningKey) => {
16
16
  y: string | undefined;
17
17
  };
18
18
  export declare const verifyJwt: (token: string, publicJwk: JsonWebKey) => Promise<{
19
- header: any;
20
- payload: any;
19
+ header: {
20
+ [k: string]: any;
21
+ };
22
+ payload: {
23
+ [k: string]: any;
24
+ };
21
25
  } | undefined>;
@@ -8,8 +8,8 @@ export declare const verifyIdTokenHint: <UserType>({ config, idTokenHint }: {
8
8
  config: OidcProviderConfig<UserType>;
9
9
  idTokenHint: string;
10
10
  }) => Promise<{
11
- audClientId: any;
12
- sub: any;
11
+ audClientId: string;
12
+ sub: string;
13
13
  } | undefined>;
14
14
  type DeliveryFetch = (url: string, init: {
15
15
  body: string;
@@ -63,16 +63,18 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
63
63
  [x: string]: {
64
64
  post: {
65
65
  body: {
66
- resource?: string | undefined;
67
66
  client_id?: string | undefined;
68
67
  scope?: string | undefined;
69
68
  audience?: string | undefined;
69
+ resource?: string | undefined;
70
70
  refresh_token?: string | undefined;
71
71
  device_code?: string | undefined;
72
72
  auth_req_id?: string | undefined;
73
- client_secret?: string | undefined;
74
73
  grant_type?: string | undefined;
74
+ claim_token?: string | undefined;
75
+ assertion?: string | undefined;
75
76
  code?: string | undefined;
77
+ client_secret?: string | undefined;
76
78
  redirect_uri?: string | undefined;
77
79
  client_assertion?: string | undefined;
78
80
  client_assertion_type?: string | undefined;
@@ -102,12 +104,12 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
102
104
  [x: string]: {
103
105
  post: {
104
106
  body: {
105
- resource?: string | undefined;
106
107
  client_id?: string | undefined;
107
108
  scope?: string | undefined;
108
109
  nonce?: string | undefined;
109
110
  audience?: string | undefined;
110
111
  claims?: string | undefined;
112
+ resource?: string | undefined;
111
113
  client_secret?: string | undefined;
112
114
  redirect_uri?: string | undefined;
113
115
  acr_values?: string | undefined;
@@ -199,9 +201,9 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
199
201
  body: {
200
202
  client_id?: string | undefined;
201
203
  scope?: string | undefined;
204
+ login_hint?: string | undefined;
202
205
  client_secret?: string | undefined;
203
206
  binding_message?: string | undefined;
204
- login_hint?: string | undefined;
205
207
  };
206
208
  params: {};
207
209
  query: unknown;
@@ -526,7 +528,7 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
526
528
  query: unknown;
527
529
  headers: unknown;
528
530
  response: {
529
- 200: Record<string, string | boolean | string[]>;
531
+ 200: Record<string, unknown>;
530
532
  };
531
533
  };
532
534
  };
@@ -540,7 +542,7 @@ export declare const oidcProviderRoutes: <UserType>(config: OidcProviderConfig<U
540
542
  query: unknown;
541
543
  headers: unknown;
542
544
  response: {
543
- 200: Record<string, string | boolean | string[]>;
545
+ 200: Record<string, unknown>;
544
546
  };
545
547
  };
546
548
  };
@@ -16,7 +16,7 @@ export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
16
16
  unregisteredSession: import("..").UnregisteredSessionRecord;
17
17
  };
18
18
  derive: {
19
- readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
19
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401>>;
20
20
  };
21
21
  resolve: {};
22
22
  }, {
@@ -33,7 +33,7 @@ export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
33
33
  macroFn: {};
34
34
  parser: {};
35
35
  response: import("elysia").ExtractErrorFromHandle<{
36
- readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
36
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<AuthReturn | import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401>>;
37
37
  }>;
38
38
  }, {}, {
39
39
  derive: {};
@@ -0,0 +1,18 @@
1
+ import type { AuthInstance } from './authInstance';
2
+ import type { AuthConfig } from './types';
3
+ /**
4
+ * Create the complete AbsoluteJS auth application through a declaration-stable
5
+ * server entry point. Import this subpath in server applications so TypeScript
6
+ * does not need to load declarations for every optional Auth feature.
7
+ */
8
+ export declare const auth: <UserType>(config: AuthConfig<UserType>) => Promise<AuthInstance<UserType>>;
9
+ export type { AuthInstance } from './authInstance';
10
+ export type { AuditSink } from './audit/types';
11
+ export { protectRoutePlugin } from './routes/protectRoute';
12
+ export type { AuthSessionStore } from './session/types';
13
+ export { isUserSessionId } from './typeGuards';
14
+ export { userSessionIdTypebox } from './typebox';
15
+ export type { AuthConfig, OAuth2ConfigurationOptions, SessionData, UnregisteredSessionData, UserSessionId } from './types';
16
+ export { instantiateUserSession } from './utils';
17
+ export type { OAuth2TokenResponse, ProviderOption } from 'citra';
18
+ export { extractPropFromIdentity, isValidProviderOption, providers } from 'citra';