idemia_l1rd_invoker

pub package

A Flutter plugin for integrating IDEMIA L1 RD (Registered Device) biometric services for Aadhaar authentication in India. This plugin enables Flutter applications to communicate with IDEMIA's L1 RD Service installed on Android devices for biometric authentication operations.

Features

  • 🔐 Device Info Retrieval: Get detailed information about the connected RD device
  • 👆 Fingerprint Capture: Capture fingerprint biometric data with customizable PID options
  • UIDAI Compliant: Fully compatible with UIDAI Aadhaar authentication standards
  • 📱 Android Support: Works seamlessly with IDEMIA L1 RD Service on Android devices

Requirements

  • Flutter SDK: >=3.3.0
  • Dart SDK: >=3.10.3
  • Android: API 24 (Android 7.0) or higher
  • IDEMIA L1 RD Service app must be installed on the device

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  idemia_l1rd_invoker: ^0.0.1

Then run:

flutter pub get

Android Setup

1. Update AndroidManifest.xml

Add the following queries to your android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Add queries for IDEMIA RD Service -->
    <queries>
        <package android:name="com.idemia.l1rdservice" />
    </queries>

    <application>
        <!-- Your app configuration -->
    </application>
</manifest>

2. Minimum SDK Version

Ensure your android/app/build.gradle has minimum SDK version 24:

android {
    defaultConfig {
        minSdkVersion 24
        // ...
    }
}

Usage

Import the package

import 'package:idemia_l1rd_invoker/idemia_l1rd_invoker.dart';

Get Device Information

Retrieve information about the connected RD device:

try {
  final String? deviceInfo = await IdemiaL1rdInvoker.getDeviceInfo();

  if (deviceInfo != null) {
    print('Device Info: $deviceInfo');
    // Parse the XML response as needed
  }
} on Exception catch (e) {
  print('Error getting device info: $e');
}

Capture Fingerprint

Capture fingerprint biometric data with PID options:

// Define PID options according to UIDAI specifications
String pidOptions = '''
<PidOptions ver="1.0">
  <Opts fCount="1" fType="0" format="0" pidVer="2.0"
        timeout="10000" otp="" wadh="" posh=""/>
</PidOptions>
''';

try {
  final String? pidData = await IdemiaL1rdInvoker.captureFingerprint(pidOptions);

  if (pidData != null) {
    print('PID Data: $pidData');
    // Use the PID data for Aadhaar authentication
  }
} on Exception catch (e) {
  print('Error capturing fingerprint: $e');
}

Complete Example

import 'package:flutter/material.dart';
import 'package:idemia_l1rd_invoker/idemia_l1rd_invoker.dart';

class BiometricScreen extends StatefulWidget {
  @override
  _BiometricScreenState createState() => _BiometricScreenState();
}

class _BiometricScreenState extends State<BiometricScreen> {
  String _result = 'No data';

  Future<void> _getDeviceInfo() async {
    try {
      final deviceInfo = await IdemiaL1rdInvoker.getDeviceInfo();
      setState(() {
        _result = deviceInfo ?? 'No device info';
      });
    } catch (e) {
      setState(() {
        _result = 'Error: $e';
      });
    }
  }

  Future<void> _captureFingerprint() async {
    String pidOptions = '''
    <PidOptions ver="1.0">
      <Opts fCount="1" fType="0" format="0" pidVer="2.0"
            timeout="10000" otp="" wadh="" posh=""/>
    </PidOptions>
    ''';

    try {
      final pidData = await IdemiaL1rdInvoker.captureFingerprint(pidOptions);
      setState(() {
        _result = pidData ?? 'No PID data';
      });
    } catch (e) {
      setState(() {
        _result = 'Error: $e';
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('IDEMIA RD Service')),
      body: Padding(
        padding: EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            ElevatedButton(
              onPressed: _getDeviceInfo,
              child: Text('Get Device Info'),
            ),
            SizedBox(height: 16),
            ElevatedButton(
              onPressed: _captureFingerprint,
              child: Text('Capture Fingerprint'),
            ),
            SizedBox(height: 24),
            Text('Result:', style: TextStyle(fontWeight: FontWeight.bold)),
            SizedBox(height: 8),
            Expanded(
              child: SingleChildScrollView(
                child: Text(_result),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

PID Options Parameters

The PID options XML supports the following parameters:

  • fCount: Number of fingerprints to capture (typically "1")
  • fType: Finger type (0 = any finger)
  • format: Data format (0 = XML)
  • pidVer: PID version (typically "2.0")
  • timeout: Capture timeout in milliseconds (e.g., "10000" for 10 seconds)
  • otp: One-time password (if required)
  • wadh: Wadh parameter for Aadhaar
  • posh: Position parameter

Refer to UIDAI specifications for detailed parameter descriptions.

Response Format

Both getDeviceInfo() and captureFingerprint() return XML strings that follow UIDAI specifications. You'll need to parse these XML responses in your application.

Device Info Response Example

<DeviceInfo>
  <additional_info>
    <Param name="srno" value="123456"/>
    <Param name="sysid" value="DEVICE_ID"/>
  </additional_info>
</DeviceInfo>

PID Data Response Example

<PidData>
  <Resp errCode="0" errInfo="Success"/>
  <DeviceInfo>...</DeviceInfo>
  <Skey>...</Skey>
  <Hmac>...</Hmac>
  <Data>...</Data>
</PidData>

Error Handling

The plugin throws exceptions with descriptive messages. Always wrap calls in try-catch blocks:

try {
  final result = await IdemiaL1rdInvoker.getDeviceInfo();
} on Exception catch (e) {
  // Handle errors:
  // - Device not connected
  // - RD Service not installed
  // - Operation cancelled by user
  // - Timeout errors
  print('Error: $e');
}

Common Issues

RD Service Not Found

Error: Activity not attached or package not found

Solution:

  1. Ensure IDEMIA L1 RD Service app is installed on the device
  2. Add the <queries> section to your AndroidManifest.xml as shown above

Compilation Errors

Error: Package name mismatch

Solution: Ensure the package name in your plugin matches across:

  • pubspec.yaml: package: com.sysarc.rdservice.idemia_l1rd_invoker
  • Kotlin files: package com.sysarc.rdservice.idemia_l1rd_invoker

Platform Support

Platform Supported
Android
iOS
Web
Windows
macOS
Linux

Currently, only Android is supported as IDEMIA RD Service is Android-specific.

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.

Disclaimer

This plugin is designed to work with IDEMIA L1 RD Service. Ensure you have the necessary permissions and licenses to use IDEMIA hardware and software. This plugin is not officially affiliated with or endorsed by IDEMIA or UIDAI.

Support

For issues, feature requests, or questions, please file an issue on GitHub.

Additional Resources