authhero 8.22.0 → 8.23.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 (42) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +142 -142
  3. package/dist/authhero.d.ts +242 -127
  4. package/dist/authhero.mjs +20674 -15903
  5. package/dist/tsconfig.types.tsbuildinfo +1 -1
  6. package/dist/types/authentication-flows/passwordless.d.ts +12 -4
  7. package/dist/types/helpers/backchannel-logout.d.ts +19 -0
  8. package/dist/types/helpers/client.d.ts +10 -1
  9. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  10. package/dist/types/index.d.ts +232 -126
  11. package/dist/types/routes/auth-api/index.d.ts +24 -20
  12. package/dist/types/routes/auth-api/passwordless.d.ts +8 -8
  13. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  14. package/dist/types/routes/auth-api/token.d.ts +10 -10
  15. package/dist/types/routes/auth-api/well-known.d.ts +4 -0
  16. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  17. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  18. package/dist/types/routes/management-api/branding.d.ts +9 -9
  19. package/dist/types/routes/management-api/clients.d.ts +68 -16
  20. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  21. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  22. package/dist/types/routes/management-api/hook-code.d.ts +2 -2
  23. package/dist/types/routes/management-api/index.d.ts +179 -77
  24. package/dist/types/routes/management-api/log-streams.d.ts +6 -6
  25. package/dist/types/routes/management-api/logs.d.ts +4 -4
  26. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  27. package/dist/types/routes/management-api/organizations.d.ts +3 -3
  28. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  29. package/dist/types/routes/management-api/roles.d.ts +50 -0
  30. package/dist/types/routes/management-api/tenants.d.ts +5 -5
  31. package/dist/types/routes/management-api/themes.d.ts +6 -6
  32. package/dist/types/routes/management-api/users.d.ts +2 -2
  33. package/dist/types/routes/universal-login/common.d.ts +24 -8
  34. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  35. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  36. package/dist/types/types/IdToken.d.ts +2 -2
  37. package/dist/types/utils/crypto.d.ts +3 -0
  38. package/dist/types/utils/jwt.d.ts +29 -0
  39. package/dist/types/utils/request-origin.d.ts +6 -0
  40. package/dist/types/utils/totp.d.ts +10 -0
  41. package/dist/types/variables.d.ts +8 -0
  42. package/package.json +6 -7
@@ -170,7 +170,7 @@ export declare const u2Routes: OpenAPIHono<{
170
170
  $get: {
171
171
  input: {
172
172
  param: {
173
- screen: "login" | "signup" | "reset-password" | "consent" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
173
+ screen: "signup" | "consent" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
174
174
  };
175
175
  } & {
176
176
  query: {
@@ -186,7 +186,7 @@ export declare const u2Routes: OpenAPIHono<{
186
186
  } | {
187
187
  input: {
188
188
  param: {
189
- screen: "login" | "signup" | "reset-password" | "consent" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
189
+ screen: "signup" | "consent" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
190
190
  };
191
191
  } & {
192
192
  query: {
@@ -202,7 +202,7 @@ export declare const u2Routes: OpenAPIHono<{
202
202
  } | {
203
203
  input: {
204
204
  param: {
205
- screen: "login" | "signup" | "reset-password" | "consent" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
205
+ screen: "signup" | "consent" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
206
206
  };
207
207
  } & {
208
208
  query: {
@@ -222,7 +222,7 @@ export declare const u2Routes: OpenAPIHono<{
222
222
  $post: {
223
223
  input: {
224
224
  param: {
225
- screen: "login" | "signup" | "reset-password" | "consent" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
225
+ screen: "signup" | "consent" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
226
226
  };
227
227
  } & {
228
228
  query: {
@@ -240,7 +240,7 @@ export declare const u2Routes: OpenAPIHono<{
240
240
  } | {
241
241
  input: {
242
242
  param: {
243
- screen: "login" | "signup" | "reset-password" | "consent" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
243
+ screen: "signup" | "consent" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
244
244
  };
245
245
  } & {
246
246
  query: {
@@ -22,9 +22,9 @@ export declare const userInfoSchema: z.ZodObject<{
22
22
  email: z.ZodOptional<z.ZodString>;
23
23
  given_name: z.ZodOptional<z.ZodString>;
24
24
  family_name: z.ZodOptional<z.ZodString>;
25
- iss: z.ZodString;
26
25
  sub: z.ZodString;
27
- aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
28
26
  exp: z.ZodNumber;
27
+ iss: z.ZodString;
28
+ aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
29
29
  }, z.core.$loose>;
30
30
  export type IdToken = z.infer<typeof idTokenSchema>;
@@ -1,2 +1,5 @@
1
1
  export declare function pemToBuffer(pem: string): ArrayBuffer;
2
+ /** A high-entropy PKCE code verifier (RFC 7636 §4.1): 32 random bytes,
3
+ * base64url-encoded to 43 characters. */
4
+ export declare function generateCodeVerifier(): string;
2
5
  export declare function computeCodeChallenge(codeVerifier: string, method: "plain" | "S256"): Promise<string>;
@@ -1,5 +1,34 @@
1
1
  import { Context } from "hono";
2
2
  import { JSONHTTPException } from "../errors/json-http-exception";
3
+ import type { TokenHeader } from "hono/utils/jwt/jwt";
4
+ import type { JWTPayload } from "hono/utils/jwt/types";
5
+ export type JWTSigningAlg = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512";
6
+ export interface SignJWTOptions {
7
+ /** Sets `exp` to now + this many seconds. */
8
+ expiresInSeconds?: number;
9
+ /** Sets `iat` to now. */
10
+ includeIssuedTimestamp?: boolean;
11
+ /** Extra JOSE header members (e.g. `kid`); merged over `alg`/`typ`. */
12
+ headers?: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * Sign a JWT (compact JWS) on Web Crypto. `key` is the raw HMAC secret for
16
+ * HS* or a PKCS#8 private key for RS* and ES*. ECDSA signatures use the raw
17
+ * `r ‖ s` form Web Crypto produces, as JWS requires.
18
+ */
19
+ export declare function signJWT(algorithm: JWTSigningAlg, key: ArrayBuffer | Uint8Array, payloadClaims: Record<string, unknown>, options?: SignJWTOptions): Promise<string>;
20
+ export interface ParsedJWT {
21
+ header: TokenHeader;
22
+ payload: JWTPayload;
23
+ }
24
+ /**
25
+ * Decode a compact JWT without verifying its signature; null on malformed
26
+ * input. For reading claims out of tokens we minted ourselves or received
27
+ * over a channel that authenticates the issuer (e.g. an IdP token
28
+ * endpoint). Anything accepted from the outside goes through
29
+ * `validateJwtToken` or the JWKS verifiers in helpers/ instead.
30
+ */
31
+ export declare function parseJWT(jwt: string): ParsedJWT | null;
3
32
  export interface JwtPayload {
4
33
  sub: string;
5
34
  iss: string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Check whether a request's Origin header matches one of the allowed
3
+ * domains, comparing by URL host (replaces oslo/request). Entries may be
4
+ * bare hosts or full origins; comparison ignores scheme and path.
5
+ */
6
+ export declare function verifyRequestOrigin(origin: string | null | undefined, allowedDomains: string[]): boolean;
@@ -0,0 +1,10 @@
1
+ /** The TOTP code for the current 30-second period. */
2
+ export declare function generateTOTP(secret: Uint8Array): Promise<string>;
3
+ /**
4
+ * Verify a code against the current period ±1 (RFC 6238 §6 recommends
5
+ * tolerating one step of transmission delay / clock drift, and oslo's
6
+ * current-slice-only check made codes fail at period boundaries).
7
+ */
8
+ export declare function verifyTOTP(code: string, secret: Uint8Array): Promise<boolean>;
9
+ /** otpauth:// URI for enrolling the secret in an authenticator app. */
10
+ export declare function createTOTPKeyURI(issuer: string, accountName: string, secret: Uint8Array): string;
@@ -1,4 +1,12 @@
1
1
  import { Bindings } from "./types";
2
2
  export declare function getIssuer(env: Bindings, customDomain?: string): string;
3
3
  export declare function getUniversalLoginUrl(env: Bindings, customDomain?: string, routePrefix?: string): string;
4
+ /**
5
+ * Wildcard callback entries that always allow redirecting back to the auth
6
+ * server itself (e.g. the /u/info and /u2/info test screens) without
7
+ * per-client registration. The bases usually end in "/", so normalize before
8
+ * appending "*" — a naive `${base}/*` yields a "//*" path whose wildcard
9
+ * regex never matches a real pathname.
10
+ */
11
+ export declare function getSelfCallbackWildcards(env: Bindings, customDomain?: string): string[];
4
12
  export declare function getAuthUrl(env: Bindings, customDomain?: string): string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "8.22.0",
14
+ "version": "8.23.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -63,8 +63,8 @@
63
63
  "vite": "^8.0.14",
64
64
  "vite-plugin-dts": "^4.5.4",
65
65
  "vitest": "^4.1.7",
66
- "@authhero/kysely-adapter": "11.17.0",
67
- "@authhero/widget": "0.34.11"
66
+ "@authhero/kysely-adapter": "11.18.0",
67
+ "@authhero/widget": "0.34.13"
68
68
  },
69
69
  "dependencies": {
70
70
  "@peculiar/x509": "^1.14.0",
@@ -78,13 +78,12 @@
78
78
  "libphonenumber-js": "^1.13.3",
79
79
  "liquidjs": "^10.27.0",
80
80
  "nanoid": "^5.1.11",
81
- "oslo": "^1.2.1",
82
81
  "qrcode": "^1.5.4",
83
82
  "sanitize-html": "^2.17.4",
84
83
  "xstate": "^5.31.1",
85
- "@authhero/adapter-interfaces": "3.11.0",
86
- "@authhero/proxy": "0.9.1",
87
- "@authhero/saml": "0.4.2"
84
+ "@authhero/adapter-interfaces": "4.0.0",
85
+ "@authhero/proxy": "0.9.3",
86
+ "@authhero/saml": "0.4.4"
88
87
  },
89
88
  "peerDependencies": {
90
89
  "@authhero/widget": "^0.1.0",