Implementation Guide

Authentication

A unique access token should be created upon each SDK entry. In order to generate an access token, please refer to Valify's Authentication Documentation.

Importing

Import the module’s function in your file using the following line

import 'package:vidvliveness_flutter_plugin/vidvliveness_flutter_plugin.dart';

Configurations

The plugin builder is separated into two components.

Required Configurations

Initialize the required parameters as follows while adding the required configurations

  final String baseURL = ' '; //put your acctual base url here
  final String bundleKey = ' '; //put your actual bundle key here
  final String accessToken = ' '; //put your actual access token here

Optional Configurations

Initialize the required parameters as follows while adding the desired configurations

final String language = "<insert_language>"; // "en" is set as default
final bool enableSmile = <boolean>; // true is set as default
final bool enableLookLeft = <boolean>; // true is set as default
final bool enableLookRight = <boolean>; // true is set as default
final bool enableCloseEyes = <boolean>;// true is set as default
final String trials = "<string>"; // default is "3"
final String instructions = "<string>"; // default is "4"
final String timer = "<string>"; // default is "10"
final String primaryColor =<hex_color_code>”; //
final bool enableVoiceover= <boolean>; // true is set as default

//this line is required to enable face match 
final String ocrTransactionID = "<ocr_transaction_id>";//string

final bool showErrorMessage= <boolean>; // true is set as default

Configurations Breakdown

This section shows the breakdown of all optional builder configurations.

  1. The following line is where the user interface language is set.

final String language = "<insert_language>"; // ["ar" or "en"] 

The currently supported languages are Arabic and English

  1. If the following line is set to true, the SDK requires the user to smile during the experience

final bool enableSmile= <boolean>;
  1. If the following line is set to true, the SDK requires the user to look to the left during the experience

final bool enableLookLeft= <boolean>;
  1. If the following line is set to true, the SDK requires the user to look to the right during the experience

final bool enableLookRight= <boolean>;
  1. If the following line is set to true, the SDK requires the user to close their eyes during the experience

final bool enableCloseEyes= <boolean>;
  1. The integer set in the following line determines how many failed attempts the user has during a single SDK experience.

final String trials= <string>;
  1. The integer set in the following line determines how many instructions the user will need to follow to successfully complete a single SDK experience.

final String instructions= <string>;
  1. The integer set in the following line determines how much time (in seconds) the user will be given to complete each task.

final String timer= <string>;
  1. The following line is optional and can be used to set your company's branding color to the SDK's user interface.

final String primaryColor =<hex_color_code>”;
  1. If the following line is set to true, voice-over will be added to the SDK experience dictating the actions expected from the user.

final bool enableVoiceover= <boolean>;
  1. If this field has the OCR transaction ID filled, then the face match service is enabled and the referenced transaction ID will be compared with an image captured of the user's face during the SDK experience.

final String facematch_ocr_transactionId =<facematch_ocr_transactionId >”;//string
  1. If the following line is set to true, then an error message will appear in the user interface in the case that the user did not pass the face match or the liveness service.

final bool showErrorMessage= <boolean>;

Parameter Declaration

Declare the SDK parameters with the configuration variables previously created

    Map<String, dynamic> params = {
      'base_url': baseURL,
      'access_token': accessToken,
      'bundle_key': bundleKey,
      'language': language,
      'liveness_time_per_action': timer,
      'liveness_number_of_instructions': instructions,
      'enable_smile': enable_smile,
      'enable_look_left': enable_look_left,
      'enable_look_right': enable_look_right,
      'enable_close_eyes': enable_close_eyes,
      'enable_voiceover': enable_voiceover,
      'primary_color': primaryColor,
      'show_error_message': show_error_message,
      'facematch_ocr_transactionId':facematch_ocr_transactionId //in case of face match
    };

Start the SDK

Use the following code snippet to run the plugin

    try {
      final result = await VidvlivenessFlutterPlugin.startLiveness(params);
        //handle logic to use the liveness response depending on the state
    } catch (e) {
        //catch errors
    }

Last updated