Skip to content

Core Identity

Core Identity is a Flutter wrapper library designed to streamline the integration of the Metric SDK into Flutter applications. It simplifies the process of implementing liveness checks, a crucial component of identity verification systems. By utilizing the Metric SDK through Core Identity, developers can easily incorporate robust liveness detection capabilities into their Flutter apps, enhancing security and user experience.

Installation

To install the Core Identity SDK, add the code below to your pubspec.yaml.

NB: ref represents the version number of the SDK and is subject to change.

yaml
core_identity
  git:
    url: [email protected]:v3/hubtel/Mobile-Apps/Platform-Library-Flutter-Core-Identity
    ref: 1.0.1

Usage

To use the SDK:

  1. Initialize the HubtelMetricKYC class.
dart
final hubtelMetricKycPlugin = HubtelMetricKyc();
  1. Launch the SDK with the user's phone Number and Ghana card/Verification number.
dart
Future<void> identifyCustomer() async {
  try {
     hubtelMetricKycPlugin.launch(
      cardNumber: 'GHA-*********-1',
      phoneNumber: '055*****39',
      onTokenGenerationComplete: onTokenGenerationComplete,
      onKycCompleted: onMetricResultReceived,
    );
  } on PlatformException catch (err) {
    log('${err.message}', name: '$runtimeType');
  }
  if (!mounted) return;
}

//This callback fires when verification is done.
onMetricResultReceived(Result? result) {
  print('onMetricResultReceived: $result');
}

//This callback fires when token generation is done.
onTokenGenerationComplete(bool tokenGenerated) {
  print('onTokenGenerationComplete: $tokenGenerated');
}

Result

Result is the type returned by the launch() method and it encapsulates the verification results of the SDK.

Data TypeDescription
isVerifiedA Boolean that specifies whether verification was successful.
errorCodeA String? that specifies whether an error occurred during verification or not. returns null if there is no error or "-1" if there is an error.
messageA String that specifies the message of the verification whether it passes or fails.

iOS Configuration

  • Minimum deployment target should be iOS 15.
  • Ensure that the NSCameraUsageDescription key is added to the Info.plist file in the iOS project. This is necessary to request permission to access the device's camera.
xml
<key>NSCameraUsageDescription</key>
<string>My App will like to access your camera to scan your face for verification</string>