Skip to main content

Overview

The Fad Web 4 module provides a streamlined approach to biometric verification workflows. Instead of configuring individual modules, you use pre-configured tickets that orchestrate complete verification processes. This module is ideal for integrating with backend systems that manage verification workflows.

Key Features

  • Ticket-Based Workflow: Single ticket initiates entire verification process
  • Backend Orchestration: Workflows configured server-side
  • Simplified Integration: Minimal client-side configuration required
  • Multi-Step Processes: Automatically handles multiple verification steps
  • Version Tracking: Built-in SDK version information
  • No Token Required: Uses ticket authentication instead
  • Flexible Workflows: Backend can define any combination of verification steps

Use Cases

Backend-Managed Workflows

Let your backend orchestrate complex verification flows without client updates.

Dynamic Verification

Change verification requirements based on risk levels or user context.

Simplified Frontend

Reduce frontend complexity by moving workflow logic to backend.

Audit and Compliance

Centralized workflow management for better audit trails and compliance.

Hardware Requirements

  • Modern web browser with camera access (if biometric capture required)
  • Device camera (if facial recognition or document capture required)
  • Stable internet connection
  • HTTPS protocol (required)
Specific hardware requirements depend on the workflow configured in the ticket.

Installation

npm install @fad-producto/fad-sdk

Implementation

1

Import SDK

Import the FAD SDK:
import FadSDK from '@fad-producto/fad-sdk';
2

Obtain Ticket from Backend

Request a verification ticket from your backend:
async function getVerificationTicket(userId) {
  const response = await fetch('/api/verification/create-ticket', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      userId,
      verificationType: 'full_kyc',  // or other verification type
    }),
  });

  const data = await response.json();
  return data.ticket;  // Ticket string from backend
}
3

Initialize SDK Without Token

Create SDK instance without authentication token:
const options = {
  environment: FadSDK.getFadEnvironments().UATHA,
};

const FAD_SDK = new FadSDK(null, options);  // No token required
4

Start Workflow with Ticket

Initiate the verification workflow using the ticket:
async function initProcess() {
  const options = {
    environment: FadSDK.getFadEnvironments().UATHA,
  };

  // Check SDK version if needed
  console.log(`FAD SDK Version: ${FadSDK.version}`);

  const FAD_SDK = new FadSDK(null, options);
  
  try {
    // Get ticket from your backend
    const ticket = await getVerificationTicket(userId);

    // Start the workflow
    const result = await FAD_SDK.startFadWeb4(ticket);

    console.log('Workflow completed:', result);

    // Notify backend of completion
    await notifyBackend(result);

  } catch (ex) {
    console.error('Workflow error:', ex);
    handleError(ex);
  } finally {
    FAD_SDK.end();
  }
}

Response Structure

{
  // Response structure depends on workflow configured in ticket
  // Typically includes:
  status: string,        // 'completed', 'failed', 'cancelled'
  workflowId: string,    // Backend workflow identifier
  results: object,       // Results from each step in workflow
  timestamp: string,     // Completion timestamp
  // Additional fields based on workflow
}
The exact response structure is determined by your backend configuration and the workflow steps executed.

Error Handling

try {
  const result = await FAD_SDK.startFadWeb4(ticket);
} catch (ex) {
  if (ex.message.includes('Invalid ticket')) {
    alert('Verification session expired. Please start again.');
    // Request new ticket
  }
}

Usage Examples

import FadSDK from '@fad-producto/fad-sdk';

async function performVerification(userId) {
  // 1. Request ticket from backend
  const ticketResponse = await fetch('/api/verification/ticket', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ userId }),
  });

  const { ticket } = await ticketResponse.json();

  // 2. Initialize SDK
  const FAD_SDK = new FadSDK(null, {
    environment: FadSDK.getFadEnvironments().UATHA,
  });

  try {
    // 3. Execute workflow
    const result = await FAD_SDK.startFadWeb4(ticket);

    // 4. Send results to backend
    await fetch('/api/verification/complete', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        userId,
        result,
        timestamp: new Date().toISOString(),
      }),
    });

    return result;
  } finally {
    FAD_SDK.end();
  }
}

Backend Integration

Creating Tickets

Your backend should provide an endpoint to create verification tickets:
// Backend example (Node.js/Express)
app.post('/api/verification/create-ticket', async (req, res) => {
  const { userId, verificationType } = req.body;

  // Create ticket with FAD backend
  const ticket = await fadBackend.createTicket({
    userId,
    workflow: getWorkflowConfig(verificationType),
    expiresIn: 3600,  // 1 hour
  });

  res.json({ ticket });
});

Workflow Configuration

Tickets can be configured to include different verification steps:
// Example workflow configurations
const workflows = {
  basic_kyc: {
    steps: ['liveness', 'document_capture'],
    settings: { /* ... */ },
  },
  full_kyc: {
    steps: ['liveness', 'document_capture', 'face_match'],
    settings: { /* ... */ },
  },
  quick_verify: {
    steps: ['liveness'],
    settings: { /* ... */ },
  },
};

Best Practices

Ticket Expiration

Set appropriate ticket expiration times (e.g., 1 hour) to balance security and user experience.

Secure Transmission

Always transmit tickets over HTTPS and never expose ticket generation logic client-side.

Status Tracking

Track workflow progress on backend for analytics and user support.

Error Recovery

Implement retry logic and provide clear error messages to users.

Version Checking

The module provides SDK version information:
import FadSDK from '@fad-producto/fad-sdk';

console.log(`FAD SDK Version: ${FadSDK.version}`);

// Use version for debugging or feature detection
if (FadSDK.version.startsWith('4.')) {
  // Version 4.x features available
}

Workflow Examples

Steps:
  1. Liveness detection
  2. Document capture (front and back)
Duration: 2-3 minutesUse Case: Standard customer onboarding

Security Considerations

Tickets contain sensitive authorization data. Implement proper security measures.
  • Generate tickets server-side only
  • Use HTTPS for all communications
  • Set appropriate ticket expiration times
  • Implement rate limiting on ticket creation
  • Validate ticket results on backend
  • Log all verification attempts
  • Implement fraud detection
  • Never expose backend credentials client-side

Troubleshooting

  • Ticket may have expired
  • Ticket format incorrect
  • Backend service unavailable
  • Request new ticket from backend
  • Check network connectivity
  • Verify FAD SDK version
  • Ensure proper initialization
  • Check browser console for errors
  • User may have cancelled
  • Workflow step failed
  • Network interruption
  • Check backend logs for details
  • Verify API endpoints are accessible
  • Check CORS configuration
  • Ensure proper authentication
  • Review backend logs

Build docs developers (and LLMs) love