Skip to main content

Overview

The Biometrics by Steps module provides a comprehensive, guided biometric verification workflow that combines ID validation with face biometrics. This module orchestrates multiple verification steps in a sequential manner, providing a complete identity verification solution with a streamlined user experience.

Key Features

  • Guided Workflow: Step-by-step verification process
  • ID Validation Integration: Built-in document verification
  • Face Biometrics: Advanced liveness detection and face matching
  • Backend Orchestration: Uses validation tokens from backend
  • Progress Tracking: Visual indicators for multi-step process
  • Flexible Configuration: Customize which steps are included
  • No Direct Token Required: Uses ID validation token
  • Comprehensive Results: Complete verification data in single response

Use Cases

Complete Onboarding

Full KYC process with document and biometric verification in one flow.

Account Recovery

Verify identity for account recovery or password reset scenarios.

High-Value Transactions

Multi-factor verification for sensitive operations or large transactions.

Compliance Verification

Meet regulatory requirements with comprehensive identity checks.

Hardware Requirements

  • Modern web browser with camera access
  • Device camera (mobile or desktop)
  • Good lighting conditions for optimal results
  • Stable internet connection
  • HTTPS protocol (required)

Installation

npm install @fad-producto/fad-sdk

Workflow Steps

The module typically includes the following steps:
1

Document Capture

Capture and validate government-issued ID documents (front and back).
2

Face Liveness

Perform liveness detection to ensure physical presence.
3

Face Matching

Match captured face with photo from ID document.
4

Validation

Backend validates all captured data and returns verification results.
The exact steps included depend on your backend configuration and the ID validation token provided.

Implementation

1

Import SDK

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

Obtain ID Validation Token

Request an ID validation token from your backend:
async function getIdValidationToken(userId) {
  const response = await fetch('/api/biometrics/create-validation', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      userId,
      verificationType: 'full_biometric',
    }),
  });

  const data = await response.json();
  return data.idValidation;  // ID validation token
}
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 Biometric Workflow

Initiate the step-by-step verification process:
async function initProcess() {
  const options = {
    environment: FadSDK.getFadEnvironments().UATHA,
  };

  const FAD_SDK = new FadSDK(null, options);
  
  try {
    // Get ID validation token from backend
    const idValidation = await getIdValidationToken(userId);

    // Start the biometric workflow
    const result = await FAD_SDK.startBiometrics(idValidation);

    console.log('Biometric verification completed:', result);

    // Send results to backend for final processing
    await submitVerificationResults(result);

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

Response Structure

{
  status: string,           // 'completed', 'failed', 'cancelled'
  validationId: string,     // Backend validation identifier
  results: {
    document: {
      front: string,        // Base64 image
      back?: string,        // Base64 image
      extracted: object,    // OCR data
      validation: object,   // Document validation results
    },
    face: {
      liveness: boolean,    // Liveness check result
      image: string,        // Base64 image
      quality: number,      // Quality score
    },
    matching: {
      score: number,        // Match score (0-100)
      matched: boolean,     // Whether face matches ID photo
    },
  },
  timestamp: string,        // Completion timestamp
  // Additional fields based on configuration
}
The exact response structure depends on your backend configuration and which verification steps were executed.

Error Handling

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

Usage Examples

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

async function performBiometricVerification(userId) {
  // 1. Request validation token from backend
  const tokenResponse = await fetch('/api/biometrics/token', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ userId }),
  });

  const { idValidation } = await tokenResponse.json();

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

  try {
    // 3. Execute biometric workflow
    const result = await FAD_SDK.startBiometrics(idValidation);

    if (result.status !== 'completed') {
      throw new Error(`Verification ${result.status}`);
    }

    // 4. Submit results to backend
    await fetch('/api/biometrics/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 Validation Tokens

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

  // Create validation token with FAD backend
  const idValidation = await fadBackend.createValidation({
    userId,
    steps: getVerificationSteps(verificationType),
    expiresIn: 3600,  // 1 hour
  });

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

Processing Results

Handle verification results on your backend:
app.post('/api/biometrics/complete', async (req, res) => {
  const { userId, result } = req.body;

  // Validate result authenticity
  const isValid = await fadBackend.validateResult(result);

  if (!isValid) {
    return res.status(400).json({ error: 'Invalid result' });
  }

  // Store verification data
  await db.saveVerification({
    userId,
    documentData: result.results.document,
    faceData: result.results.face,
    matchingScore: result.results.matching.score,
    timestamp: result.timestamp,
  });

  // Update user status
  await db.updateUserStatus(userId, 'verified');

  res.json({ success: true });
});

Verification Steps Configuration

Typical configurations for different use cases:
const steps = {
  document: {
    enabled: true,
    sides: ['front'],  // Front only
  },
  liveness: {
    enabled: true,
    mode: 'basic',
  },
  matching: {
    enabled: false,
  },
};
Duration: ~1-2 minutes

Best Practices

Token Expiration

Set appropriate token expiration (30-60 minutes) to balance security and user experience.

Progress Indicators

Show clear progress indicators so users know what to expect and how long it will take.

Error Recovery

Implement clear error messages and easy retry mechanisms for failed steps.

User Guidance

Provide instructions before each step to improve success rates.

Quality Thresholds

Recommended thresholds for different security levels:
Security LevelDocument QualityFace QualityMatch Score
Basic> 60%> 60%> 70
Standard> 75%> 75%> 80
High> 85%> 85%> 90
Maximum> 90%> 90%> 95

Security Considerations

This module handles sensitive biometric and identity data. Implement comprehensive security measures.
  • Generate validation tokens server-side only
  • Use HTTPS for all communications
  • Validate results on backend before trusting
  • Implement rate limiting on token creation
  • Encrypt stored biometric data
  • Follow GDPR/CCPA compliance for biometric data
  • Maintain audit logs of all verifications
  • Set appropriate token expiration times
  • Never expose backend credentials client-side
  • Implement fraud detection mechanisms

Troubleshooting

  • Token may have expired (check expiration)
  • Token format incorrect
  • Backend service unavailable
  • Request new token from backend
  • Check error message for specific step
  • Verify hardware requirements for that step
  • Ensure good lighting/conditions
  • Review backend logs for validation issues
  • Ensure person in selfie matches ID photo
  • Improve lighting conditions
  • Remove glasses/obstructions
  • Lower matching threshold if appropriate
  • Ensure good lighting on document
  • Keep document flat and fully visible
  • Clean camera lens
  • Avoid glare on document surface

Monitoring and Analytics

Track these metrics for workflow optimization:
  • Completion Rate: Percentage of started verifications completed
  • Step Failure Rates: Which steps fail most often
  • Average Duration: Time to complete verification
  • Retry Rates: How often users retry steps
  • Quality Scores: Average quality of captures
  • Matching Scores: Distribution of face match scores

Build docs developers (and LLMs) love