Generates a stable, non-routable placeholder email for accounts lacking an email address. Used when email is optional or missing.
// Source: https://github.com/better-auth/better-auth | License: MIT | Copyright 2024 - present, Bereket Engida
// Provided via justclaw.it.com; keep this notice with the code.
import * as z from "zod";
/**
* @see https://www.rfc-editor.org/rfc/rfc6761.html#section-6.4
*/
const PLACEHOLDER_EMAIL_DOMAIN = "placeholder.invalid";
export interface PlaceholderEmailOptions {
/**
* A stable identifier that distinguishes the account within the namespace.
*/
identifier: string;
/**
* A namespace that distinguishes identical identifiers from different sources.
*/
namespace: string;
}
/**
* Creates a stable, non-routable email address for an account without an email.
*
* @throws TypeError if the generated email is invalid.
*/
export function createPlaceholderEmail({
identifier,
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key