Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
123456789101112131415161718192021222324// best-effort batch lookup of verified signup emails against the internal// `/_internal/email-did` route. returns only the emails that resolved; a// transport or parse failure answers an empty map so hydration never throws.export const resolveEmailToDid = async ( fetchFn: typeof globalThis.fetch, emails: string[]): Promise<Map<string, string>> => { if (emails.length === 0) return new Map(); const params = new URLSearchParams(); for (const email of emails) params.append("emails", email); try { const res = await fetchFn(`/_internal/email-did?${params}`); if (!res.ok) return new Map(); const map: Record<string, string | null> = await res.json(); const result = new Map<string, string>(); for (const [email, did] of Object.entries(map)) { if (did) result.set(email, did); } return result; } catch { return new Map(); }};