authhero 9.15.0 → 9.16.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 (62) hide show
  1. package/dist/assets/u/widget/authhero-widget.esm.js +1 -1
  2. package/dist/assets/u/widget/index.esm.js +1 -1
  3. package/dist/assets/u/widget/p-36898e2d.entry.js +1 -0
  4. package/dist/assets/u/widget/p-Che3Wd7J.js +1 -0
  5. package/dist/assets/u/widget/p-c6ec4c36.entry.js +1 -0
  6. package/dist/authhero.cjs +144 -144
  7. package/dist/authhero.d.ts +419 -287
  8. package/dist/authhero.mjs +11499 -11341
  9. package/dist/tsconfig.types.tsbuildinfo +1 -1
  10. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  11. package/dist/types/generated/locale-types.d.ts +1 -0
  12. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  13. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  14. package/dist/types/helpers/signing-certificate-authority.d.ts +99 -0
  15. package/dist/types/helpers/signing-keys.d.ts +7 -0
  16. package/dist/types/index.d.ts +295 -285
  17. package/dist/types/middlewares/reject-unknown-hosts.d.ts +13 -0
  18. package/dist/types/routes/auth-api/index.d.ts +32 -31
  19. package/dist/types/routes/auth-api/passwordless.d.ts +12 -12
  20. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  21. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  22. package/dist/types/routes/auth-api/token.d.ts +10 -10
  23. package/dist/types/routes/auth-api/well-known.d.ts +2 -1
  24. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  25. package/dist/types/routes/management-api/actions.d.ts +3 -3
  26. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  27. package/dist/types/routes/management-api/clients.d.ts +8 -8
  28. package/dist/types/routes/management-api/connections.d.ts +1 -1
  29. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  30. package/dist/types/routes/management-api/email-templates.d.ts +20 -20
  31. package/dist/types/routes/management-api/emails.d.ts +2 -2
  32. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  33. package/dist/types/routes/management-api/forms.d.ts +133 -126
  34. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  35. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  36. package/dist/types/routes/management-api/hooks.d.ts +4 -4
  37. package/dist/types/routes/management-api/index.d.ts +250 -243
  38. package/dist/types/routes/management-api/keys.d.ts +12 -12
  39. package/dist/types/routes/management-api/logs.d.ts +4 -4
  40. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  41. package/dist/types/routes/management-api/organizations.d.ts +8 -8
  42. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  43. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  44. package/dist/types/routes/management-api/tenant-operations.d.ts +1 -1
  45. package/dist/types/routes/management-api/tenants.d.ts +4 -4
  46. package/dist/types/routes/management-api/token-exchange-profiles.d.ts +12 -6
  47. package/dist/types/routes/management-api/users.d.ts +24 -24
  48. package/dist/types/routes/universal-login/common.d.ts +2 -2
  49. package/dist/types/routes/universal-login/flow-api.d.ts +16 -16
  50. package/dist/types/routes/universal-login/form-node.d.ts +4 -4
  51. package/dist/types/routes/universal-login/index.d.ts +4 -4
  52. package/dist/types/routes/universal-login/u2-form-node.d.ts +2 -2
  53. package/dist/types/routes/universal-login/u2-index.d.ts +7 -7
  54. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  55. package/dist/types/state-machines/login-session.d.ts +1 -1
  56. package/dist/types/types/AuthHeroConfig.d.ts +38 -0
  57. package/dist/types/types/Bindings.d.ts +3 -0
  58. package/dist/types/utils/encryption.d.ts +20 -0
  59. package/dist/types/utils/jwks.d.ts +6 -3
  60. package/package.json +6 -6
  61. package/dist/assets/u/widget/p-1eb7f287.entry.js +0 -1
  62. package/dist/assets/u/widget/p-398d72df.entry.js +0 -1
@@ -475,7 +475,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
475
475
  custom_login_page_preview?: string | undefined;
476
476
  form_template?: string | undefined;
477
477
  addons?: Record<string, any> | undefined;
478
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
478
+ token_endpoint_auth_method?: "client_secret_post" | "client_secret_basic" | "none" | "client_secret_jwt" | "private_key_jwt" | undefined;
479
479
  client_metadata?: Record<string, string> | undefined;
480
480
  hide_sign_up_disabled_error?: boolean | undefined;
481
481
  mobile?: Record<string, any> | undefined;
@@ -561,8 +561,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
561
561
  } | undefined;
562
562
  authenticated_at?: string | undefined;
563
563
  };
564
- connectionType: "sms" | "email" | "username";
565
- authConnection: "sms" | "email" | "username";
564
+ connectionType: "email" | "username" | "sms";
565
+ authConnection: "email" | "username" | "sms";
566
566
  session_id: string | undefined;
567
567
  authParams: {
568
568
  audience?: string | undefined;
@@ -99,6 +99,7 @@ export interface LoginScreen {
99
99
  editEmailText: () => string;
100
100
  emailPlaceholder: () => string;
101
101
  enterACodeBtn: () => string;
102
+ enterACodeShortBtn: () => string;
102
103
  federatedConnectionButtonText: (vars: {
103
104
  connectionName: string;
104
105
  }) => string;
@@ -23,9 +23,9 @@ export declare const dcrRequestSchema: z.ZodObject<{
23
23
  grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
24
  response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
25
  token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
26
- none: "none";
27
26
  client_secret_post: "client_secret_post";
28
27
  client_secret_basic: "client_secret_basic";
28
+ none: "none";
29
29
  client_secret_jwt: "client_secret_jwt";
30
30
  private_key_jwt: "private_key_jwt";
31
31
  }>>;
@@ -14,9 +14,9 @@ export declare const USERINFO_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "e
14
14
  * vendor/tenant for downstream APIs while `sub` stays `auth-service`.
15
15
  * Client-bound mints keep `azp` locked (see below).
16
16
  */
17
- export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("sid" | "client_id" | "scope" | "tenant_id" | "org_name" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "permissions" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
17
+ export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "scope" | "sid" | "sub" | "org_name" | "aud" | "auth_time" | "exp" | "iat" | "iss" | "permissions" | "org_id" | "acr" | "amr" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
18
18
  /** Client-bound mints: `azp` must stay the registered client id. */
19
- export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("sid" | "client_id" | "scope" | "tenant_id" | "org_name" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "permissions" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
19
+ export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "scope" | "sid" | "sub" | "org_name" | "aud" | "auth_time" | "exp" | "iat" | "iss" | "permissions" | "org_id" | "acr" | "amr" | "azp" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
20
20
  export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
21
21
  export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
22
22
  /**
@@ -0,0 +1,99 @@
1
+ import * as x509 from "@peculiar/x509";
2
+ /**
3
+ * A request to certify a signing key. Everything is plain data so an issuer
4
+ * can forward it over HTTP: the CA key never has to live in the auth worker.
5
+ */
6
+ export interface SigningCertificateRequest {
7
+ /** The key to certify, as an SPKI `PUBLIC KEY` PEM. */
8
+ publicKey: string;
9
+ /** Subject distinguished name, e.g. `CN=acme`. */
10
+ subject: string;
11
+ /** URI placed in the SubjectAlternativeName, e.g. `urn:authhero:tenant:acme`. */
12
+ uri: string;
13
+ notBefore: Date;
14
+ notAfter: Date;
15
+ }
16
+ /**
17
+ * Issues signing-key certificates from an intermediate CA.
18
+ *
19
+ * `issueCertificate` returns the leaf only. `getIssuerCertificates` returns
20
+ * every intermediate that may have signed a leaf that is still published —
21
+ * the current one plus any that were rotated out recently — so the JWKS can
22
+ * attach the right chain to each key.
23
+ */
24
+ export interface CertificateIssuer {
25
+ issueCertificate(request: SigningCertificateRequest): Promise<string>;
26
+ getIssuerCertificates(): Promise<string[]>;
27
+ }
28
+ export interface SigningCertificateAuthority {
29
+ issuer: CertificateIssuer;
30
+ /**
31
+ * Lifetime of issued certificates, in days. Renewal keeps the key and the
32
+ * `kid`, so short lifetimes are cheap.
33
+ *
34
+ * @default 30
35
+ */
36
+ validityDays?: number;
37
+ /**
38
+ * The SAN URI that binds a key to its owner. Receives the key's `tenant_id`,
39
+ * which is undefined for control-plane keys.
40
+ *
41
+ * Override this where the storage scope doesn't match ownership — a WFP
42
+ * tenant worker stores its own keys without a `tenant_id`.
43
+ *
44
+ * @default tenant keys → `urn:authhero:tenant:<tenant_id>`, control-plane
45
+ * keys → `urn:authhero:control-plane`
46
+ */
47
+ subjectUri?: (scope: {
48
+ tenant_id?: string;
49
+ }) => string;
50
+ }
51
+ export declare const DEFAULT_CA_CERT_VALIDITY_DAYS = 30;
52
+ export declare const TENANT_URI_PREFIX = "urn:authhero:tenant:";
53
+ export declare const CONTROL_PLANE_URI = "urn:authhero:control-plane";
54
+ /** Parameters `createX509Certificate` / `renewX509Certificate` need to issue from the CA. */
55
+ export interface CertificateAuthorityIssuance {
56
+ issuer: CertificateIssuer;
57
+ uri: string;
58
+ }
59
+ /**
60
+ * Resolve how a key should be certified. Only `jwt_signing` keys are
61
+ * CA-issued: SAML service providers pin certificates for years and gain
62
+ * nothing from a chain.
63
+ */
64
+ export declare function certificateAuthorityIssuance(ca: SigningCertificateAuthority | undefined, key: {
65
+ type: string;
66
+ tenant_id?: string;
67
+ }): CertificateAuthorityIssuance | undefined;
68
+ export interface LocalCertificateIssuerOptions {
69
+ /** The issuing (intermediate) CA certificate, PEM. */
70
+ certificate: string;
71
+ /** The issuing CA's PKCS#8 private key, PEM. */
72
+ privateKey: string;
73
+ /**
74
+ * Intermediates that were rotated out but may still have signed a
75
+ * published leaf. They are only used to build `x5c`, never to sign.
76
+ */
77
+ previousCertificates?: string[];
78
+ }
79
+ /**
80
+ * An in-process issuer holding the intermediate's private key. Keep the root
81
+ * offline; this only ever needs the intermediate.
82
+ */
83
+ export declare function createLocalCertificateIssuer(options: LocalCertificateIssuerOptions): CertificateIssuer;
84
+ /** True when the certificate was issued by someone other than itself. */
85
+ export declare function isCaIssued(cert: x509.X509Certificate): boolean;
86
+ /**
87
+ * The published chain for a CA-issued certificate: `x5c` (leaf first, then
88
+ * its issuer, standard base64 DER per RFC 7517 §4.7) and `x5t#S256`.
89
+ *
90
+ * The issuer is matched by name *and* by verifying the leaf's signature, so a
91
+ * CA that computes key identifiers differently can't produce a wrong chain.
92
+ * Returns undefined for self-signed certificates and when no known
93
+ * intermediate signed the leaf — publishing no chain beats publishing a
94
+ * wrong one.
95
+ */
96
+ export declare function certificateChainMembers(cert: x509.X509Certificate, issuerCertificates: x509.X509Certificate[]): Promise<{
97
+ x5c: string[];
98
+ "x5t#S256": string;
99
+ } | undefined>;
@@ -1,5 +1,6 @@
1
1
  import { SigningKey, KeysAdapter } from "@authhero/adapter-interfaces";
2
2
  import { SigningKeyMode, SigningKeyModeOption } from "../types/AuthHeroConfig";
3
+ import { SigningCertificateAuthority } from "./signing-certificate-authority";
3
4
  export declare function listControlPlaneKeys(keys: KeysAdapter, type?: string): Promise<SigningKey[]>;
4
5
  export declare function resolveSigningKeyMode(option: SigningKeyModeOption | undefined, tenantId: string): Promise<SigningKeyMode>;
5
6
  export interface ResolveSigningKeysOptions {
@@ -42,6 +43,12 @@ export interface EnsureSigningKeyOptions {
42
43
  name?: string;
43
44
  /** Defaults to `"jwt_signing"`. */
44
45
  type?: SigningKey["type"];
46
+ /**
47
+ * Issue the new key's certificate from this CA (`jwt_signing` only). The
48
+ * SAN is resolved from `tenantId`, so a WFP tenant worker that stores its
49
+ * keys without one should set `subjectUri` on the CA config.
50
+ */
51
+ certificateAuthority?: SigningCertificateAuthority;
45
52
  }
46
53
  export interface EnsureSigningKeyResult {
47
54
  /** True when a new key was minted; false when a signable key already existed. */