@entro314labs/entro-auth-core 1.8.0-beta.11 → 1.8.0-beta.13

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 (96) hide show
  1. package/dist/api/index.d.mts +1 -1
  2. package/dist/api/index.mjs +1 -1
  3. package/dist/context/endpoint-context.d.mts +2 -2
  4. package/dist/context/endpoint-context.mjs +1 -1
  5. package/dist/context/global.d.mts +1 -1
  6. package/dist/context/global.mjs +1 -1
  7. package/dist/context/request-state.mjs +1 -1
  8. package/dist/context/transaction.d.mts +1 -1
  9. package/dist/context/transaction.mjs +1 -1
  10. package/dist/db/adapter/atomic-fallback.mjs +1 -1
  11. package/dist/db/adapter/factory.mjs +1 -1
  12. package/dist/db/adapter/get-id-field.mjs +2 -2
  13. package/dist/db/database-index.mjs +1 -1
  14. package/dist/db/schema/account.d.mts +1 -1
  15. package/dist/db/schema/account.mjs +1 -1
  16. package/dist/db/schema/rate-limit.d.mts +1 -1
  17. package/dist/db/schema/session.d.mts +1 -1
  18. package/dist/db/schema/session.mjs +1 -1
  19. package/dist/db/schema/user.d.mts +1 -1
  20. package/dist/db/schema/user.mjs +1 -1
  21. package/dist/db/schema/verification.d.mts +1 -1
  22. package/dist/db/schema/verification.mjs +1 -1
  23. package/dist/db/schema-check.d.mts +6 -0
  24. package/dist/db/type.d.mts +1 -1
  25. package/dist/error/index.d.mts +1 -1
  26. package/dist/error/index.mjs +1 -1
  27. package/dist/instrumentation/noop.mjs +1 -2
  28. package/dist/instrumentation/pure.index.d.mts +11 -0
  29. package/dist/instrumentation/tracer.mjs +1 -1
  30. package/dist/oauth2/authorization-params.mjs +1 -1
  31. package/dist/oauth2/client-credentials-token.d.mts +1 -1
  32. package/dist/oauth2/dpop.d.mts +1 -1
  33. package/dist/oauth2/dpop.mjs +1 -1
  34. package/dist/oauth2/oauth-provider.d.mts +1 -1
  35. package/dist/oauth2/pushed-authorization-request.d.mts +1 -1
  36. package/dist/oauth2/refresh-access-token.d.mts +1 -1
  37. package/dist/oauth2/reject-redirects.mjs +1 -1
  38. package/dist/oauth2/validate-authorization-code.d.mts +3 -3
  39. package/dist/oauth2/verify-id-token.d.mts +3 -1
  40. package/dist/oauth2/verify.d.mts +1 -1
  41. package/dist/oauth2/verify.mjs +2 -2
  42. package/dist/social-providers/apple.d.mts +2 -2
  43. package/dist/social-providers/apple.mjs +1 -1
  44. package/dist/social-providers/atlassian.mjs +1 -1
  45. package/dist/social-providers/cloudflare.mjs +1 -1
  46. package/dist/social-providers/cognito.d.mts +2 -2
  47. package/dist/social-providers/cognito.mjs +2 -2
  48. package/dist/social-providers/discord.mjs +1 -1
  49. package/dist/social-providers/dropbox.mjs +1 -1
  50. package/dist/social-providers/facebook.d.mts +1 -8
  51. package/dist/social-providers/facebook.mjs +2 -2
  52. package/dist/social-providers/figma.mjs +1 -1
  53. package/dist/social-providers/github.mjs +1 -1
  54. package/dist/social-providers/gitlab.mjs +1 -1
  55. package/dist/social-providers/google.d.mts +2 -2
  56. package/dist/social-providers/google.mjs +1 -1
  57. package/dist/social-providers/huggingface.mjs +1 -1
  58. package/dist/social-providers/index.d.mts +7 -21
  59. package/dist/social-providers/index.mjs +1 -1
  60. package/dist/social-providers/kakao.d.mts +1 -8
  61. package/dist/social-providers/kakao.mjs +2 -2
  62. package/dist/social-providers/kick.mjs +1 -1
  63. package/dist/social-providers/line.mjs +2 -2
  64. package/dist/social-providers/linear.mjs +1 -1
  65. package/dist/social-providers/linkedin.mjs +1 -1
  66. package/dist/social-providers/microsoft-entra-id.d.mts +2 -2
  67. package/dist/social-providers/microsoft-entra-id.mjs +3 -3
  68. package/dist/social-providers/naver.mjs +1 -1
  69. package/dist/social-providers/notion.mjs +1 -1
  70. package/dist/social-providers/paybin.mjs +2 -2
  71. package/dist/social-providers/paypal.mjs +2 -2
  72. package/dist/social-providers/polar.mjs +1 -1
  73. package/dist/social-providers/railway.mjs +1 -1
  74. package/dist/social-providers/reddit.mjs +1 -1
  75. package/dist/social-providers/roblox.mjs +1 -1
  76. package/dist/social-providers/salesforce.mjs +1 -1
  77. package/dist/social-providers/slack.mjs +1 -1
  78. package/dist/social-providers/spotify.mjs +1 -1
  79. package/dist/social-providers/tiktok.mjs +1 -1
  80. package/dist/social-providers/twitch.mjs +2 -2
  81. package/dist/social-providers/twitter.mjs +1 -1
  82. package/dist/social-providers/vercel.mjs +1 -1
  83. package/dist/social-providers/vk.mjs +1 -1
  84. package/dist/social-providers/wechat.mjs +1 -1
  85. package/dist/social-providers/zoom.mjs +1 -1
  86. package/dist/types/context.d.mts +1 -1
  87. package/dist/types/cookie.d.mts +1 -1
  88. package/dist/types/index.d.mts +2 -2
  89. package/dist/types/init-options.d.mts +4 -4
  90. package/dist/types/plugin-client.d.mts +2 -2
  91. package/dist/types/plugin.d.mts +2 -2
  92. package/dist/utils/host.mjs +1 -1
  93. package/dist/utils/ip.mjs +1 -1
  94. package/dist/utils/is-api-error.mjs +1 -1
  95. package/dist/utils/redirect-uri.mjs +1 -1
  96. package/package.json +16 -16
@@ -1,3 +1,4 @@
1
+ import { decodeJwt, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
1
2
  import { logger } from "../env/logger.mjs";
2
3
  import { APIError, EntroAuthError } from "../error/index.mjs";
3
4
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
@@ -6,7 +7,6 @@ import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
6
7
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
7
8
  import { fetchRefusingRedirects } from "../oauth2/reject-redirects.mjs";
8
9
  import { getIdTokenVerifyOptions } from "../oauth2/verify-id-token.mjs";
9
- import { decodeJwt, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
10
10
  // src/social-providers/google.ts
11
11
  const GOOGLE_ID_TOKEN_MAX_AGE = "1h";
12
12
  const GOOGLE_ID_TOKEN_ALGORITHM = "RS256";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/huggingface.ts
6
6
  const huggingface = (options) => {
7
7
  const tokenEndpoint = "https://huggingface.co/oauth/token";
@@ -37,8 +37,8 @@ import { VercelOptions, VercelProfile, vercel } from "./vercel.mjs";
37
37
  import { AwaitableFunction } from "../types/helper.mjs";
38
38
  import { WeChatOptions, WeChatProfile, wechat } from "./wechat.mjs";
39
39
  import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, OAuthMappedUser } from "../oauth2/oauth-provider.mjs";
40
- import "../types/index.mjs";
41
40
  import * as z from "zod";
41
+ import "../types/index.mjs";
42
42
  export declare const socialProviders: {
43
43
  apple: (options: AppleOptions) => {
44
44
  id: "apple";
@@ -61,7 +61,7 @@ export declare const socialProviders: {
61
61
  deviceId?: string | undefined;
62
62
  }) => Promise<OAuth2Tokens>;
63
63
  idToken: {
64
- jwks: (header: import("jose").JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
64
+ jwks: (header: import("jose").CompactJWSHeaderParameters) => Promise<CryptoKey | Uint8Array<ArrayBufferLike>>;
65
65
  issuer: string;
66
66
  algorithms: string[];
67
67
  audience: string | string[];
@@ -192,7 +192,7 @@ export declare const socialProviders: {
192
192
  }) => Promise<OAuth2Tokens>;
193
193
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
194
194
  idToken: {
195
- jwks: (header: import("jose").JWTHeaderParameters, jws: import("jose").FlattenedJWSInput) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
195
+ jwks: (header: import("jose").CompactJWSHeaderParameters, jws: import("jose").FlattenedJWSInput) => Promise<CryptoKey | Uint8Array<ArrayBufferLike>>;
196
196
  issuer: string[];
197
197
  audience: string | string[];
198
198
  algorithms: string[];
@@ -298,14 +298,7 @@ export declare const socialProviders: {
298
298
  deviceId?: string | undefined;
299
299
  }) => Promise<OAuth2Tokens>;
300
300
  idToken: {
301
- jwks: {
302
- (protectedHeader?: import("jose").JWSHeaderParameters, token?: import("jose").FlattenedJWSInput): Promise<import("jose").CryptoKey>;
303
- coolingDown: boolean;
304
- fresh: boolean;
305
- reloading: boolean;
306
- reload: () => Promise<void>;
307
- jwks: () => import("jose").JSONWebKeySet | undefined;
308
- };
301
+ jwks: import("jose").RemoteJWKSet;
309
302
  issuer: string;
310
303
  audience: string | string[];
311
304
  algorithms: string[];
@@ -420,7 +413,7 @@ export declare const socialProviders: {
420
413
  deviceId?: string | undefined;
421
414
  }): Promise<OAuth2Tokens>;
422
415
  idToken: {
423
- jwks: (header: import("jose").JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
416
+ jwks: (header: import("jose").CompactJWSHeaderParameters) => Promise<CryptoKey | Uint8Array<ArrayBufferLike>>;
424
417
  algorithms: string[];
425
418
  audience: string | string[];
426
419
  maxTokenAge: string;
@@ -465,7 +458,7 @@ export declare const socialProviders: {
465
458
  }) => Promise<OAuth2Tokens>;
466
459
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
467
460
  idToken: {
468
- jwks: (header: import("jose").JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
461
+ jwks: (header: import("jose").CompactJWSHeaderParameters) => Promise<CryptoKey | Uint8Array<ArrayBufferLike>>;
469
462
  issuer: string[];
470
463
  audience: string | string[];
471
464
  algorithms: "RS256"[];
@@ -1149,14 +1142,7 @@ export declare const socialProviders: {
1149
1142
  }) => Promise<OAuth2Tokens>;
1150
1143
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
1151
1144
  idToken: {
1152
- jwks: {
1153
- (protectedHeader?: import("jose").JWSHeaderParameters, token?: import("jose").FlattenedJWSInput): Promise<import("jose").CryptoKey>;
1154
- coolingDown: boolean;
1155
- fresh: boolean;
1156
- reloading: boolean;
1157
- reload: () => Promise<void>;
1158
- jwks: () => import("jose").JSONWebKeySet | undefined;
1159
- };
1145
+ jwks: import("jose").RemoteJWKSet;
1160
1146
  issuer: string;
1161
1147
  audience: string | string[];
1162
1148
  algorithms: string[];
@@ -1,3 +1,4 @@
1
+ import * as z from "zod";
1
2
  import { apple, getApplePublicKey } from "./apple.mjs";
2
3
  import { atlassian } from "./atlassian.mjs";
3
4
  import { cloudflare } from "./cloudflare.mjs";
@@ -34,7 +35,6 @@ import { vercel } from "./vercel.mjs";
34
35
  import { vk } from "./vk.mjs";
35
36
  import { wechat } from "./wechat.mjs";
36
37
  import { zoom } from "./zoom.mjs";
37
- import * as z from "zod";
38
38
  // src/social-providers/index.ts
39
39
  const socialProviders = {
40
40
  apple,
@@ -116,14 +116,7 @@ export declare const kakao: (options: KakaoOptions) => {
116
116
  }) => Promise<OAuth2Tokens>;
117
117
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
118
118
  idToken: {
119
- jwks: {
120
- (protectedHeader?: import("jose").JWSHeaderParameters, token?: import("jose").FlattenedJWSInput): Promise<import("jose").CryptoKey>;
121
- coolingDown: boolean;
122
- fresh: boolean;
123
- reloading: boolean;
124
- reload: () => Promise<void>;
125
- jwks: () => import("jose").JSONWebKeySet | undefined;
126
- };
119
+ jwks: import("jose").RemoteJWKSet;
127
120
  issuer: string;
128
121
  audience: string | string[];
129
122
  algorithms: string[];
@@ -1,8 +1,8 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
2
+ import { createRemoteJWKSet, decodeJwt } from "jose";
1
3
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
4
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
5
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { createRemoteJWKSet, decodeJwt } from "jose";
5
- import { betterFetch } from "@better-fetch/fetch";
6
6
  // src/social-providers/kakao.ts
7
7
  const kakao = (options) => {
8
8
  const tokenEndpoint = "https://kauth.kakao.com/oauth/token";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/kick.ts
6
6
  const kick = (options) => {
7
7
  return {
@@ -1,9 +1,9 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
2
+ import { decodeJwt } from "jose";
1
3
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
4
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
5
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
6
  import { fetchRefusingRedirects } from "../oauth2/reject-redirects.mjs";
5
- import { decodeJwt } from "jose";
6
- import { betterFetch } from "@better-fetch/fetch";
7
7
  // src/social-providers/line.ts
8
8
  /**
9
9
  * LINE Login v2.1
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/linear.ts
6
6
  const linear = (options) => {
7
7
  const tokenEndpoint = "https://api.linear.app/oauth/token";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/linkedin.ts
6
6
  const linkedin = (options) => {
7
7
  const authorizationEndpoint = "https://www.linkedin.com/oauth/v2/authorization";
@@ -155,7 +155,7 @@ export declare const microsoft: (options: MicrosoftOptions) => {
155
155
  deviceId?: string | undefined;
156
156
  }): Promise<OAuth2Tokens>;
157
157
  idToken: {
158
- jwks: (header: import("jose").JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
158
+ jwks: (header: import("jose").CompactJWSHeaderParameters) => Promise<CryptoKey | Uint8Array<ArrayBufferLike>>;
159
159
  algorithms: string[];
160
160
  audience: string | string[];
161
161
  maxTokenAge: string;
@@ -192,4 +192,4 @@ export declare const microsoft: (options: MicrosoftOptions) => {
192
192
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
193
193
  options: MicrosoftOptions;
194
194
  };
195
- export declare const getMicrosoftPublicKey: (kid: string, tenant: string, authority: string, jwksEndpoint?: string) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
195
+ export declare const getMicrosoftPublicKey: (kid: string, tenant: string, authority: string, jwksEndpoint?: string) => Promise<CryptoKey | Uint8Array<ArrayBufferLike>>;
@@ -1,3 +1,6 @@
1
+ import { base64 } from "@better-auth/utils/base64";
2
+ import { betterFetch } from "@better-fetch/fetch";
3
+ import { decodeJwt, importJWK } from "jose";
1
4
  import { logger } from "../env/logger.mjs";
2
5
  import { APIError, EntroAuthError } from "../error/index.mjs";
3
6
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
@@ -5,9 +8,6 @@ import { getPrimaryClientId, parseStringBoolean } from "../oauth2/utils.mjs";
5
8
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
6
9
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
7
10
  import { fetchRefusingRedirects } from "../oauth2/reject-redirects.mjs";
8
- import { base64 } from "@better-auth/utils/base64";
9
- import { decodeJwt, importJWK } from "jose";
10
- import { betterFetch } from "@better-fetch/fetch";
11
11
  // src/social-providers/microsoft-entra-id.ts
12
12
  /**
13
13
  * Microsoft's fixed tenant id for personal (consumer) Microsoft accounts. Every
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/naver.ts
6
6
  const naver = (options) => {
7
7
  const tokenEndpoint = "https://nid.naver.com/oauth2.0/token";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/notion.ts
6
6
  const notion = (options) => {
7
7
  const tokenEndpoint = "https://api.notion.com/v1/oauth/token";
@@ -1,10 +1,10 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
2
+ import { decodeJwt } from "jose";
1
3
  import { logger } from "../env/logger.mjs";
2
4
  import { EntroAuthError } from "../error/index.mjs";
3
5
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
4
6
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
5
7
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
6
- import { decodeJwt } from "jose";
7
- import { betterFetch } from "@better-fetch/fetch";
8
8
  // src/social-providers/paybin.ts
9
9
  const paybin = (options) => {
10
10
  const issuer = options.issuer || "https://idp.paybin.io";
@@ -1,11 +1,11 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
2
+ import { decodeJwt } from "jose";
1
3
  import { logger } from "../env/logger.mjs";
2
4
  import { EntroAuthError } from "../error/index.mjs";
3
5
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
4
6
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
5
7
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
6
8
  import { appendQueryParams } from "../utils/url.mjs";
7
- import { decodeJwt } from "jose";
8
- import { betterFetch } from "@better-fetch/fetch";
9
9
  // src/social-providers/paypal.ts
10
10
  const paypal = (options) => {
11
11
  const isSandbox = (options.environment || "sandbox") === "sandbox";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/polar.ts
6
6
  const polar = (options) => {
7
7
  const tokenEndpoint = "https://api.polar.sh/v1/oauth2/token";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/railway.ts
6
6
  const authorizationEndpoint = "https://backboard.railway.com/oauth/auth";
7
7
  const tokenEndpoint = "https://backboard.railway.com/oauth/token";
@@ -1,8 +1,8 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
5
  import { createPlaceholderEmail } from "../utils/email.mjs";
5
- import { betterFetch } from "@better-fetch/fetch";
6
6
  // src/social-providers/reddit.ts
7
7
  const reddit = (options) => {
8
8
  const tokenEndpoint = options.tokenEndpoint ?? "https://www.reddit.com/api/v1/access_token";
@@ -1,8 +1,8 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
5
  import { createPlaceholderEmail } from "../utils/email.mjs";
5
- import { betterFetch } from "@better-fetch/fetch";
6
6
  // src/social-providers/roblox.ts
7
7
  const roblox = (options) => {
8
8
  const tokenEndpoint = "https://apis.roblox.com/oauth/v1/token";
@@ -1,9 +1,9 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { logger } from "../env/logger.mjs";
2
3
  import { EntroAuthError } from "../error/index.mjs";
3
4
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
4
5
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
5
6
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
6
- import { betterFetch } from "@better-fetch/fetch";
7
7
  // src/social-providers/salesforce.ts
8
8
  const salesforce = (options) => {
9
9
  const isSandbox = (options.environment ?? "production") === "sandbox";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/slack.ts
6
6
  const slack = (options) => {
7
7
  const tokenEndpoint = "https://slack.com/api/openid.connect.token";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/spotify.ts
6
6
  const spotify = (options) => {
7
7
  const tokenEndpoint = "https://accounts.spotify.com/api/token";
@@ -1,9 +1,9 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { RESERVED_AUTHORIZATION_PARAMS_SET, withQueryParams } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
5
  import { createPlaceholderEmail } from "../utils/email.mjs";
5
6
  import { appendQueryParams } from "../utils/url.mjs";
6
- import { betterFetch } from "@better-fetch/fetch";
7
7
  // src/social-providers/tiktok.ts
8
8
  const tiktok = (options) => {
9
9
  const tokenEndpoint = "https://open.tiktokapis.com/v2/oauth/token/";
@@ -1,8 +1,8 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
2
+ import { decodeJwt } from "jose";
1
3
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
4
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
5
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { decodeJwt } from "jose";
5
- import { betterFetch } from "@better-fetch/fetch";
6
6
  // src/social-providers/twitch.ts
7
7
  const twitch = (options) => {
8
8
  const tokenEndpoint = "https://id.twitch.tv/oauth2/token";
@@ -1,9 +1,9 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
5
  import { createPlaceholderEmail } from "../utils/email.mjs";
5
6
  import { appendQueryParams } from "../utils/url.mjs";
6
- import { betterFetch } from "@better-fetch/fetch";
7
7
  // src/social-providers/twitter.ts
8
8
  const twitter = (options) => {
9
9
  const tokenEndpoint = "https://api.x.com/2/oauth2/token";
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { EntroAuthError } from "../error/index.mjs";
2
3
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/vercel.ts
6
6
  const vercel = (options) => {
7
7
  const authMethod = options.tokenEndpointAuth?.method;
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/vk.ts
6
6
  const vk = (options) => {
7
7
  const tokenEndpoint = "https://id.vk.com/oauth2/auth";
@@ -1,8 +1,8 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { RESERVED_AUTHORIZATION_PARAMS_SET, withQueryParams } from "../oauth2/create-authorization-url.mjs";
2
3
  import { fetchRefusingRedirects } from "../oauth2/reject-redirects.mjs";
3
4
  import { createPlaceholderEmail } from "../utils/email.mjs";
4
5
  import { appendQueryParams } from "../utils/url.mjs";
5
- import { betterFetch } from "@better-fetch/fetch";
6
6
  // src/social-providers/wechat.ts
7
7
  const wechat = (options) => {
8
8
  return {
@@ -1,7 +1,7 @@
1
+ import { betterFetch } from "@better-fetch/fetch";
1
2
  import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
2
3
  import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
3
4
  import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
4
- import { betterFetch } from "@better-fetch/fetch";
5
5
  // src/social-providers/zoom.ts
6
6
  const zoom = (userOptions) => {
7
7
  const options = {
@@ -1,4 +1,5 @@
1
1
  import { EntroAuthDBSchema, ModelNames, SecondaryStorage } from "../db/type.mjs";
2
+ import { CookieOptions, EndpointContext } from "better-call";
2
3
  import "../db/index.mjs";
3
4
  import { Session } from "../db/schema/session.mjs";
4
5
  import { User } from "../db/schema/user.mjs";
@@ -14,7 +15,6 @@ import { EntroAuthOptions, EntroAuthRateLimitOptions, UserProvisioningSource } f
14
15
  import { EntroAuthPlugin } from "./plugin.mjs";
15
16
  import { OAuthProvider } from "../oauth2/oauth-provider.mjs";
16
17
  import { SecretConfig } from "./secret.mjs";
17
- import { CookieOptions, EndpointContext } from "better-call";
18
18
  /**
19
19
  * @internal
20
20
  */
@@ -1,7 +1,7 @@
1
1
  import { Session } from "../db/schema/session.mjs";
2
2
  import { User } from "../db/schema/user.mjs";
3
- import "../db/index.mjs";
4
3
  import { CookieOptions } from "better-call";
4
+ import "../db/index.mjs";
5
5
  export type EntroAuthCookie = {
6
6
  name: string;
7
7
  attributes: CookieOptions;
@@ -1,10 +1,10 @@
1
1
  import { D1Database } from "./database.mjs";
2
2
  import { Awaitable, AwaitableFunction, LiteralString, LiteralUnion, Prettify, Primitive, UnionToIntersection } from "./helper.mjs";
3
+ import { StandardSchemaV1 } from "@standard-schema/spec";
3
4
  import { AuthContext, CookieCacheSigner, EntroAuthPluginRegistry, EntroAuthPluginRegistryIdentifier, GenericEndpointContext, InfoContext, InternalAdapter, PluginContext } from "./context.mjs";
4
5
  import { CookieCachePayload, EntroAuthCookie, EntroAuthCookies } from "./cookie.mjs";
5
6
  import { BaseURLConfig, DynamicBaseURLConfig, EntroAuthAdvancedOptions, EntroAuthDBOptions, EntroAuthOptions, EntroAuthRateLimitOptions, EntroAuthRateLimitRule, EntroAuthRateLimitStorage, GenerateIdFn, StoreIdentifierOption, UserProvisioningSource, ValidateUserInfoAction, ValidateUserInfoMethod, ValidateUserInfoOAuthInfo, ValidateUserInfoResult, ValidateUserInfoSSOInfo, ValidateUserInfoSource } from "./init-options.mjs";
6
7
  import { SecretConfig } from "./secret.mjs";
7
8
  import { EntroAuthPlugin, EntroAuthPluginErrorCodePart, HookEndpointContext } from "./plugin.mjs";
8
9
  import { ClientAtomListener, ClientFetchOption, ClientStore, EntroAuthClientOptions, EntroAuthClientPlugin } from "./plugin-client.mjs";
9
- import { StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
10
- export type { AuthContext, Awaitable, AwaitableFunction, BaseURLConfig, ClientAtomListener, ClientFetchOption, ClientStore, CookieCachePayload, CookieCacheSigner, D1Database, DynamicBaseURLConfig, EntroAuthAdvancedOptions, EntroAuthClientOptions, EntroAuthClientPlugin, EntroAuthCookie, EntroAuthCookies, EntroAuthDBOptions, EntroAuthOptions, EntroAuthPlugin, EntroAuthPluginErrorCodePart, EntroAuthPluginRegistry, EntroAuthPluginRegistryIdentifier, EntroAuthRateLimitOptions, EntroAuthRateLimitRule, EntroAuthRateLimitStorage, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InfoContext, InternalAdapter, LiteralString, LiteralUnion, PluginContext, Prettify, Primitive, SecretConfig, StandardSchemaV1$1 as StandardSchemaV1, StoreIdentifierOption, UnionToIntersection, UserProvisioningSource, ValidateUserInfoAction, ValidateUserInfoMethod, ValidateUserInfoOAuthInfo, ValidateUserInfoResult, ValidateUserInfoSSOInfo, ValidateUserInfoSource };
10
+ export type { AuthContext, Awaitable, AwaitableFunction, BaseURLConfig, ClientAtomListener, ClientFetchOption, ClientStore, CookieCachePayload, CookieCacheSigner, D1Database, DynamicBaseURLConfig, EntroAuthAdvancedOptions, EntroAuthClientOptions, EntroAuthClientPlugin, EntroAuthCookie, EntroAuthCookies, EntroAuthDBOptions, EntroAuthOptions, EntroAuthPlugin, EntroAuthPluginErrorCodePart, EntroAuthPluginRegistry, EntroAuthPluginRegistryIdentifier, EntroAuthRateLimitOptions, EntroAuthRateLimitRule, EntroAuthRateLimitStorage, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InfoContext, InternalAdapter, LiteralString, LiteralUnion, PluginContext, Prettify, Primitive, SecretConfig, StandardSchemaV1, StoreIdentifierOption, UnionToIntersection, UserProvisioningSource, ValidateUserInfoAction, ValidateUserInfoMethod, ValidateUserInfoOAuthInfo, ValidateUserInfoResult, ValidateUserInfoSSOInfo, ValidateUserInfoSource };
@@ -1,4 +1,8 @@
1
1
  import { DBFieldAttribute, ModelNames, SecondaryStorage } from "../db/type.mjs";
2
+ import { Database } from "bun:sqlite";
3
+ import { DatabaseSync } from "node:sqlite";
4
+ import { CookieOptions } from "better-call";
5
+ import { Dialect, Kysely, MysqlPool, PostgresPool, SqliteDatabase } from "kysely";
2
6
  import { AuthMiddleware } from "../api/index.mjs";
3
7
  import "../db/index.mjs";
4
8
  import { DBAdapterDebugLogOption, DBAdapterInstance } from "../db/adapter/index.mjs";
@@ -13,10 +17,6 @@ import { AuthContext, GenericEndpointContext } from "./context.mjs";
13
17
  import { D1Database } from "./database.mjs";
14
18
  import { Awaitable, LiteralString, LiteralUnion } from "./helper.mjs";
15
19
  import { EntroAuthPlugin } from "./plugin.mjs";
16
- import { CookieOptions } from "better-call";
17
- import { Database } from "bun:sqlite";
18
- import { DatabaseSync } from "node:sqlite";
19
- import { Dialect, Kysely, MysqlPool, PostgresPool, SqliteDatabase } from "kysely";
20
20
  type KyselyDatabaseType = "postgres" | "mysql" | "sqlite" | "mssql";
21
21
  type Optional<T> = { [P in keyof T]?: T[P] | undefined; };
22
22
  export type StoreIdentifierOption = "plain" | "hashed" | {
@@ -1,7 +1,7 @@
1
- import { LiteralString } from "./helper.mjs";
2
- import { EntroAuthOptions } from "./init-options.mjs";
3
1
  import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from "@better-fetch/fetch";
4
2
  import { Atom, WritableAtom } from "nanostores";
3
+ import { LiteralString } from "./helper.mjs";
4
+ import { EntroAuthOptions } from "./init-options.mjs";
5
5
  type InferableServerPlugin = {
6
6
  id?: LiteralString | undefined;
7
7
  endpoints?: Record<string, unknown> | undefined;
@@ -1,12 +1,12 @@
1
1
  import { EntroAuthPluginDBSchema } from "../db/plugin.mjs";
2
+ import { Endpoint, EndpointContext, InputContext, Middleware } from "better-call";
3
+ import { Migration } from "kysely";
2
4
  import { AuthMiddleware } from "../api/index.mjs";
3
5
  import "../db/index.mjs";
4
6
  import { RawError } from "../utils/error-codes.mjs";
5
7
  import { AuthContext, GenericEndpointContext } from "./context.mjs";
6
8
  import { Awaitable, LiteralString } from "./helper.mjs";
7
9
  import { EntroAuthOptions } from "./init-options.mjs";
8
- import { Endpoint, EndpointContext, InputContext, Middleware } from "better-call";
9
- import { Migration } from "kysely";
10
10
  type DeepPartial<T> = T extends Function ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]>; } : T;
11
11
  export type HookEndpointContext = Partial<EndpointContext<string, any> & Omit<InputContext<string, any>, "method">> & {
12
12
  path?: string;
@@ -66,7 +66,7 @@ function ipv4ToUint32(ip) {
66
66
  /** Check whether a 32-bit value matches `prefix/length` (both unsigned). */
67
67
  function inIPv4Range(value, prefix, length) {
68
68
  if (length === 0) return true;
69
- const mask = length === 32 ? 4294967295 : -1 << 32 - length >>> 0;
69
+ const mask = length === 32 ? 0xffffffff : -1 << 32 - length >>> 0;
70
70
  return (value & mask) === (prefix & mask);
71
71
  }
72
72
  function classifyIPv4(ip) {
package/dist/utils/ip.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { isDevelopment, isTest } from "../env/env-impl.mjs";
2
1
  import * as z from "zod";
2
+ import { isDevelopment, isTest } from "../env/env-impl.mjs";
3
3
  // src/utils/ip.ts
4
4
  const ipv4Schema = z.ipv4();
5
5
  const ipv6Schema = z.ipv6();
@@ -1,5 +1,5 @@
1
- import { APIError as APIError$1 } from "../error/index.mjs";
2
1
  import { APIError } from "better-call";
2
+ import { APIError as APIError$1 } from "../error/index.mjs";
3
3
  // src/utils/is-api-error.ts
4
4
  function isAPIError(error) {
5
5
  return error instanceof APIError || error instanceof APIError$1 || error?.name === "APIError";
@@ -1,6 +1,6 @@
1
+ import * as z from "zod";
1
2
  import { isLoopbackHost } from "./host.mjs";
2
3
  import { DANGEROUS_URL_SCHEMES } from "./url.mjs";
3
- import * as z from "zod";
4
4
  // src/utils/redirect-uri.ts
5
5
  const REVERSE_DOMAIN_PRIVATE_USE_SCHEME = /^[a-z](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/i;
6
6
  const NON_PRIVATE_USE_SCHEMES = /* @__PURE__ */ new Set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entro314labs/entro-auth-core",
3
- "version": "1.8.0-beta.11",
3
+ "version": "1.8.0-beta.13",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -177,25 +177,25 @@
177
177
  "devDependencies": {
178
178
  "@better-auth/utils": "0.5.1",
179
179
  "@better-fetch/fetch": "1.3.3",
180
- "@cloudflare/workers-types": "^4.20250121.0",
181
- "@opentelemetry/api": "^1.9.1",
182
- "@opentelemetry/sdk-trace-base": "^2.10.0",
183
- "@opentelemetry/sdk-trace-node": "^2.10.0",
184
- "@opentelemetry/semantic-conventions": "^1.41.1",
180
+ "@cloudflare/workers-types": "^5.20261124.2",
181
+ "@opentelemetry/api": "^1.10.0",
182
+ "@opentelemetry/sdk-trace-base": "^2.12.0",
183
+ "@opentelemetry/sdk-trace-node": "^2.12.0",
184
+ "@opentelemetry/semantic-conventions": "^1.45.0",
185
185
  "better-call": "1.4.6",
186
- "jose": "^6.2.3",
187
- "kysely": "^0.28.17 || ^0.29.0",
188
- "nanostores": "^1.3.0",
189
- "tsdown": "0.23.1"
186
+ "jose": "^6.2.18",
187
+ "kysely": "^0.28.17 || ^0.29.9",
188
+ "nanostores": "^1.5.5",
189
+ "tsdown": "0.23.7"
190
190
  },
191
191
  "peerDependencies": {
192
- "@better-auth/utils": "^0.4.2 || ^0.5.0",
192
+ "@better-auth/utils": "^0.4.2 || ^0.5.1",
193
193
  "@better-fetch/fetch": "1.3.3",
194
- "@opentelemetry/api": "^1.9.0",
195
- "better-call": "~1.4.5",
196
- "jose": "^6.1.0",
197
- "kysely": "^0.28.5 || ^0.29.0",
198
- "nanostores": "^1.0.1"
194
+ "@opentelemetry/api": "^1.10.0",
195
+ "better-call": "~1.4.6",
196
+ "jose": "^6.2.18",
197
+ "kysely": "^0.28.5 || ^0.29.9",
198
+ "nanostores": "^1.5.5"
199
199
  },
200
200
  "peerDependenciesMeta": {
201
201
  "@opentelemetry/api": {