authhero 0.152.0 → 0.154.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.
@@ -8194,6 +8194,7 @@ declare const ClientSchema: z.ZodObject<{
8194
8194
  kid: z.ZodOptional<z.ZodString>;
8195
8195
  team_id: z.ZodOptional<z.ZodString>;
8196
8196
  realms: z.ZodOptional<z.ZodString>;
8197
+ authentication_method: z.ZodOptional<z.ZodString>;
8197
8198
  client_id: z.ZodOptional<z.ZodString>;
8198
8199
  client_secret: z.ZodOptional<z.ZodString>;
8199
8200
  app_secret: z.ZodOptional<z.ZodString>;
@@ -8217,6 +8218,7 @@ declare const ClientSchema: z.ZodObject<{
8217
8218
  kid?: string | undefined;
8218
8219
  team_id?: string | undefined;
8219
8220
  realms?: string | undefined;
8221
+ authentication_method?: string | undefined;
8220
8222
  app_secret?: string | undefined;
8221
8223
  authorization_endpoint?: string | undefined;
8222
8224
  token_endpoint?: string | undefined;
@@ -8235,6 +8237,7 @@ declare const ClientSchema: z.ZodObject<{
8235
8237
  kid?: string | undefined;
8236
8238
  team_id?: string | undefined;
8237
8239
  realms?: string | undefined;
8240
+ authentication_method?: string | undefined;
8238
8241
  app_secret?: string | undefined;
8239
8242
  authorization_endpoint?: string | undefined;
8240
8243
  token_endpoint?: string | undefined;
@@ -8258,6 +8261,7 @@ declare const ClientSchema: z.ZodObject<{
8258
8261
  kid?: string | undefined;
8259
8262
  team_id?: string | undefined;
8260
8263
  realms?: string | undefined;
8264
+ authentication_method?: string | undefined;
8261
8265
  app_secret?: string | undefined;
8262
8266
  authorization_endpoint?: string | undefined;
8263
8267
  token_endpoint?: string | undefined;
@@ -8290,6 +8294,7 @@ declare const ClientSchema: z.ZodObject<{
8290
8294
  kid?: string | undefined;
8291
8295
  team_id?: string | undefined;
8292
8296
  realms?: string | undefined;
8297
+ authentication_method?: string | undefined;
8293
8298
  app_secret?: string | undefined;
8294
8299
  authorization_endpoint?: string | undefined;
8295
8300
  token_endpoint?: string | undefined;
@@ -8443,6 +8448,7 @@ declare const ClientSchema: z.ZodObject<{
8443
8448
  kid?: string | undefined;
8444
8449
  team_id?: string | undefined;
8445
8450
  realms?: string | undefined;
8451
+ authentication_method?: string | undefined;
8446
8452
  app_secret?: string | undefined;
8447
8453
  authorization_endpoint?: string | undefined;
8448
8454
  token_endpoint?: string | undefined;
@@ -8522,6 +8528,7 @@ declare const ClientSchema: z.ZodObject<{
8522
8528
  kid?: string | undefined;
8523
8529
  team_id?: string | undefined;
8524
8530
  realms?: string | undefined;
8531
+ authentication_method?: string | undefined;
8525
8532
  app_secret?: string | undefined;
8526
8533
  authorization_endpoint?: string | undefined;
8527
8534
  token_endpoint?: string | undefined;
@@ -8595,6 +8602,8 @@ export declare const codeInsertSchema: z.ZodObject<{
8595
8602
  "S256"
8596
8603
  ]>>;
8597
8604
  redirect_uri: z.ZodOptional<z.ZodString>;
8605
+ nonce: z.ZodOptional<z.ZodString>;
8606
+ state: z.ZodOptional<z.ZodString>;
8598
8607
  expires_at: z.ZodString;
8599
8608
  used_at: z.ZodOptional<z.ZodString>;
8600
8609
  user_id: z.ZodOptional<z.ZodString>;
@@ -8605,6 +8614,8 @@ export declare const codeInsertSchema: z.ZodObject<{
8605
8614
  expires_at: string;
8606
8615
  user_id?: string | undefined;
8607
8616
  redirect_uri?: string | undefined;
8617
+ state?: string | undefined;
8618
+ nonce?: string | undefined;
8608
8619
  code_challenge_method?: "S256" | "plain" | undefined;
8609
8620
  code_challenge?: string | undefined;
8610
8621
  connection_id?: string | undefined;
@@ -8617,6 +8628,8 @@ export declare const codeInsertSchema: z.ZodObject<{
8617
8628
  expires_at: string;
8618
8629
  user_id?: string | undefined;
8619
8630
  redirect_uri?: string | undefined;
8631
+ state?: string | undefined;
8632
+ nonce?: string | undefined;
8620
8633
  code_challenge_method?: "S256" | "plain" | undefined;
8621
8634
  code_challenge?: string | undefined;
8622
8635
  connection_id?: string | undefined;
@@ -8644,6 +8657,8 @@ export declare const codeSchema: z.ZodObject<{
8644
8657
  "S256"
8645
8658
  ]>>;
8646
8659
  redirect_uri: z.ZodOptional<z.ZodString>;
8660
+ nonce: z.ZodOptional<z.ZodString>;
8661
+ state: z.ZodOptional<z.ZodString>;
8647
8662
  expires_at: z.ZodString;
8648
8663
  used_at: z.ZodOptional<z.ZodString>;
8649
8664
  user_id: z.ZodOptional<z.ZodString>;
@@ -8655,6 +8670,8 @@ export declare const codeSchema: z.ZodObject<{
8655
8670
  expires_at: string;
8656
8671
  user_id?: string | undefined;
8657
8672
  redirect_uri?: string | undefined;
8673
+ state?: string | undefined;
8674
+ nonce?: string | undefined;
8658
8675
  code_challenge_method?: "S256" | "plain" | undefined;
8659
8676
  code_challenge?: string | undefined;
8660
8677
  connection_id?: string | undefined;
@@ -8668,6 +8685,8 @@ export declare const codeSchema: z.ZodObject<{
8668
8685
  expires_at: string;
8669
8686
  user_id?: string | undefined;
8670
8687
  redirect_uri?: string | undefined;
8688
+ state?: string | undefined;
8689
+ nonce?: string | undefined;
8671
8690
  code_challenge_method?: "S256" | "plain" | undefined;
8672
8691
  code_challenge?: string | undefined;
8673
8692
  connection_id?: string | undefined;
@@ -8679,6 +8698,7 @@ export declare const connectionOptionsSchema: z.ZodObject<{
8679
8698
  kid: z.ZodOptional<z.ZodString>;
8680
8699
  team_id: z.ZodOptional<z.ZodString>;
8681
8700
  realms: z.ZodOptional<z.ZodString>;
8701
+ authentication_method: z.ZodOptional<z.ZodString>;
8682
8702
  client_id: z.ZodOptional<z.ZodString>;
8683
8703
  client_secret: z.ZodOptional<z.ZodString>;
8684
8704
  app_secret: z.ZodOptional<z.ZodString>;
@@ -8702,6 +8722,7 @@ export declare const connectionOptionsSchema: z.ZodObject<{
8702
8722
  kid?: string | undefined;
8703
8723
  team_id?: string | undefined;
8704
8724
  realms?: string | undefined;
8725
+ authentication_method?: string | undefined;
8705
8726
  app_secret?: string | undefined;
8706
8727
  authorization_endpoint?: string | undefined;
8707
8728
  token_endpoint?: string | undefined;
@@ -8720,6 +8741,7 @@ export declare const connectionOptionsSchema: z.ZodObject<{
8720
8741
  kid?: string | undefined;
8721
8742
  team_id?: string | undefined;
8722
8743
  realms?: string | undefined;
8744
+ authentication_method?: string | undefined;
8723
8745
  app_secret?: string | undefined;
8724
8746
  authorization_endpoint?: string | undefined;
8725
8747
  token_endpoint?: string | undefined;
@@ -8738,6 +8760,7 @@ export declare const connectionInsertSchema: z.ZodObject<{
8738
8760
  kid: z.ZodOptional<z.ZodString>;
8739
8761
  team_id: z.ZodOptional<z.ZodString>;
8740
8762
  realms: z.ZodOptional<z.ZodString>;
8763
+ authentication_method: z.ZodOptional<z.ZodString>;
8741
8764
  client_id: z.ZodOptional<z.ZodString>;
8742
8765
  client_secret: z.ZodOptional<z.ZodString>;
8743
8766
  app_secret: z.ZodOptional<z.ZodString>;
@@ -8761,6 +8784,7 @@ export declare const connectionInsertSchema: z.ZodObject<{
8761
8784
  kid?: string | undefined;
8762
8785
  team_id?: string | undefined;
8763
8786
  realms?: string | undefined;
8787
+ authentication_method?: string | undefined;
8764
8788
  app_secret?: string | undefined;
8765
8789
  authorization_endpoint?: string | undefined;
8766
8790
  token_endpoint?: string | undefined;
@@ -8779,6 +8803,7 @@ export declare const connectionInsertSchema: z.ZodObject<{
8779
8803
  kid?: string | undefined;
8780
8804
  team_id?: string | undefined;
8781
8805
  realms?: string | undefined;
8806
+ authentication_method?: string | undefined;
8782
8807
  app_secret?: string | undefined;
8783
8808
  authorization_endpoint?: string | undefined;
8784
8809
  token_endpoint?: string | undefined;
@@ -8802,6 +8827,7 @@ export declare const connectionInsertSchema: z.ZodObject<{
8802
8827
  kid?: string | undefined;
8803
8828
  team_id?: string | undefined;
8804
8829
  realms?: string | undefined;
8830
+ authentication_method?: string | undefined;
8805
8831
  app_secret?: string | undefined;
8806
8832
  authorization_endpoint?: string | undefined;
8807
8833
  token_endpoint?: string | undefined;
@@ -8830,6 +8856,7 @@ export declare const connectionInsertSchema: z.ZodObject<{
8830
8856
  kid?: string | undefined;
8831
8857
  team_id?: string | undefined;
8832
8858
  realms?: string | undefined;
8859
+ authentication_method?: string | undefined;
8833
8860
  app_secret?: string | undefined;
8834
8861
  authorization_endpoint?: string | undefined;
8835
8862
  token_endpoint?: string | undefined;
@@ -8857,6 +8884,7 @@ export declare const connectionSchema: z.ZodObject<{
8857
8884
  kid: z.ZodOptional<z.ZodString>;
8858
8885
  team_id: z.ZodOptional<z.ZodString>;
8859
8886
  realms: z.ZodOptional<z.ZodString>;
8887
+ authentication_method: z.ZodOptional<z.ZodString>;
8860
8888
  client_id: z.ZodOptional<z.ZodString>;
8861
8889
  client_secret: z.ZodOptional<z.ZodString>;
8862
8890
  app_secret: z.ZodOptional<z.ZodString>;
@@ -8880,6 +8908,7 @@ export declare const connectionSchema: z.ZodObject<{
8880
8908
  kid?: string | undefined;
8881
8909
  team_id?: string | undefined;
8882
8910
  realms?: string | undefined;
8911
+ authentication_method?: string | undefined;
8883
8912
  app_secret?: string | undefined;
8884
8913
  authorization_endpoint?: string | undefined;
8885
8914
  token_endpoint?: string | undefined;
@@ -8898,6 +8927,7 @@ export declare const connectionSchema: z.ZodObject<{
8898
8927
  kid?: string | undefined;
8899
8928
  team_id?: string | undefined;
8900
8929
  realms?: string | undefined;
8930
+ authentication_method?: string | undefined;
8901
8931
  app_secret?: string | undefined;
8902
8932
  authorization_endpoint?: string | undefined;
8903
8933
  token_endpoint?: string | undefined;
@@ -8921,6 +8951,7 @@ export declare const connectionSchema: z.ZodObject<{
8921
8951
  kid?: string | undefined;
8922
8952
  team_id?: string | undefined;
8923
8953
  realms?: string | undefined;
8954
+ authentication_method?: string | undefined;
8924
8955
  app_secret?: string | undefined;
8925
8956
  authorization_endpoint?: string | undefined;
8926
8957
  token_endpoint?: string | undefined;
@@ -8953,6 +8984,7 @@ export declare const connectionSchema: z.ZodObject<{
8953
8984
  kid?: string | undefined;
8954
8985
  team_id?: string | undefined;
8955
8986
  realms?: string | undefined;
8987
+ authentication_method?: string | undefined;
8956
8988
  app_secret?: string | undefined;
8957
8989
  authorization_endpoint?: string | undefined;
8958
8990
  token_endpoint?: string | undefined;
@@ -15135,6 +15167,7 @@ export declare function init(config: AuthHeroConfig): {
15135
15167
  kid?: string | undefined | undefined;
15136
15168
  team_id?: string | undefined | undefined;
15137
15169
  realms?: string | undefined | undefined;
15170
+ authentication_method?: string | undefined | undefined;
15138
15171
  app_secret?: string | undefined | undefined;
15139
15172
  authorization_endpoint?: string | undefined | undefined;
15140
15173
  token_endpoint?: string | undefined | undefined;
@@ -15167,6 +15200,7 @@ export declare function init(config: AuthHeroConfig): {
15167
15200
  kid?: string | undefined | undefined;
15168
15201
  team_id?: string | undefined | undefined;
15169
15202
  realms?: string | undefined | undefined;
15203
+ authentication_method?: string | undefined | undefined;
15170
15204
  app_secret?: string | undefined | undefined;
15171
15205
  authorization_endpoint?: string | undefined | undefined;
15172
15206
  token_endpoint?: string | undefined | undefined;
@@ -15213,6 +15247,7 @@ export declare function init(config: AuthHeroConfig): {
15213
15247
  kid?: string | undefined | undefined;
15214
15248
  team_id?: string | undefined | undefined;
15215
15249
  realms?: string | undefined | undefined;
15250
+ authentication_method?: string | undefined | undefined;
15216
15251
  app_secret?: string | undefined | undefined;
15217
15252
  authorization_endpoint?: string | undefined | undefined;
15218
15253
  token_endpoint?: string | undefined | undefined;
@@ -15276,6 +15311,7 @@ export declare function init(config: AuthHeroConfig): {
15276
15311
  kid?: string | undefined;
15277
15312
  team_id?: string | undefined;
15278
15313
  realms?: string | undefined;
15314
+ authentication_method?: string | undefined;
15279
15315
  app_secret?: string | undefined;
15280
15316
  authorization_endpoint?: string | undefined;
15281
15317
  token_endpoint?: string | undefined;
@@ -15303,6 +15339,7 @@ export declare function init(config: AuthHeroConfig): {
15303
15339
  kid?: string | undefined | undefined;
15304
15340
  team_id?: string | undefined | undefined;
15305
15341
  realms?: string | undefined | undefined;
15342
+ authentication_method?: string | undefined | undefined;
15306
15343
  app_secret?: string | undefined | undefined;
15307
15344
  authorization_endpoint?: string | undefined | undefined;
15308
15345
  token_endpoint?: string | undefined | undefined;
@@ -15346,6 +15383,7 @@ export declare function init(config: AuthHeroConfig): {
15346
15383
  kid?: string | undefined;
15347
15384
  team_id?: string | undefined;
15348
15385
  realms?: string | undefined;
15386
+ authentication_method?: string | undefined;
15349
15387
  app_secret?: string | undefined;
15350
15388
  authorization_endpoint?: string | undefined;
15351
15389
  token_endpoint?: string | undefined;
@@ -15372,6 +15410,7 @@ export declare function init(config: AuthHeroConfig): {
15372
15410
  kid?: string | undefined | undefined;
15373
15411
  team_id?: string | undefined | undefined;
15374
15412
  realms?: string | undefined | undefined;
15413
+ authentication_method?: string | undefined | undefined;
15375
15414
  app_secret?: string | undefined | undefined;
15376
15415
  authorization_endpoint?: string | undefined | undefined;
15377
15416
  token_endpoint?: string | undefined | undefined;
package/dist/authhero.mjs CHANGED
@@ -1760,6 +1760,7 @@ const _s = o.object({
1760
1760
  kid: o.string().optional(),
1761
1761
  team_id: o.string().optional(),
1762
1762
  realms: o.string().optional(),
1763
+ authentication_method: o.string().optional(),
1763
1764
  client_id: o.string().optional(),
1764
1765
  client_secret: o.string().optional(),
1765
1766
  app_secret: o.string().optional(),
@@ -1855,6 +1856,12 @@ const k1 = o.enum([
1855
1856
  redirect_uri: o.string().optional().openapi({
1856
1857
  description: "The redirect URI associated with the code"
1857
1858
  }),
1859
+ nonce: o.string().optional().openapi({
1860
+ description: "The nonce value used for security in OIDC flows"
1861
+ }),
1862
+ state: o.string().optional().openapi({
1863
+ description: "The state parameter used for CSRF protection in OAuth flows"
1864
+ }),
1858
1865
  expires_at: o.string(),
1859
1866
  used_at: o.string().optional(),
1860
1867
  user_id: o.string().optional()
@@ -5983,7 +5990,9 @@ async function Fh(t, e) {
5983
5990
  ).toISOString(),
5984
5991
  code_challenge: e.authParams.code_challenge,
5985
5992
  code_challenge_method: e.authParams.code_challenge_method,
5986
- redirect_uri: e.authParams.redirect_uri
5993
+ redirect_uri: e.authParams.redirect_uri,
5994
+ state: e.authParams.state,
5995
+ nonce: e.authParams.nonce
5987
5996
  })).code_id,
5988
5997
  state: e.authParams.state
5989
5998
  };
@@ -6073,7 +6082,9 @@ async function Zt(t, e) {
6073
6082
  login_id: e.loginSession.id,
6074
6083
  expires_at: new Date(Date.now() + m_).toISOString(),
6075
6084
  code_verifier: [b, v].join("|"),
6076
- redirect_uri: n.redirect_uri
6085
+ redirect_uri: n.redirect_uri,
6086
+ state: n.state,
6087
+ nonce: n.nonce
6077
6088
  });
6078
6089
  return t.json({
6079
6090
  login_ticket: E.code_id,
@@ -19845,6 +19856,9 @@ async function pb(t, e) {
19845
19856
  loginSession: i,
19846
19857
  authParams: {
19847
19858
  ...i.authParams,
19859
+ // Use the state and nonce from the code as it might differ if it's a silent auth login
19860
+ state: r.state,
19861
+ nonce: r.nonce,
19848
19862
  // Ensure WEB_MESSAGE is explicitly passed, as createAuthResponse relies on it
19849
19863
  response_mode: an.WEB_MESSAGE,
19850
19864
  // Pass through other relevant authParams from the loginSession or original request if necessary
@@ -21534,7 +21548,7 @@ function hi(t, e = "US") {
21534
21548
  if (n.includes("@")) {
21535
21549
  const r = n.toLowerCase(), i = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);
21536
21550
  return {
21537
- connection: "email",
21551
+ connectionType: "email",
21538
21552
  normalized: i ? r : null,
21539
21553
  isValid: i
21540
21554
  };
@@ -21543,18 +21557,18 @@ function hi(t, e = "US") {
21543
21557
  defaultCountry: e
21544
21558
  });
21545
21559
  return r && r.isValid() ? {
21546
- connection: "sms",
21560
+ connectionType: "sms",
21547
21561
  normalized: r.number,
21548
21562
  // E.164 format
21549
21563
  isValid: !0
21550
21564
  } : {
21551
- connection: "sms",
21565
+ connectionType: "sms",
21552
21566
  normalized: null,
21553
21567
  isValid: !1
21554
21568
  };
21555
21569
  } else
21556
21570
  return {
21557
- connection: "username",
21571
+ connectionType: "username",
21558
21572
  normalized: n,
21559
21573
  isValid: !0
21560
21574
  };
@@ -21571,7 +21585,7 @@ async function ua(t, {
21571
21585
  otp: r,
21572
21586
  authParams: i
21573
21587
  }) {
21574
- const s = jt(t.req), { connection: a, normalized: c } = hi(
21588
+ const s = jt(t.req), { connectionType: a, normalized: c } = hi(
21575
21589
  n,
21576
21590
  s.countryCode
21577
21591
  );
@@ -21922,7 +21936,7 @@ async function im(t, { to: e, code: n }) {
21922
21936
  const r = await t.env.data.tenants.get(t.var.tenant_id);
21923
21937
  if (!r)
21924
21938
  throw new A(500, { message: "Tenant not found" });
21925
- const { connection: i } = hi(e), s = new URL(lt(t.env)), a = {
21939
+ const { connectionType: i } = hi(e), s = new URL(lt(t.env)), a = {
21926
21940
  vendorName: r.name,
21927
21941
  vendorId: r.id,
21928
21942
  loginDomain: s.hostname,
@@ -21967,7 +21981,7 @@ async function Vl(t, { to: e, code: n, authParams: r }) {
21967
21981
  throw new A(500, { message: "Tenant not found" });
21968
21982
  if (!r.redirect_uri)
21969
21983
  throw new A(400, { message: "redirect_uri is required" });
21970
- const { connection: s } = hi(e), a = new URL(Re(t.env));
21984
+ const { connectionType: s } = hi(e), a = new URL(Re(t.env));
21971
21985
  a.pathname = "passwordless/verify_redirect", a.searchParams.set("verification_code", n), a.searchParams.set("connection", s), a.searchParams.set("client_id", r.client_id), a.searchParams.set("redirect_uri", r.redirect_uri), a.searchParams.set("email", e), r.response_type && a.searchParams.set("response_type", r.response_type), r.scope && a.searchParams.set("scope", r.scope), r.state && a.searchParams.set("state", r.state), r.nonce && a.searchParams.set("nonce", r.nonce), r.code_challenge && a.searchParams.set("code_challenge", r.code_challenge), r.code_challenge_method && a.searchParams.set(
21972
21986
  "code_challenge_method",
21973
21987
  r.code_challenge_method
@@ -24184,11 +24198,11 @@ const g$ = new ae().openapi(
24184
24198
  try {
24185
24199
  await Zy(t, i, t.env.data, d);
24186
24200
  } catch {
24187
- const y = be(t, {
24201
+ const v = be(t, {
24188
24202
  type: _e.FAILED_SIGNUP,
24189
24203
  description: "Public signup is disabled"
24190
24204
  });
24191
- return await t.env.data.logs.create(i.tenant.id, y), t.html(
24205
+ return await t.env.data.logs.create(i.tenant.id, v), t.html(
24192
24206
  /* @__PURE__ */ _(
24193
24207
  La,
24194
24208
  {
@@ -24232,8 +24246,17 @@ const g$ = new ae().openapi(
24232
24246
  redirect_uri: s.authParams.redirect_uri
24233
24247
  }), w = h$(
24234
24248
  s.auth0Client
24235
- ), { connection: h } = hi(d);
24236
- return h === "email" && w === "link" && !d.includes("online.no") ? await Vl(t, {
24249
+ ), { connectionType: h } = hi(d), y = i.connections.find(
24250
+ (v) => v.strategy === h
24251
+ );
24252
+ if (!y)
24253
+ throw new A(400, {
24254
+ message: P.t("connection_not_found", {
24255
+ connection: h
24256
+ })
24257
+ });
24258
+ return h === "email" && w === "link" && // This is different to how it works in auth0
24259
+ y.options.authentication_method === "magic_link" ? await Vl(t, {
24237
24260
  to: d,
24238
24261
  code: m.code_id,
24239
24262
  authParams: s.authParams
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authhero",
3
- "version": "0.152.0",
3
+ "version": "0.154.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -36,7 +36,7 @@
36
36
  "vite": "^5.4.11",
37
37
  "vite-plugin-dts": "^4.3.0",
38
38
  "vitest": "^2.1.5",
39
- "@authhero/kysely-adapter": "^10.19.0"
39
+ "@authhero/kysely-adapter": "^10.20.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "@peculiar/x509": "^1.12.3",
@@ -49,7 +49,7 @@
49
49
  "libphonenumber-js": "^1.12.8",
50
50
  "nanoid": "^5.0.8",
51
51
  "oslo": "^1.2.1",
52
- "@authhero/adapter-interfaces": "^0.69.0"
52
+ "@authhero/adapter-interfaces": "^0.71.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@hono/zod-openapi": "^0.19.2",