Personal Validation System Flutter Plugin

A Flutter plugin for identity verification and validation. This plugin provides a complete solution for validating personal identification documents, performing face matching, and verifying personal information.

Features

  • Capture and validate ID documents (front and back)
  • Take a selfie for face matching
  • Validate personal information against the ID document
  • Perform face matching between selfie and ID photo
  • Phone number validation
  • Beautiful and intuitive UI for user interaction

Prerequisites

Before you begin, ensure you have the following:

  • Flutter SDK (3.3.0 or later)
  • Dart SDK (3.7.0 or later)
  • Android Studio / Xcode (for running on emulators/simulators)
  • A device with a camera (for testing on real devices)
  • A running instance of the Personal Validation System API

Installation

  1. Add the package to your pubspec.yaml:
dependencies:
  personal_validation_system: ^0.0.1
  1. Install the package:
flutter pub get
  1. Import the package in your Dart code:
import 'package:personal_validation_system/personal_validation_system.dart';

Configuration

API Endpoint

By default, the plugin is configured to use a sample API endpoint. You'll need to update this to point to your own instance of the Personal Validation System API.

Update the API endpoint in the ValidationApiService class:

final response = await _dio.post(
  'YOUR_API_ENDPOINT/api/validate/kenyan-id',
  data: formData,
  options: Options(
    headers: {
      'Content-Type': 'multipart/form-data',
      'Accept': 'application/json',
    },
  ),
);

Required Permissions

Android

Add the following permissions to your AndroidManifest.xml:

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

iOS

Add the following to your Info.plist:

<key>NSCameraUsageDescription</key>
<string>We need access to your camera to take photos of your ID and selfie</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access to your photo library to upload ID photos</string>
<key>NSMicrophoneUsageDescription</key>
<string>We need access to your microphone for video verification</string>

Usage

Basic Usage

  1. Initialize the plugin:
final _personalValidationSystem = PersonalValidationSystem();
  1. Navigate to the verification screen:
Navigator.push(
  context,
  MaterialPageRoute(
    builder: (context) => IdentityVerificationScreen(),
  ),
);

Customization

You can customize the appearance and behavior of the verification screens by extending the provided widgets or creating your own implementation.

API Response Format

The plugin expects the API to return responses in the following format:

{
  "status": "success",
  "message": "Validation completed successfully",
  "data": {
    "name": "John Doe",
    "id_number": "12345678",
    "phone_number": "+254712345678"
  },
  "validation_details": {
    "id_validation": {
      "is_valid": true,
      "message": "Valid ID number"
    },
    "ocr_extraction": {
      "extracted_text": "...",
      "name_found": true,
      "id_number_found": true
    },
    "face_detection": {
      "selfie_has_face": true,
      "id_photo_has_face": true,
      "face_count_selfie": 1,
      "face_count_id": 1,
      "faces_match": true
    },
    "phone_validation": {
      "is_valid": true,
      "message": "Valid phone number",
      "normalized_number": "+254712345678"
    }
  },
  "is_verified": true
}

Running the Example

  1. Clone this repository
  2. Navigate to the example directory: cd example/
  3. Install dependencies: flutter pub get
  4. Update the API endpoint in lib/services/validation_api_service.dart
  5. Run the app: flutter run

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please open an issue on the GitHub repository.


This project is not affiliated with any government agency or official identification service.