Verigram
Verigram
Docs
  • Docs
  • Changelog
  • Feature requests
  • Support portal
    • Verilive JavaScript SDK
    • Verilive Android SDK
    • Verilive iOS SDK
    • VeriLive Flutter SDK Integration Guide
    • Backend API

VeriLive Flutter SDK Integration Guide

A Flutter plugin that wraps the native VeriLive SDKs for Android and iOS.

It provides a Dart API for performing liveness verification on both platforms.

The plugin opens the native verification screen and returns the result to your Flutter application.

Requirements

Minimum requirements

Component

Minimum version

Flutter

3.3.0

Dart SDK

3.12.2

Android Min SDK

API 24

Android Compile SDK

API 36

iOS

14.0

Installation

  1. Add the dependency to pubspec.yaml:

dependencies:
  verilive_sdk:
    git:
      url: https://<YOUR_GITHUB_PAT>@github.com/verigram/verilive2-sdk-flutter.git
      ref: main

Fetch the package:

flutter pub get

Android

The plugin uses the native Android SDK distributed through a private GitLab Maven repository. Add the repository to android/settings.gradle in your Flutter project:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

    repositories {
        google()
        mavenCentral()

        maven {
            url = uri("https://gitlab.com/api/v4/projects/75704481/packages/maven")

            credentials(HttpHeaderCredentials::class) {
                name = "Deploy-Token"
                value = "<YOUR_DEPLOY_TOKEN>"
            }

            authentication {
                create<HttpHeaderAuthentication>("header")
            }

            content {
                includeGroupByRegex("kz\\.verigram.*")
            }
        }
    }
}

iOS

The plugin distributes the iOS XCFramework through CocoaPods.

No additional configuration is required.

Integration Steps

1. Create a session on the backend

Send a POST request to the /liveness2/session endpoint:

#!/usr/bin/env bash

API_URL="<API_URL>"
API_KEY="<your-api-key>"
API_SECRET="<your-api-secret>"
FLOW_ID="<your-flow-id>"
PERSON_ID="<your-person-id>"

### THE LINES BELOW DO NOT REQUIRE ANY MODIFICATIONS ###

API_PATH="/liveness2/session"
TIMESTAMP=$(date +%s)
SIGNABLE_STR=$(echo -n -e "$TIMESTAMP$API_PATH")
HMAC_DIGEST=$(echo -n "$SIGNABLE_STR" | openssl sha256 -hmac "$API_SECRET" | cut -d' ' -f2)

DATA_JSON=$(cat <<-EOF
{
  "person_id": "$PERSON_ID",
  "flow_id": "$FLOW_ID"
}
EOF
)

curl -i -X POST "https://$API_URL$API_PATH" \
  -H "Content-Type: application/json" \
  -H "X-Verigram-Api-Version: 2.0" \
  -H "X-Verigram-Api-Key: $API_KEY" \
  -H "X-Verigram-Hmac-SHA256: $HMAC_DIGEST" \
  -H "X-Verigram-Ts: $TIMESTAMP" \
  -d "$DATA_JSON"

The endpoint returns a JSON object containing the following fields:

  • session_id

  • access_token

  • person_id

  • flow_id

2. Start the SDK

import 'package:verilive_sdk/verilive_sdk.dart';

final result = await VeriliveSdk.startLiveness(
  VeriliveParams(
    baseUrl: 'https://your-api.example.com',
    personId: 'personId',
    accessToken: 'your_access_token',
    flowId: 'your_flow_id',
    sessionId: 'your_session_id',
  ),
);

3. Handle the result

if (result.success) {
  // Liveness verification passed
} else {
  final code = result.errorCode;
}

API Reference

VeriliveSdk.startLiveness(VeriliveParams) → Future

Opens the native liveness verification screen. The call is suspended until the verification is completed, cancelled by the user, or terminated due to an error.

The method returns a VeriliveResult in all cases.

VeriliveParams

Parameters used to start the flow. Implements Parcelable.

data class VeriliveParams(
    val baseUrl: String,
    val personId: String,
    val accessToken: String,
    val flowId: String,
    val sessionId: String,
    val attemptsLeft: Int? = null,
) : Parcelable

Fields

  • baseUrl: String — Base API URL. An empty string ("") uses the default endpoint. For an on-premises deployment, specify the URL of your installation.

  • personId: String — Identifier of the user undergoing verification.

  • accessToken: String — Access token received from the backend.

  • flowId: String — Flow identifier.

  • sessionId: String — Identifier of the current session or attempt.

  • attemptsLeft: Int? — Optional. Number of remaining attempts. The default value is null.

VeriliveResult

The result returned after the flow is completed.

data class VeriliveResult(
    val success: Boolean,
    val errorCode: String?,
    val errorMessage: String?,
)

Fields

  • success: Boolean — true if the liveness verification passed; false in all other cases, including verification failure, cancellation, or an error.

  • errorCode: String? — Error code intended for programmatic handling. See Error Codes. The value is null when success == true.

  • errorMessage: String? — Human-readable error description. The value is null when success == true.


Error Handling

Errors are returned in VeriliveResult. Use errorCode for programmatic handling and errorMessage for displaying a message to the user.

success

errorCode

Meaning

true

null

Verification passed

false

LIVENESS_FAILED

Liveness verification failed

false

SERVER_ERROR

Backend error

false

NETWORK_ERROR

Network connection error

false

CANCELLED_BY_USER

The user tapped Back or cancelled the verification

false

INTERNAL_ERROR

Internal SDK error

Error Codes

Code

Description

LIVENESS_FAILED

Liveness verification failed: the face was not confirmed as live.

SERVER_ERROR

The backend returned an error during verification.

NETWORK_ERROR

A network connection error prevented the verification from being completed.

CANCELLED_BY_USER

The user cancelled the verification by tapping Back.

INTERNAL_ERROR

An internal SDK error occurred.

PrevVerilive iOS SDK
NextBackend API
Was this helpful?