Vlens KYC Mobile SDK

Introduction :

Vlens KYC Package is a Flutter package that provides a simple and easy-to-use way to verify the identity of a user. The package takes a picture of the user's ID (front and back) and a selfie, and then uses advanced machine learning algorithms to verify that the ID is real and that the selfie matches the person in the ID.

The package is useful for a variety of applications, such as:

KYC/AML compliance Fraud prevention User onboarding Age verification The package is easy to use and can be integrated into any Flutter app with just a few lines of code

Installation:

#iOS

Add two rows to the ios/Runner/Info.plist file:

One with the key Privacy - Camera Usage Description and a usage description. If editing Info.plist as text, add: NSCameraUsageDescription your usage description here add:

<key>NSCameraUsageDescription</key>
<string>your usage description here</string>

#Android

Change the minimum Android SDK version to 21 (or higher) in your android/app/build.gradle file. minSdkVersion 21

Add the following permission to your app's manifest, located at android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>

Copy the package file provided by vlens to your app folder.

Add the package in pubspec.yaml file under the dependencies :

dependencies:
  flutter:
    sdk: flutter 
  vlens: 
    path: packages/vlens

Run the following command to install the package: flutter pub get

Once you have completed these steps, you will be able to use the VLens package in your Flutter app.

Example :

import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:vlens/vlens.dart';

class VlensTrail extends StatefulWidget {
  @override
  _VlensTrailState createState() => _VlensTrailState();
}

class _VlensTrailState extends State<VlensTrail> {
  UploadPhotosResponseModel select = UploadPhotosResponseModel();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                GestureDetector(
                  onTap: () async {
                    // Here is how to start the package. This function will
                    // start the package and in the UploadPhotosResponseModel you will
                    // get all the data you need, such as name, ID number, and
                    // more.
                    UploadPhotosResponseModel s = await Vlens.instance
                        .startVlensFlow(
                            context: context, apiKey: "add your API key here",language: Language.arabic);
                    setState(() {
                      select = s;
                    });
                  },
                  child: const Text("start vlens"),
                ),
                    select.data != null ? Column(
                  children: [
                    Text(select.data!.name ?? "" ),
                    Text(select.data!.idNumber ?? "" ),
                  select.data!.frontIdPicture!=null? ShowBase64Image(base64Image: select.data!.frontIdPicture!):SizedBox.shrink(),
                  select.data!.backIdPicture!=null? ShowBase64Image(base64Image: select.data!.backIdPicture!):SizedBox.shrink(),
                select.data!.faceMatchingPicture!=null? ShowBase64Image(base64Image: select.data!.faceMatchingPicture!):SizedBox.shrink(),
                  ],
                ):SizedBox.shrink(),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
class ShowBase64Image extends StatelessWidget {
  final String base64Image;

  const ShowBase64Image({Key? key, required this.base64Image}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Convert the base64 string to a Uint8List.
    final Uint8List imageBytes = base64Decode(base64Image);

    // Create a dart:ui.Image object from the Uint8List.
    final Image image = Image.memory(imageBytes);

    return SizedBox(
      height: 150,
      width: 150,
      child: Card(
        child: ClipRRect(
          borderRadius: BorderRadius.circular(5),
          child: image,
        ),
      ),
    );
  }
}

Last updated