authhero 7.0.0 → 7.2.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 (40) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +94 -94
  3. package/dist/authhero.d.ts +224 -244
  4. package/dist/authhero.mjs +7590 -7572
  5. package/dist/stats.html +1 -1
  6. package/dist/tsconfig.types.tsbuildinfo +1 -1
  7. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  8. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  9. package/dist/types/helpers/signing-keys.d.ts +1 -0
  10. package/dist/types/index.d.ts +203 -221
  11. package/dist/types/routes/auth-api/index.d.ts +32 -32
  12. package/dist/types/routes/auth-api/passwordless.d.ts +14 -14
  13. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  14. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  15. package/dist/types/routes/auth-api/token.d.ts +10 -10
  16. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  17. package/dist/types/routes/management-api/client-grants.d.ts +8 -8
  18. package/dist/types/routes/management-api/clients.d.ts +7 -7
  19. package/dist/types/routes/management-api/connections.d.ts +1 -1
  20. package/dist/types/routes/management-api/custom-domains.d.ts +7 -25
  21. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  22. package/dist/types/routes/management-api/forms.d.ts +119 -119
  23. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  24. package/dist/types/routes/management-api/index.d.ts +165 -183
  25. package/dist/types/routes/management-api/logs.d.ts +3 -3
  26. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  27. package/dist/types/routes/management-api/organizations.d.ts +1 -1
  28. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  29. package/dist/types/routes/management-api/users.d.ts +2 -2
  30. package/dist/types/routes/proxy-control-plane/index.d.ts +10 -15
  31. package/dist/types/routes/proxy-control-plane/verify.d.ts +10 -5
  32. package/dist/types/routes/universal-login/common.d.ts +2 -2
  33. package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
  34. package/dist/types/routes/universal-login/u2-index.d.ts +6 -6
  35. package/dist/types/routes/universal-login/u2-routes.d.ts +6 -6
  36. package/dist/types/types/AuthHeroConfig.d.ts +11 -13
  37. package/dist/types/types/Bindings.d.ts +0 -6
  38. package/dist/types/utils/jwks.d.ts +10 -11
  39. package/dist/types/utils/jwt.d.ts +21 -1
  40. package/package.json +5 -5
@@ -3,14 +3,9 @@ import type { SamlSigner } from "@authhero/saml/core";
3
3
  import { Hooks } from "./Hooks";
4
4
  import { EntityHooksConfig, OutboxConfig, SigningKeyModeOption, UserLinkingModeOption, UsernamePasswordProviderResolver, WebhookInvoker } from "./AuthHeroConfig";
5
5
  import { StrategyHandler } from "../strategies";
6
- declare type Fetcher = {
7
- fetch: typeof fetch;
8
- };
9
6
  export type Bindings = {
10
7
  ENVIRONMENT: string;
11
8
  AUTH_URL: string;
12
- JWKS_URL?: string;
13
- JWKS_SERVICE?: Fetcher;
14
9
  ISSUER: string;
15
10
  UNIVERSAL_LOGIN_URL?: string;
16
11
  OAUTH_API_URL?: string;
@@ -49,4 +44,3 @@ export type Bindings = {
49
44
  */
50
45
  ALLOW_PRIVATE_OUTBOUND_FETCH?: boolean;
51
46
  };
52
- export {};
@@ -1,13 +1,12 @@
1
1
  import { DataAdapters } from "@authhero/adapter-interfaces";
2
2
  import { SigningKeyModeOption } from "../types/AuthHeroConfig";
3
3
  /**
4
- * Helper function to fetch JWKS keys from the database for token *verification*.
5
- *
6
- * Returns every non-revoked `jwt_signing` key regardless of tenant scope so a
7
- * token signed by any key (control-plane or any tenant) can be matched by kid.
8
- * Use `getJwksForPublication` for the public `/.well-known/jwks.json` endpoint.
4
+ * JWKS for publication on a tenant's `/.well-known/jwks.json`. Honors the
5
+ * configured `signingKeyMode` and, in `"tenant"` mode, returns the union of
6
+ * the tenant's keys and the control-plane fallback so tokens signed by either
7
+ * still verify during the per-tenant key rollout.
9
8
  */
10
- export declare function getJwksFromDatabase(data: DataAdapters): Promise<{
9
+ export declare function getJwksForPublication(data: DataAdapters, tenantId: string, modeOption: SigningKeyModeOption | undefined): Promise<{
11
10
  alg: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "HS256" | "HS384" | "HS512";
12
11
  kty: "RSA" | "EC" | "oct";
13
12
  kid?: string | undefined;
@@ -21,12 +20,12 @@ export declare function getJwksFromDatabase(data: DataAdapters): Promise<{
21
20
  x5c?: string[] | undefined;
22
21
  }[]>;
23
22
  /**
24
- * JWKS for publication on a tenant's `/.well-known/jwks.json`. Honors the
25
- * configured `signingKeyMode` and, in `"tenant"` mode, returns the union of
26
- * the tenant's keys and the control-plane fallback so tokens signed by either
27
- * still verify during the per-tenant key rollout.
23
+ * JWKS for verifying bearer tokens. Mirrors the publication set so any kid
24
+ * that appears in a tenant's published `/.well-known/jwks.json` will also
25
+ * verify. Without a resolved tenant (control-plane host with no tenant
26
+ * subdomain), only control-plane-signed tokens are accepted.
28
27
  */
29
- export declare function getJwksForPublication(data: DataAdapters, tenantId: string, modeOption: SigningKeyModeOption | undefined): Promise<{
28
+ export declare function getJwksForVerification(data: DataAdapters, tenantId: string | undefined, modeOption: SigningKeyModeOption | undefined): Promise<{
30
29
  alg: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "HS256" | "HS384" | "HS512";
31
30
  kty: "RSA" | "EC" | "oct";
32
31
  kid?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  import { Context } from "hono";
2
+ import { JSONHTTPException } from "../errors/json-http-exception";
2
3
  export interface JwtPayload {
3
4
  sub: string;
4
5
  iss: string;
@@ -16,4 +17,23 @@ export interface JwtPayload {
16
17
  client_id?: string;
17
18
  };
18
19
  }
19
- export declare function validateJwtToken(ctx: Context, token: string): Promise<JwtPayload>;
20
+ export interface ValidateJwtTokenOptions {
21
+ /**
22
+ * Skip the `iss === getIssuer(env, custom_domain)` check. Use only when the
23
+ * caller will perform its own issuer check with caller-specific error
24
+ * semantics — e.g. RFC 8693 token-exchange returns `invalid_grant` (400/403)
25
+ * for iss mismatch rather than the 401 this function would raise.
26
+ */
27
+ skipIssuerCheck?: boolean;
28
+ }
29
+ /**
30
+ * Raised when the subject JWT carried a past `exp`. Extends JSONHTTPException
31
+ * with the same 403/"Invalid JWT signature" body the wrapper used to emit for
32
+ * any verify failure, so callers that only branch on `instanceof HTTPException`
33
+ * keep their current behavior. Token-exchange catches this class specifically
34
+ * to emit the RFC 8693 `invalid_grant` / "Subject token has expired" response.
35
+ */
36
+ export declare class JwtExpiredError extends JSONHTTPException {
37
+ constructor();
38
+ }
39
+ export declare function validateJwtToken(ctx: Context, token: string, options?: ValidateJwtTokenOptions): Promise<JwtPayload>;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "7.0.0",
14
+ "version": "7.2.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -62,8 +62,8 @@
62
62
  "vite": "^8.0.14",
63
63
  "vite-plugin-dts": "^4.5.4",
64
64
  "vitest": "^4.1.7",
65
- "@authhero/kysely-adapter": "11.8.3",
66
- "@authhero/widget": "0.32.39"
65
+ "@authhero/kysely-adapter": "11.8.6",
66
+ "@authhero/widget": "0.32.40"
67
67
  },
68
68
  "dependencies": {
69
69
  "@peculiar/x509": "^1.14.0",
@@ -81,8 +81,8 @@
81
81
  "qrcode": "^1.5.4",
82
82
  "sanitize-html": "^2.17.4",
83
83
  "xstate": "^5.31.1",
84
- "@authhero/adapter-interfaces": "3.0.0",
85
- "@authhero/proxy": "0.5.0",
84
+ "@authhero/adapter-interfaces": "3.1.0",
85
+ "@authhero/proxy": "0.5.1",
86
86
  "@authhero/saml": "0.4.1"
87
87
  },
88
88
  "peerDependencies": {