nebuia_plugin 0.0.91 copy "nebuia_plugin: ^0.0.91" to clipboard
nebuia_plugin: ^0.0.91 copied to clipboard

NebuIA Plugin

nebuia #

N|Nebula

Introduction #

NebuIA Native Core is library for nebuia services integration. NebuIA use platform native channels and run over native languages Objective-C for IOS and Kotlin/Java for Android

NebuIA is an Deep Learning library and supports

  • Face Detection and auto crop
  • Proof of Live in real time
    • Darkened images
    • Office fluorescent lighting
    • Office with lighting turned off, illuminated only by natural sunlight
    • Supported attacks
      • Print
      • 2D Mask
      • 2 Replay
  • Document Detection in real time
    • Faster and best accuracy than conventional ID Detector (95%)
    • Support auto cropping
  • Proof of Address
    • Automatic extract address
  • Tipical OTP Verifications for Email and Phone Number SMS
    • Time-Based One-Time Password (TOTP)
    • HMAC-Based One-Time Password (HOTP)

Requirements #

  • Flutter 2 - Null safety

Integration #

In your pubspec.yaml level app

    nebuia_plugin: ^x.x.x

Add public and private key to your values.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="nebuia_public_key">S5PS103-RHWM8E8-*******-7GQ0NX1</string>
    <string name="nebuia_secret_key">c96d9080-c479-4439-****-b1523c2e0af4</string>
</resources>

Add public and private key to your Info.plist

<key>NebuIAPublicKey</key>
<string>S5PS103-RHWM8E8-*******-7GQ0NX1</string>
<key>NebuIASecretKey</key>
<string>c96d9080-c479-4439-****-b1523c2e0af4</string>

Sample Integration

import 'package:nebuia_plugin/nebuia_plugin.dart';

// set client endpoint (only if you need custom client installation) - omit for default services
 NebuiaPlugin.setClientURI = 'https://my.endpoint.com/api/v1/services';
// call your service for temporal code generation
// code is response number string
NebuiaPlugin.setTemporalCode = code;

// create new report
String? generatedReport = await NebuiaPlugin.createReport;
// store generatedReport in your databse for future usage
// if you already have a report set this with
NebuiaPlugin.setReport = generatedReport;


// Scan Mexian ID/Passport
bool status = await NebuiaPlugin.documentDetection;

// Face spoofing test
bool? status = await NebuiaPlugin.faceLiveDetection;

// Scan proof of address
LinkedHashMap? address = await NebuiaPlugin.captureAddressProof;
// Save address - custom address to verify
LinkedHashMap? address = await NebuiaPlugin.saveAddress(address);

// Scan 4 fingers - hand 0 left / 1 right
Fingers? fingers = await NebuiaPlugin.fingerDetection(hand);
// Generate WSQ from fingerprint - image is in Uint8List
Uint8List? wsq = await NebuiaPlugin.generateWSQFingerprint(image);

// save email
bool status = await NebuiaPlugin.saveEmail(email);
// save phone
bool status = await NebuiaPlugin.savePhone(phone);
// send OTP email
bool status = await NebuiaPlugin.generateOTPEmail;
// send OTP phone
bool status = await NebuiaPlugin.generateOTPPhone;
// verify OTP email
bool status = await NebuiaPlugin.verifyOTPEmail(code);
// verify OTP phone
bool status = await NebuiaPlugin.verifyOTPPhone(code);

// Generate record
String? path = await NebuiaPlugin.recordActivity(text);

// get face image
Uint8List? face = NebuiaPlugin.getFaceImage;

// get ID front image
Uint8List? face = NebuiaPlugin.getIDFrontImage;
// get ID back image
Uint8List? face = NebuiaPlugin.getIDBackImage;

Notes #

Address validation flow sample

Address model sample - generated with josn serializer

LinkedHashMap? _address = await NebuiaPlugin.captureAddressProof;
if (_address != null) {
        // check address response
        if (_address.containsKey('status')) {
          // check status response
          if (_address['status']) {
            // check if payload is valid response
            if (_address['payload'].runtimeType.toString() ==
                '_InternalLinkedHashMap<Object?, Object?>') {
              var _payload = _address['payload'];
              // if valid and status is true save address
              if (_payload['valid']) {
                // show form address
                try {
                  // try to deserialize address
                  addressModel = AddressModel.fromJson(Map.from(_payload));
                  sendEvent(
                    NebuIAEvent(
                        action: NebuIAAction.addressVerified),
                  );
                } catch (e) {
                  sendEvent(
                    NebuIAEvent(
                        action: NebuIAAction.addressError,
                        message: 'address not found'),
                  );
                }
              } else {
                // verify manual address
                _validateAddress(_payload['address'][0]);
              }
            } else {
              sendEvent(
                NebuIAEvent(
                    action: NebuIAAction.addressError,
                    message: 'address not found'),
              );
            }
          } else {
            sendEvent(
              NebuIAEvent(
                  action: NebuIAAction.addressError,
                  message: 'address not found'),
            );
          }
        } else {
          sendEvent(
            NebuIAEvent(
                action: NebuIAAction.addressError,
                message: 'address not found'),
          );
        }
} else {
    // logic for failed address
}
part 'address.model.g.dart';

@JsonSerializable()
class AddressModel extends BaseNetworkModel<AddressModel> {
  late List<String>? address;
  final List<VerificationsAddress> verifications;
  final ZoneAddress zone;
  final StateAddress state;
  final bool valid;

  // manual input
  late String? street;
  late String? outdoor_number;
  late String? interior_number;

  AddressModel(this.address,
      this.verifications, this.zone, this.state, this.valid);

  factory AddressModel.fromJson(Map<String, dynamic> json) => _$AddressModelFromJson(json);

  @override
  AddressModel fromJson(Map<String, dynamic> json) {
    return AddressModel.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() => _$AddressModelToJson(this);
}
part 'verifications.address.model.g.dart';

@JsonSerializable()
class VerificationsAddress extends BaseNetworkModel<VerificationsAddress> {
  final String description;
  final bool status;
  String? note;

  VerificationsAddress(this.description, this.note, this.status);

  factory VerificationsAddress.fromJson(Map<String, dynamic> json) => _$VerificationsAddressFromJson(json);

  @override
  VerificationsAddress fromJson(Map<String, dynamic> json) {
    return VerificationsAddress.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() => _$VerificationsAddressToJson(this);
}
part 'state.address.model.g.dart';

@JsonSerializable()
class StateAddress extends BaseNetworkModel<StateAddress> {
  final String complete_name;
  final String abbreviation;
  final String renapo;
  final String two_digits;
  final String three_digits_nomenclature;
  final String key;

  StateAddress(this.complete_name, this.abbreviation, this.renapo,
      this.two_digits, this.three_digits_nomenclature, this.key);

  factory StateAddress.fromJson(Map<String, dynamic> json) => _$StateAddressFromJson(json);

  @override
  StateAddress fromJson(Map<String, dynamic> json) {
    return StateAddress.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() => _$StateAddressToJson(this);
}
part 'zone.address.model.g.dart';

@JsonSerializable()
class ZoneAddress extends BaseNetworkModel<ZoneAddress> {
  final String zip_code;
  final String township;
  final String township_type;
  final String municipality;
  final String state;
  final String city;
  final String cp_id;
  final String state_id;
  final String office_id;
  final String township_type_id;
  final String municipality_id;
  final String township_zip_type_id;
  final String zone;
  final String city_id;

  ZoneAddress(
      this.zip_code,
      this.township,
      this.township_type,
      this.municipality,
      this.state,
      this.city,
      this.cp_id,
      this.state_id,
      this.office_id,
      this.township_type_id,
      this.municipality_id,
      this.township_zip_type_id,
      this.zone,
      this.city_id);

  factory ZoneAddress.fromJson(Map<String, dynamic> json) => _$ZoneAddressFromJson(json);

  @override
  ZoneAddress fromJson(Map<String, dynamic> json) {
    return ZoneAddress.fromJson(json);
  }

  @override
  Map<String, dynamic> toJson() => _$ZoneAddressToJson(this);
}

Fingerprint

On fingerprint scanner end you can pass any finger image to get WSQ File.

await NebuiaPlugin.generateWSQFingerprint(image);