Files
esports/src/lib/auth-identity.ts

22 lines
661 B
TypeScript

/** Better Auth requires an email internally; this is never a contact address. */
export const AUTH_EMAIL_DOMAIN = 'identity.invalid';
export function contactEmail(value: string | null | undefined): string | null {
const email = value?.trim().toLowerCase();
if (!email || /@(?:osu\.local|discord\.local|identity\.invalid)$/.test(email)) return null;
return email;
}
export function newAuthIdentity(): string {
return `${crypto.randomUUID()}@${AUTH_EMAIL_DOMAIN}`;
}
export interface ConnectionProfile {
username: string;
image: string | null;
email: string | null;
emailVerified: boolean;
countryCode?: string | null;
globalRank?: number | null;
}