@better-auth/core 1.6.7 → 1.6.8

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.
@@ -2,7 +2,7 @@
2
2
  const symbol = Symbol.for("better-auth:global");
3
3
  let bind = null;
4
4
  const __context = {};
5
- const __betterAuthVersion = "1.6.7";
5
+ const __betterAuthVersion = "1.6.8";
6
6
  /**
7
7
  * We store context instance in the globalThis.
8
8
  *
@@ -2,7 +2,7 @@ import { ATTR_HTTP_RESPONSE_STATUS_CODE } from "./attributes.mjs";
2
2
  import { getOpenTelemetryAPI } from "./api.mjs";
3
3
  //#region src/instrumentation/tracer.ts
4
4
  const INSTRUMENTATION_SCOPE = "better-auth";
5
- const INSTRUMENTATION_VERSION = "1.6.7";
5
+ const INSTRUMENTATION_VERSION = "1.6.8";
6
6
  /**
7
7
  * Better-auth uses `throw ctx.redirect(url)` for flow control (e.g. OAuth
8
8
  * callbacks). These are APIErrors with 3xx status codes and should not be
@@ -12,7 +12,7 @@ interface AppleProfile {
12
12
  * The email address is either the user's real email address or the proxy
13
13
  * address, depending on their status private email relay service.
14
14
  */
15
- email: string;
15
+ email?: string;
16
16
  /**
17
17
  * A string or Boolean value that indicates whether the service verifies
18
18
  * the email. The value can either be a string ("true" or "false") or a
@@ -93,7 +93,14 @@ declare const apple: (options: AppleOptions) => {
93
93
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
94
94
  getUserInfo(token: OAuth2Tokens & {
95
95
  user?: {
96
- name?
96
+ name /**
97
+ * An Integer value that indicates whether the user appears to be a real
98
+ * person. Use the value of this claim to mitigate fraud. The possible
99
+ * values are: 0 (or Unsupported), 1 (or Unknown), 2 (or LikelyReal). For
100
+ * more information, see ASUserDetectionStatus. This claim is present only
101
+ * in iOS 14 and later, macOS 11 and later, watchOS 7 and later, tvOS 14
102
+ * and later. The claim isn’t present or supported for web-based apps.
103
+ */?
97
104
  /**
98
105
  * An Integer value that indicates whether the user appears to be a real
99
106
  * person. Use the value of this claim to mitigate fraud. The possible
@@ -38,7 +38,7 @@ interface DiscordProfile extends Record<string, any> {
38
38
  /** whether the email on this account has been verified */
39
39
  verified: boolean;
40
40
  /** the user's email */
41
- email: string;
41
+ email?: string | null;
42
42
  /**
43
43
  * the flags on a user's account:
44
44
  * https://discord.com/developers/docs/resources/user#user-object-user-flags
@@ -3,8 +3,8 @@ import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
3
3
  interface FacebookProfile {
4
4
  id: string;
5
5
  name: string;
6
- email: string;
7
- email_verified: boolean;
6
+ email?: string;
7
+ email_verified?: boolean;
8
8
  picture: {
9
9
  data: {
10
10
  height: number;
@@ -111,7 +111,7 @@ const facebook = (options) => {
111
111
  name: profile.name,
112
112
  email: profile.email,
113
113
  image: profile.picture.data.url,
114
- emailVerified: profile.email_verified,
114
+ emailVerified: profile.email_verified ?? false,
115
115
  ...userMap
116
116
  },
117
117
  data: profile
@@ -23,7 +23,7 @@ interface GithubProfile {
23
23
  company: string;
24
24
  blog: string;
25
25
  location: string;
26
- email: string;
26
+ email: string | null;
27
27
  hireable: boolean;
28
28
  bio: string;
29
29
  twitter_username: string;
@@ -10,8 +10,8 @@ interface LinkedInProfile {
10
10
  country: string;
11
11
  language: string;
12
12
  };
13
- email: string;
14
- email_verified: boolean;
13
+ email?: string;
14
+ email_verified?: boolean;
15
15
  }
16
16
  interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
17
17
  clientId: string;
@@ -59,7 +59,7 @@ const linkedin = (options) => {
59
59
  id: profile.sub,
60
60
  name: profile.name,
61
61
  email: profile.email,
62
- emailVerified: profile.email_verified || false,
62
+ emailVerified: profile.email_verified ?? false,
63
63
  image: profile.picture,
64
64
  ...userMap
65
65
  },
@@ -25,7 +25,7 @@ interface MicrosoftEntraIDProfile extends Record<string, any> {
25
25
  /** The primary username that represents the user */
26
26
  preferred_username: string;
27
27
  /** User's email address */
28
- email: string;
28
+ email?: string;
29
29
  /** Human-readable value that identifies the subject of the token */
30
30
  name: string;
31
31
  /** Matches the parameter included in the original authorize request */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -162,6 +162,8 @@ export const getAuthTables = (
162
162
  },
163
163
  email: {
164
164
  type: "string",
165
+ // TODO(#9124): drop required+unique in v2; use a partial unique
166
+ // index where email is not null (see schema/user.ts).
165
167
  unique: true,
166
168
  required: true,
167
169
  fieldName: options.user?.fields?.email || "email",
@@ -7,6 +7,9 @@ import type {
7
7
  import { coreSchema } from "./shared";
8
8
 
9
9
  export const userSchema = coreSchema.extend({
10
+ // TODO(#9124): widen to nullish in v2. OAuth providers (Discord phone-only,
11
+ // Apple subsequent sign-ins, etc.) can legitimately omit email; identity
12
+ // must key on (providerId, accountId) per OpenID Connect Core §5.7.
10
13
  email: z.string().transform((val) => val.toLowerCase()),
11
14
  emailVerified: z.boolean().default(false),
12
15
  name: z.string(),
@@ -22,7 +22,7 @@ export interface AppleProfile {
22
22
  * The email address is either the user's real email address or the proxy
23
23
  * address, depending on their status private email relay service.
24
24
  */
25
- email: string;
25
+ email?: string;
26
26
  /**
27
27
  * A string or Boolean value that indicates whether the service verifies
28
28
  * the email. The value can either be a string ("true" or "false") or a
@@ -41,7 +41,7 @@ export interface DiscordProfile extends Record<string, any> {
41
41
  /** whether the email on this account has been verified */
42
42
  verified: boolean;
43
43
  /** the user's email */
44
- email: string;
44
+ email?: string | null;
45
45
  /**
46
46
  * the flags on a user's account:
47
47
  * https://discord.com/developers/docs/resources/user#user-object-user-flags
@@ -12,8 +12,8 @@ import {
12
12
  export interface FacebookProfile {
13
13
  id: string;
14
14
  name: string;
15
- email: string;
16
- email_verified: boolean;
15
+ email?: string;
16
+ email_verified?: boolean;
17
17
  picture: {
18
18
  data: {
19
19
  height: number;
@@ -204,7 +204,7 @@ export const facebook = (options: FacebookOptions) => {
204
204
  name: profile.name,
205
205
  email: profile.email,
206
206
  image: profile.picture.data.url,
207
- emailVerified: profile.email_verified,
207
+ emailVerified: profile.email_verified ?? false,
208
208
  ...userMap,
209
209
  },
210
210
  data: profile,
@@ -31,7 +31,7 @@ export interface GithubProfile {
31
31
  company: string;
32
32
  blog: string;
33
33
  location: string;
34
- email: string;
34
+ email: string | null;
35
35
  hireable: boolean;
36
36
  bio: string;
37
37
  twitter_username: string;
@@ -16,8 +16,8 @@ export interface LinkedInProfile {
16
16
  country: string;
17
17
  language: string;
18
18
  };
19
- email: string;
20
- email_verified: boolean;
19
+ email?: string;
20
+ email_verified?: boolean;
21
21
  }
22
22
 
23
23
  export interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
@@ -98,7 +98,7 @@ export const linkedin = (options: LinkedInOptions) => {
98
98
  id: profile.sub,
99
99
  name: profile.name,
100
100
  email: profile.email,
101
- emailVerified: profile.email_verified || false,
101
+ emailVerified: profile.email_verified ?? false,
102
102
  image: profile.picture,
103
103
  ...userMap,
104
104
  },
@@ -36,7 +36,7 @@ export interface MicrosoftEntraIDProfile extends Record<string, any> {
36
36
  /** The primary username that represents the user */
37
37
  preferred_username: string;
38
38
  /** User's email address */
39
- email: string;
39
+ email?: string;
40
40
  /** Human-readable value that identifies the subject of the token */
41
41
  name: string;
42
42
  /** Matches the parameter included in the original authorize request */