authhero 0.149.0 → 0.151.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,11 @@ 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
+ ]>>;
8592
8597
  expires_at: z.ZodString;
8593
8598
  used_at: z.ZodOptional<z.ZodString>;
8594
8599
  user_id: z.ZodOptional<z.ZodString>;
@@ -8598,6 +8603,8 @@ export declare const codeInsertSchema: z.ZodObject<{
8598
8603
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8599
8604
  expires_at: string;
8600
8605
  user_id?: string | undefined;
8606
+ code_challenge_method?: "S256" | "plain" | undefined;
8607
+ code_challenge?: string | undefined;
8601
8608
  connection_id?: string | undefined;
8602
8609
  code_verifier?: string | undefined;
8603
8610
  used_at?: string | undefined;
@@ -8607,6 +8614,8 @@ export declare const codeInsertSchema: z.ZodObject<{
8607
8614
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8608
8615
  expires_at: string;
8609
8616
  user_id?: string | undefined;
8617
+ code_challenge_method?: "S256" | "plain" | undefined;
8618
+ code_challenge?: string | undefined;
8610
8619
  connection_id?: string | undefined;
8611
8620
  code_verifier?: string | undefined;
8612
8621
  used_at?: string | undefined;
@@ -8626,6 +8635,11 @@ export declare const codeSchema: z.ZodObject<{
8626
8635
  "ticket"
8627
8636
  ]>;
8628
8637
  code_verifier: z.ZodOptional<z.ZodString>;
8638
+ code_challenge: z.ZodOptional<z.ZodString>;
8639
+ code_challenge_method: z.ZodOptional<z.ZodEnum<[
8640
+ "plain",
8641
+ "S256"
8642
+ ]>>;
8629
8643
  expires_at: z.ZodString;
8630
8644
  used_at: z.ZodOptional<z.ZodString>;
8631
8645
  user_id: z.ZodOptional<z.ZodString>;
@@ -8636,6 +8650,8 @@ export declare const codeSchema: z.ZodObject<{
8636
8650
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8637
8651
  expires_at: string;
8638
8652
  user_id?: string | undefined;
8653
+ code_challenge_method?: "S256" | "plain" | undefined;
8654
+ code_challenge?: string | undefined;
8639
8655
  connection_id?: string | undefined;
8640
8656
  code_verifier?: string | undefined;
8641
8657
  used_at?: string | undefined;
@@ -8646,6 +8662,8 @@ export declare const codeSchema: z.ZodObject<{
8646
8662
  code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
8647
8663
  expires_at: string;
8648
8664
  user_id?: string | undefined;
8665
+ code_challenge_method?: "S256" | "plain" | undefined;
8666
+ code_challenge?: string | undefined;
8649
8667
  connection_id?: string | undefined;
8650
8668
  code_verifier?: string | undefined;
8651
8669
  used_at?: string | undefined;
@@ -17296,9 +17314,9 @@ export declare function init(config: AuthHeroConfig): {
17296
17314
  scope?: string | undefined;
17297
17315
  login_ticket?: string | undefined;
17298
17316
  screen_hint?: string | undefined;
17317
+ code_challenge?: string | undefined;
17299
17318
  code_challenge_method?: CodeChallengeMethod | undefined;
17300
17319
  realm?: string | undefined;
17301
- code_challenge?: string | undefined;
17302
17320
  organization?: string | undefined;
17303
17321
  prompt?: string | undefined;
17304
17322
  ui_locales?: string | undefined;
@@ -17325,9 +17343,9 @@ export declare function init(config: AuthHeroConfig): {
17325
17343
  scope?: string | undefined;
17326
17344
  login_ticket?: string | undefined;
17327
17345
  screen_hint?: string | undefined;
17346
+ code_challenge?: string | undefined;
17328
17347
  code_challenge_method?: CodeChallengeMethod | undefined;
17329
17348
  realm?: string | undefined;
17330
- code_challenge?: string | undefined;
17331
17349
  organization?: string | undefined;
17332
17350
  prompt?: string | undefined;
17333
17351
  ui_locales?: string | undefined;
@@ -17354,9 +17372,9 @@ export declare function init(config: AuthHeroConfig): {
17354
17372
  scope?: string | undefined;
17355
17373
  login_ticket?: string | undefined;
17356
17374
  screen_hint?: string | undefined;
17375
+ code_challenge?: string | undefined;
17357
17376
  code_challenge_method?: CodeChallengeMethod | undefined;
17358
17377
  realm?: string | undefined;
17359
- code_challenge?: string | undefined;
17360
17378
  organization?: string | undefined;
17361
17379
  prompt?: string | undefined;
17362
17380
  ui_locales?: string | undefined;
@@ -17391,9 +17409,9 @@ export declare function init(config: AuthHeroConfig): {
17391
17409
  scope?: string | undefined;
17392
17410
  login_ticket?: string | undefined;
17393
17411
  screen_hint?: string | undefined;
17412
+ code_challenge?: string | undefined;
17394
17413
  code_challenge_method?: CodeChallengeMethod | undefined;
17395
17414
  realm?: string | undefined;
17396
- code_challenge?: string | undefined;
17397
17415
  organization?: string | undefined;
17398
17416
  prompt?: string | undefined;
17399
17417
  ui_locales?: string | undefined;
@@ -17422,9 +17440,9 @@ export declare function init(config: AuthHeroConfig): {
17422
17440
  scope?: string | undefined;
17423
17441
  login_ticket?: string | undefined;
17424
17442
  screen_hint?: string | undefined;
17443
+ code_challenge?: string | undefined;
17425
17444
  code_challenge_method?: CodeChallengeMethod | undefined;
17426
17445
  realm?: string | undefined;
17427
- code_challenge?: string | undefined;
17428
17446
  organization?: string | undefined;
17429
17447
  prompt?: string | undefined;
17430
17448
  ui_locales?: string | undefined;
@@ -17482,8 +17500,8 @@ export declare function init(config: AuthHeroConfig): {
17482
17500
  state?: string | undefined;
17483
17501
  scope?: string | undefined;
17484
17502
  redirect_uri?: string | undefined;
17485
- code_challenge_method?: CodeChallengeMethod | undefined;
17486
17503
  code_challenge?: string | undefined;
17504
+ code_challenge_method?: CodeChallengeMethod | undefined;
17487
17505
  act_as?: string | undefined;
17488
17506
  organization?: string | undefined;
17489
17507
  prompt?: string | undefined;
@@ -17504,8 +17522,8 @@ export declare function init(config: AuthHeroConfig): {
17504
17522
  state?: string | undefined;
17505
17523
  scope?: string | undefined;
17506
17524
  redirect_uri?: string | undefined;
17507
- code_challenge_method?: CodeChallengeMethod | undefined;
17508
17525
  code_challenge?: string | undefined;
17526
+ code_challenge_method?: CodeChallengeMethod | undefined;
17509
17527
  act_as?: string | undefined;
17510
17528
  organization?: string | undefined;
17511
17529
  prompt?: string | undefined;
package/dist/authhero.mjs CHANGED
@@ -1846,6 +1846,12 @@ 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
+ }),
1849
1855
  expires_at: o.string(),
1850
1856
  used_at: o.string().optional(),
1851
1857
  user_id: o.string().optional()
@@ -5971,7 +5977,9 @@ async function Fh(t, e) {
5971
5977
  login_id: e.login_id,
5972
5978
  expires_at: new Date(
5973
5979
  Date.now() + h_ * 1e3
5974
- ).toISOString()
5980
+ ).toISOString(),
5981
+ code_challenge: e.authParams.code_challenge,
5982
+ code_challenge_method: e.authParams.code_challenge_method
5975
5983
  })).code_id,
5976
5984
  state: e.authParams.state
5977
5985
  };
@@ -6161,7 +6169,6 @@ async function Zt(t, e) {
6161
6169
  client: i,
6162
6170
  authParams: n,
6163
6171
  login_id: e.loginSession.id
6164
- // Use login session id instead of session_id
6165
6172
  });
6166
6173
  if (!n.redirect_uri)
6167
6174
  throw new A(400, {
@@ -19814,12 +19821,12 @@ async function pb(t, e) {
19814
19821
  const a = await t.env.data.clients.get("DEFAULT_CLIENT");
19815
19822
  if (!os(n.client_secret, e.client_secret) && !os(a == null ? void 0 : a.client_secret, e.client_secret))
19816
19823
  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") {
19824
+ } else if (r.code_challenge && r.code_challenge_method && e.code_verifier) {
19818
19825
  const a = await u_(
19819
19826
  e.code_verifier,
19820
- i.authParams.code_challenge_method
19827
+ r.code_challenge_method
19821
19828
  );
19822
- if (!os(a, i.authParams.code_challenge || ""))
19829
+ if (!os(a, r.code_challenge))
19823
19830
  throw new A(403, { message: "Invalid client credentials" });
19824
19831
  }
19825
19832
  if (i.authParams.redirect_uri && i.authParams.redirect_uri !== e.redirect_uri)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authhero",
3
- "version": "0.149.0",
3
+ "version": "0.151.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.18.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.68.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@hono/zod-openapi": "^0.19.2",