Overview
The Signature module enables users to provide digital signatures while simultaneously recording video of their face and the signing process. This dual-recording approach provides strong evidence of signature authenticity and user consent.
Key Features
Dual Video Recording : Simultaneously records face and signature
Digital Signature Capture : Captures signature as image
Real-time Face Detection : Ensures user presence during signing
Customizable Timer : Configure minimum and maximum recording duration
Preview Mode : Review signature and videos before confirmation
Video Export : Get both videos as Blob objects for storage
Customizable UI : Full customization of colors, fonts, and legends
Hardware Requirements
Modern web browser with camera and microphone access
Device camera (webcam or mobile camera)
Touch screen or mouse for signature input
Stable internet connection
HTTPS protocol (required for camera/microphone access)
Installation
npm install @fad-producto/fad-sdk
Implementation
Import SDK and Configure
Import the FAD SDK and set up your configuration: import FadSDK from '@fad-producto/fad-sdk' ;
const TOKEN = 'YOUR_FAD_TOKEN' ;
const CONFIGURATION = {
allowClose: true ,
views: {
instructions: true ,
preview: true ,
},
selfie: {
captureSelfie: false ,
imageType: 'image/png' ,
imageQuality: 1 ,
},
timer: {
recording: { min: 2 , max: 15 }, // Duration in seconds
faceUndetected: 5 , // Timeout if face not detected
},
};
Configure UI Customization
Customize the legends and styling: const CONFIGURATION = {
// ... previous config
customization: {
fadCustomization: {
colors: {
succesful: '#5A9A92' ,
},
buttons: {
primary: {
backgroundColor: '#A70635' ,
labelColor: '#ffffff' ,
},
},
},
moduleCustomization: {
legends: {
tapInstruction: 'Tap on the box to start signing' ,
buttonFinish: 'Finish' ,
recording: 'Recording' ,
focusFace: 'Position your face in the guide' ,
signNowHere: 'Sign here now' ,
faceDetected: 'Face detected' ,
faceUndetected: 'Face not detected' ,
},
legendsInstructions: {
title: 'Video Signature' ,
subtitle: 'Position your face in the guide and sign in the box' ,
buttonNext: 'Continue' ,
},
legendsPreview: {
title: 'Signature' ,
buttonRetry: 'Sign again' ,
buttonNext: 'Confirm signature' ,
},
},
},
};
Initialize SDK and Start Signature Process
Create the SDK instance and start the signature capture: async function initProcess () {
const options = {
environment: FadSDK . getFadEnvironments (). UATHA ,
};
const FAD_SDK = new FadSDK ( TOKEN , options );
try {
const signatureResponse = await FAD_SDK . startSignature ( CONFIGURATION );
// Check if user closed the module
if ( signatureResponse . event === FadSDK . Constants . EventModule . MODULE_CLOSED ) {
console . log ( 'Module closed by user' );
return ;
}
console . log ( 'Process completed' , signatureResponse );
// Access captured data
const faceVideo = signatureResponse . data . videoFace ; // Blob
const signatureVideo = signatureResponse . data . videoSignature ; // Blob
const signatureImage = signatureResponse . data . imageSignature ; // Base64
// Create URLs for display
const faceVideoUrl = URL . createObjectURL ( faceVideo );
const signatureVideoUrl = URL . createObjectURL ( signatureVideo );
// Display or upload results
displaySignature ( faceVideoUrl , signatureVideoUrl , signatureImage );
} catch ( ex ) {
console . error ( 'Process error:' , ex );
handleError ( ex );
} finally {
FAD_SDK . end ();
}
}
Response Structure
{
event : string , // 'PROCESS_COMPLETED' or 'MODULE_CLOSED'
data : {
videoFace : Blob , // Video of user's face during signing
videoSignature : Blob , // Video of signature being drawn
imageSignature : string , // Base64 image of final signature
}
}
The video Blobs can be uploaded to your server or converted to URLs for display using URL.createObjectURL().
Error Handling
Handle errors using the SDK error constants:
Camera Permission
Microphone Permission
Face Not Detected
if ( ex . code === FadSDK . Errors . Signature . NOT_ACCEPT_CAMERA_PERMISSION ) {
alert ( 'Camera permission required. Please enable camera access.' );
}
Configuration Options
Configure recording duration and timeouts: timer : {
recording : {
min : 2 , // Minimum recording duration (seconds)
max : 15 // Maximum recording duration (seconds)
},
faceUndetected : 5 // Timeout if face not detected (seconds)
}
Users must sign for at least min seconds and cannot exceed max seconds.
Optionally capture a selfie at the end: selfie : {
captureSelfie : true , // Enable selfie capture
imageType : 'image/png' , // Output format
imageQuality : 1 // Quality: 0.0 to 1.0
}
views : {
instructions : true , // Show instruction screen
preview : true // Show preview for confirmation
},
allowClose : true // Allow users to close the module
legends : {
tapInstruction : 'Tap to begin signing' ,
buttonFinish : 'Done' ,
recording : 'Recording in progress' ,
focusFace : 'Keep your face visible' ,
signNowHere : 'Sign here' ,
faceDetected : 'Face visible' ,
faceUndetected : 'Face not visible' ,
}
Usage Examples
Upload to Server
Display Results
With Validation
async function handleSignature ( signatureResponse ) {
const formData = new FormData ();
// Add videos
formData . append ( 'faceVideo' , signatureResponse . data . videoFace );
formData . append ( 'signatureVideo' , signatureResponse . data . videoSignature );
// Add signature image
formData . append ( 'signatureImage' , signatureResponse . data . imageSignature );
// Upload to server
const response = await fetch ( '/api/signatures' , {
method: 'POST' ,
body: formData ,
});
const result = await response . json ();
console . log ( 'Signature saved:' , result );
}
function displaySignature ( signatureResponse ) {
const faceVideoUrl = URL . createObjectURL ( signatureResponse . data . videoFace );
const sigVideoUrl = URL . createObjectURL ( signatureResponse . data . videoSignature );
// Display face video
const faceVideoElement = document . getElementById ( 'face-video' );
faceVideoElement . src = faceVideoUrl ;
// Display signature video
const sigVideoElement = document . getElementById ( 'signature-video' );
sigVideoElement . src = sigVideoUrl ;
// Display signature image
const sigImageElement = document . getElementById ( 'signature-img' );
sigImageElement . src = signatureResponse . data . imageSignature ;
// Create download links
createDownloadLink ( 'Download Face Video' , faceVideoUrl , 'face-video.webm' );
createDownloadLink ( 'Download Signature Video' , sigVideoUrl , 'signature-video.webm' );
}
async function captureSignature () {
const FAD_SDK = new FadSDK ( TOKEN , {
environment: FadSDK . getFadEnvironments (). UATHA ,
});
try {
const response = await FAD_SDK . startSignature ( CONFIGURATION );
if ( response . event === FadSDK . Constants . EventModule . MODULE_CLOSED ) {
console . log ( 'User cancelled' );
return null ;
}
// Validate signature is not empty
if ( ! isSignatureValid ( response . data . imageSignature )) {
throw new Error ( 'Signature appears to be empty' );
}
// Validate video durations
const faceVideoDuration = await getVideoDuration ( response . data . videoFace );
if ( faceVideoDuration < 2 ) {
throw new Error ( 'Video recording too short' );
}
return response . data ;
} finally {
FAD_SDK . end ();
}
}
Best Practices
Clear Instructions Always enable the instruction screen to explain the process to users before they start.
Reasonable Duration Set recording duration between 2-15 seconds for optimal user experience.
Preview Confirmation Enable preview mode so users can verify their signature before submitting.
Good Lighting Instruct users to ensure good lighting for clear face video capture.
Security Considerations
Store signature videos securely and implement proper access controls. Signature videos contain biometric data.
Videos contain personally identifiable information (PII)
Implement encryption for video storage
Follow GDPR/CCPA guidelines for biometric data
Maintain audit logs of signature access
Set appropriate retention policies
Use HTTPS for all transmissions
Troubleshooting
Camera/Microphone Not Working
Verify permissions are granted in browser
Ensure site is served over HTTPS
Check if devices are being used by another application
Test on different browsers
Improve lighting conditions
Ensure face is centered in frame
Remove glasses or face obstructions
Increase faceUndetected timeout
Check camera quality
Ensure stable internet connection
Verify adequate device resources
Test on different devices
Verify touch/mouse events are working
Check if signature area is visible
Test on different devices/browsers
Ensure JavaScript is enabled