authhero 0.150.0 → 0.152.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.
@@ -8589,6 +8589,12 @@ export declare const codeInsertSchema: z.ZodObject<{
8589
8589
  "ticket"
8590
8590
  ]>;
8591
8591
  code_verifier: z.ZodOptional<z.ZodString>;
8592
+ code_challenge: z.ZodOptional<z.ZodString>;
8593
+ code_challenge_method: z.ZodOptional<z.ZodEnum<[
8594
+ "plain",
8595
+ "S256"
8596
+ ]>>;
8597
+ redirect_uri: z.ZodOptional<z.ZodString>;
8592
8598
  expires_at: z.ZodString;
8593
8599
  used_at: z.ZodOptional<z.ZodString>;
8594
8600
  user_id: z.ZodOptional<z.ZodString>;
@@ -8598,6 +8604,9 @@ export declare const codeInsertSchema: z.ZodObject<{
8598
8604
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8599
8605
  expires_at: string;
8600
8606
  user_id?: string | undefined;
8607
+ redirect_uri?: string | undefined;
8608
+ code_challenge_method?: "S256" | "plain" | undefined;
8609
+ code_challenge?: string | undefined;
8601
8610
  connection_id?: string | undefined;
8602
8611
  code_verifier?: string | undefined;
8603
8612
  used_at?: string | undefined;
@@ -8607,6 +8616,9 @@ export declare const codeInsertSchema: z.ZodObject<{
8607
8616
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8608
8617
  expires_at: string;
8609
8618
  user_id?: string | undefined;
8619
+ redirect_uri?: string | undefined;
8620
+ code_challenge_method?: "S256" | "plain" | undefined;
8621
+ code_challenge?: string | undefined;
8610
8622
  connection_id?: string | undefined;
8611
8623
  code_verifier?: string | undefined;
8612
8624
  used_at?: string | undefined;
@@ -8626,6 +8638,12 @@ export declare const codeSchema: z.ZodObject<{
8626
8638
  "ticket"
8627
8639
  ]>;
8628
8640
  code_verifier: z.ZodOptional<z.ZodString>;
8641
+ code_challenge: z.ZodOptional<z.ZodString>;
8642
+ code_challenge_method: z.ZodOptional<z.ZodEnum<[
8643
+ "plain",
8644
+ "S256"
8645
+ ]>>;
8646
+ redirect_uri: z.ZodOptional<z.ZodString>;
8629
8647
  expires_at: z.ZodString;
8630
8648
  used_at: z.ZodOptional<z.ZodString>;
8631
8649
  user_id: z.ZodOptional<z.ZodString>;
@@ -8636,6 +8654,9 @@ export declare const codeSchema: z.ZodObject<{
8636
8654
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8637
8655
  expires_at: string;
8638
8656
  user_id?: string | undefined;
8657
+ redirect_uri?: string | undefined;
8658
+ code_challenge_method?: "S256" | "plain" | undefined;
8659
+ code_challenge?: string | undefined;
8639
8660
  connection_id?: string | undefined;
8640
8661
  code_verifier?: string | undefined;
8641
8662
  used_at?: string | undefined;
@@ -8646,6 +8667,9 @@ export declare const codeSchema: z.ZodObject<{
8646
8667
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8647
8668
  expires_at: string;
8648
8669
  user_id?: string | undefined;
8670
+ redirect_uri?: string | undefined;
8671
+ code_challenge_method?: "S256" | "plain" | undefined;
8672
+ code_challenge?: string | undefined;
8649
8673
  connection_id?: string | undefined;
8650
8674
  code_verifier?: string | undefined;
8651
8675
  used_at?: string | undefined;
@@ -17296,9 +17320,9 @@ export declare function init(config: AuthHeroConfig): {
17296
17320
  scope?: string | undefined;
17297
17321
  login_ticket?: string | undefined;
17298
17322
  screen_hint?: string | undefined;
17323
+ code_challenge?: string | undefined;
17299
17324
  code_challenge_method?: CodeChallengeMethod | undefined;
17300
17325
  realm?: string | undefined;
17301
- code_challenge?: string | undefined;
17302
17326
  organization?: string | undefined;
17303
17327
  prompt?: string | undefined;
17304
17328
  ui_locales?: string | undefined;
@@ -17325,9 +17349,9 @@ export declare function init(config: AuthHeroConfig): {
17325
17349
  scope?: string | undefined;
17326
17350
  login_ticket?: string | undefined;
17327
17351
  screen_hint?: string | undefined;
17352
+ code_challenge?: string | undefined;
17328
17353
  code_challenge_method?: CodeChallengeMethod | undefined;
17329
17354
  realm?: string | undefined;
17330
- code_challenge?: string | undefined;
17331
17355
  organization?: string | undefined;
17332
17356
  prompt?: string | undefined;
17333
17357
  ui_locales?: string | undefined;
@@ -17354,9 +17378,9 @@ export declare function init(config: AuthHeroConfig): {
17354
17378
  scope?: string | undefined;
17355
17379
  login_ticket?: string | undefined;
17356
17380
  screen_hint?: string | undefined;
17381
+ code_challenge?: string | undefined;
17357
17382
  code_challenge_method?: CodeChallengeMethod | undefined;
17358
17383
  realm?: string | undefined;
17359
- code_challenge?: string | undefined;
17360
17384
  organization?: string | undefined;
17361
17385
  prompt?: string | undefined;
17362
17386
  ui_locales?: string | undefined;
@@ -17391,9 +17415,9 @@ export declare function init(config: AuthHeroConfig): {
17391
17415
  scope?: string | undefined;
17392
17416
  login_ticket?: string | undefined;
17393
17417
  screen_hint?: string | undefined;
17418
+ code_challenge?: string | undefined;
17394
17419
  code_challenge_method?: CodeChallengeMethod | undefined;
17395
17420
  realm?: string | undefined;
17396
- code_challenge?: string | undefined;
17397
17421
  organization?: string | undefined;
17398
17422
  prompt?: string | undefined;
17399
17423
  ui_locales?: string | undefined;
@@ -17422,9 +17446,9 @@ export declare function init(config: AuthHeroConfig): {
17422
17446
  scope?: string | undefined;
17423
17447
  login_ticket?: string | undefined;
17424
17448
  screen_hint?: string | undefined;
17449
+ code_challenge?: string | undefined;
17425
17450
  code_challenge_method?: CodeChallengeMethod | undefined;
17426
17451
  realm?: string | undefined;
17427
- code_challenge?: string | undefined;
17428
17452
  organization?: string | undefined;
17429
17453
  prompt?: string | undefined;
17430
17454
  ui_locales?: string | undefined;
@@ -17482,8 +17506,8 @@ export declare function init(config: AuthHeroConfig): {
17482
17506
  state?: string | undefined;
17483
17507
  scope?: string | undefined;
17484
17508
  redirect_uri?: string | undefined;
17485
- code_challenge_method?: CodeChallengeMethod | undefined;
17486
17509
  code_challenge?: string | undefined;
17510
+ code_challenge_method?: CodeChallengeMethod | undefined;
17487
17511
  act_as?: string | undefined;
17488
17512
  organization?: string | undefined;
17489
17513
  prompt?: string | undefined;
@@ -17504,8 +17528,8 @@ export declare function init(config: AuthHeroConfig): {
17504
17528
  state?: string | undefined;
17505
17529
  scope?: string | undefined;
17506
17530
  redirect_uri?: string | undefined;
17507
- code_challenge_method?: CodeChallengeMethod | undefined;
17508
17531
  code_challenge?: string | undefined;
17532
+ code_challenge_method?: CodeChallengeMethod | undefined;
17509
17533
  act_as?: string | undefined;
17510
17534
  organization?: string | undefined;
17511
17535
  prompt?: string | undefined;
package/dist/authhero.mjs CHANGED
@@ -1846,6 +1846,15 @@ const k1 = o.enum([
1846
1846
  code_verifier: o.string().optional().openapi({
1847
1847
  description: "The code verifier used in PKCE in outbound flows"
1848
1848
  }),
1849
+ code_challenge: o.string().optional().openapi({
1850
+ description: "The code challenge used in PKCE in outbound flows"
1851
+ }),
1852
+ code_challenge_method: o.enum(["plain", "S256"]).optional().openapi({
1853
+ description: "The code challenge method used in PKCE in outbound flows"
1854
+ }),
1855
+ redirect_uri: o.string().optional().openapi({
1856
+ description: "The redirect URI associated with the code"
1857
+ }),
1849
1858
  expires_at: o.string(),
1850
1859
  used_at: o.string().optional(),
1851
1860
  user_id: o.string().optional()
@@ -5972,7 +5981,9 @@ async function Fh(t, e) {
5972
5981
  expires_at: new Date(
5973
5982
  Date.now() + h_ * 1e3
5974
5983
  ).toISOString(),
5975
- code_verifier: e.authParams.code_challenge
5984
+ code_challenge: e.authParams.code_challenge,
5985
+ code_challenge_method: e.authParams.code_challenge_method,
5986
+ redirect_uri: e.authParams.redirect_uri
5976
5987
  })).code_id,
5977
5988
  state: e.authParams.state
5978
5989
  };
@@ -6061,7 +6072,8 @@ async function Zt(t, e) {
6061
6072
  code_type: "ticket",
6062
6073
  login_id: e.loginSession.id,
6063
6074
  expires_at: new Date(Date.now() + m_).toISOString(),
6064
- code_verifier: [b, v].join("|")
6075
+ code_verifier: [b, v].join("|"),
6076
+ redirect_uri: n.redirect_uri
6065
6077
  });
6066
6078
  return t.json({
6067
6079
  login_ticket: E.code_id,
@@ -19814,15 +19826,15 @@ async function pb(t, e) {
19814
19826
  const a = await t.env.data.clients.get("DEFAULT_CLIENT");
19815
19827
  if (!os(n.client_secret, e.client_secret) && !os(a == null ? void 0 : a.client_secret, e.client_secret))
19816
19828
  throw new A(403, { message: "Invalid client credentials" });
19817
- } else if ("code_verifier" in e && typeof e.code_verifier == "string" && "code_challenge_method" in i.authParams && typeof i.authParams.code_challenge_method == "string") {
19829
+ } else if (r.code_challenge && r.code_challenge_method && e.code_verifier) {
19818
19830
  const a = await u_(
19819
19831
  e.code_verifier,
19820
- i.authParams.code_challenge_method
19832
+ r.code_challenge_method
19821
19833
  );
19822
- if (!os(a, i.authParams.code_challenge || ""))
19834
+ if (!os(a, r.code_challenge))
19823
19835
  throw new A(403, { message: "Invalid client credentials" });
19824
19836
  }
19825
- if (i.authParams.redirect_uri && i.authParams.redirect_uri !== e.redirect_uri)
19837
+ if (r.redirect_uri && r.redirect_uri !== e.redirect_uri)
19826
19838
  throw new A(403, { message: "Invalid redirect uri" });
19827
19839
  const s = await t.env.data.users.get(n.tenant.id, r.user_id);
19828
19840
  if (!s)
@@ -22270,7 +22282,8 @@ const A4 = new ae().openapi(
22270
22282
  code_id: Dn(),
22271
22283
  code_type: "otp",
22272
22284
  login_id: m.id,
22273
- expires_at: new Date(Date.now() + es).toISOString()
22285
+ expires_at: new Date(Date.now() + es).toISOString(),
22286
+ redirect_uri: s.redirect_uri
22274
22287
  });
22275
22288
  return i === "link" ? await Vl(t, {
22276
22289
  to: d,
@@ -22689,7 +22702,8 @@ async function C4({
22689
22702
  login_id: u.id,
22690
22703
  expires_at: new Date(
22691
22704
  Date.now() + Zr * 1e3
22692
- ).toISOString()
22705
+ ).toISOString(),
22706
+ redirect_uri: r.redirect_uri
22693
22707
  }), await Vl(t, {
22694
22708
  code: f,
22695
22709
  to: s,
@@ -24214,7 +24228,8 @@ const g$ = new ae().openapi(
24214
24228
  code_id: u,
24215
24229
  code_type: "otp",
24216
24230
  login_id: s.id,
24217
- expires_at: new Date(Date.now() + es).toISOString()
24231
+ expires_at: new Date(Date.now() + es).toISOString(),
24232
+ redirect_uri: s.authParams.redirect_uri
24218
24233
  }), w = h$(
24219
24234
  s.auth0Client
24220
24235
  ), { connection: h } = hi(d);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authhero",
3
- "version": "0.150.0",
3
+ "version": "0.152.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.17.0"
39
+ "@authhero/kysely-adapter": "^10.19.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.67.0"
52
+ "@authhero/adapter-interfaces": "^0.69.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@hono/zod-openapi": "^0.19.2",