@better-auth/core 1.6.25 → 1.6.26

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.25";
5
+ const __betterAuthVersion = "1.6.26";
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.25";
5
+ const INSTRUMENTATION_VERSION = "1.6.26";
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
@@ -0,0 +1,19 @@
1
+ //#region src/utils/email.d.ts
2
+ interface PlaceholderEmailOptions {
3
+ /**
4
+ * A stable identifier that distinguishes the account within the namespace.
5
+ */
6
+ identifier: string;
7
+ /**
8
+ * A namespace that distinguishes identical identifiers from different sources.
9
+ */
10
+ namespace: string;
11
+ }
12
+ /**
13
+ * Creates a stable, non-routable email address for an account without an email.
14
+ *
15
+ * @throws TypeError if the generated email is invalid.
16
+ */
17
+ declare function createPlaceholderEmail({ identifier, namespace }: PlaceholderEmailOptions): string;
18
+ //#endregion
19
+ export { PlaceholderEmailOptions, createPlaceholderEmail };
@@ -0,0 +1,18 @@
1
+ import * as z from "zod";
2
+ //#region src/utils/email.ts
3
+ /**
4
+ * @see https://www.rfc-editor.org/rfc/rfc6761.html#section-6.4
5
+ */
6
+ const PLACEHOLDER_EMAIL_DOMAIN = "placeholder.invalid";
7
+ /**
8
+ * Creates a stable, non-routable email address for an account without an email.
9
+ *
10
+ * @throws TypeError if the generated email is invalid.
11
+ */
12
+ function createPlaceholderEmail({ identifier, namespace }) {
13
+ const result = z.email().safeParse(`${identifier}@${namespace}.${PLACEHOLDER_EMAIL_DOMAIN}`);
14
+ if (!result.success) throw new TypeError("Invalid placeholder email");
15
+ return result.data;
16
+ }
17
+ //#endregion
18
+ export { createPlaceholderEmail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.6.25",
3
+ "version": "1.6.26",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -155,8 +155,8 @@
155
155
  "@better-auth/utils": "0.4.2",
156
156
  "@better-fetch/fetch": "1.3.1",
157
157
  "@opentelemetry/api": "^1.9.0",
158
- "@opentelemetry/sdk-trace-base": "^1.30.0",
159
- "@opentelemetry/sdk-trace-node": "^1.30.0",
158
+ "@opentelemetry/sdk-trace-base": "^2.10.0",
159
+ "@opentelemetry/sdk-trace-node": "^2.10.0",
160
160
  "better-call": "1.3.7",
161
161
  "@cloudflare/workers-types": "^4.20250121.0",
162
162
  "jose": "^6.1.3",
@@ -0,0 +1,36 @@
1
+ import * as z from "zod";
2
+
3
+ /**
4
+ * @see https://www.rfc-editor.org/rfc/rfc6761.html#section-6.4
5
+ */
6
+ const PLACEHOLDER_EMAIL_DOMAIN = "placeholder.invalid";
7
+
8
+ export interface PlaceholderEmailOptions {
9
+ /**
10
+ * A stable identifier that distinguishes the account within the namespace.
11
+ */
12
+ identifier: string;
13
+ /**
14
+ * A namespace that distinguishes identical identifiers from different sources.
15
+ */
16
+ namespace: string;
17
+ }
18
+
19
+ /**
20
+ * Creates a stable, non-routable email address for an account without an email.
21
+ *
22
+ * @throws TypeError if the generated email is invalid.
23
+ */
24
+ export function createPlaceholderEmail({
25
+ identifier,
26
+ namespace,
27
+ }: PlaceholderEmailOptions): string {
28
+ const result = z
29
+ .email()
30
+ .safeParse(`${identifier}@${namespace}.${PLACEHOLDER_EMAIL_DOMAIN}`);
31
+ if (!result.success) {
32
+ throw new TypeError("Invalid placeholder email");
33
+ }
34
+
35
+ return result.data;
36
+ }