Supabase
// supabase/functions/check-email/index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
serve(async (req) => {
const { email } = await req.json();
try {
const r = await fetch(
`https://api.disposableguard.com/v1/check?email=${encodeURIComponent(email)}`,
{
headers: {
Authorization: `Bearer ${Deno.env.get("DG_KEY")}`,
},
}
);
if (r.ok) {
const data = await r.json();
if (data.is_disposable) {
return new Response(
JSON.stringify({ error: "Please use a real email address." }),
{ status: 400, headers: { "Content-Type": "application/json" } }
);
}
}
} catch {
// fail-open
}
return new Response(JSON.stringify({ ok: true }), {
headers: { "Content-Type": "application/json" },
});
});Notes
Deploy with `supabase functions deploy check-email`. Call from your signup flow before creating the user.