Mobile apps: The iOS and Android SDKs automatically send an Origin header as app://your.bundle.id. Add app://your.bundle.id (e.g., app://com.example.myapp) to your project’s allowed domains in the dashboard.
import { Vouch } from '@vouch-in/js';// Initialize with your client keyconst vouch = new Vouch( 'your-project-id', 'your-client-api-key');// Validate an email (includes automatic device fingerprinting)const result = await vouch.validate('[email protected]');// Check the recommendationif (result.recommendation === 'allow') { console.log('Email is valid!');} else { // Use the message field for a user-friendly error console.log(result.message); // e.g. "Please use a permanent email address, not a temporary one."}
import { Vouch } from '@vouch-in/node';// Initialize with your server keyconst vouch = new Vouch( 'your-project-id', 'your-server-api-key');// Validate an email (server-side)const result = await vouch.validate('[email protected]', { ip: request.ip, userAgent: request.headers['user-agent']});// Check the recommendationif (result.recommendation === 'allow') { // Create user account console.log('Email is valid!');} else { // Use the message field for a user-friendly error console.log(result.message); // e.g. "Please use a permanent email address, not a temporary one."}
recommendation - Overall recommendation: allow, block, or flag
message - Human-friendly error message when recommendation is flag or block (e.g. “Please use a permanent email address, not a temporary one.”). null when allow.
Use the message field for quick user-facing errors, or check individual validations for custom logic:
Copy
const result = await vouch.validate(email);// Option 1: Use the message field for a user-friendly errorif (result.recommendation === 'allow') { // Email is valid, proceed} else { // Show the human-friendly error message console.log(result.message); // e.g. "Please use a permanent email address, not a temporary one."}// Option 2: Check individual validations for custom logicconst { checks, metadata } = result;if (!checks.syntax?.pass) { // Invalid email format}if (!checks.disposable?.pass) { // Disposable email detected}if (metadata.previousSignups > 5) { // Multiple signups from this device}