Giter VIP home page Giter VIP logo

flutter_libjeid's Introduction

LibJeID (Library for Japanese Electronic ID) is a library for smartphones to access public IC cards such as My Number cards, driver's licenses, and passports that are popular in Japan.

logo

Features

Now we are using free version of libjeid, so you don't need any product library key to install. The product library is under developing

Official document

https://www.osstech.co.jp/download/libjeid/

Android version function list

  • Reading my number card
  • Public personal authentication function of My Number Card
  • Reading of residence cards and special permanent resident certificates
  • Verification of authenticity of residence cards and special permanent resident certificates
  • Reading driver's license
  • Driving license authenticity verification

iOS version function list

  • Reading my number card
  • Reading of residence cards and special permanent resident certificates
  • Verification of authenticity of residence cards and special permanent resident certificates
  • Reading driver's license
  • Driving license authenticity verification

Functions item in free version and paid version

available_data

How to use

Heading to example project to see the complete example of how to use this library.

First create an instance of FlutterLibjeid(), check for the NFC availability, and then subscribe to the events

final _scanner = FlutterLibjeid();

final isNfcAvailable = await _scanner.isAvailable();

if (!isNfcAvailable) {
  // Show error message
  return;
}

final _subscription = _scanner.eventStream.listen((event) {
  switch (event) {
    case FlutterLibjeidEventScanning():
      // Use .setMessage() to show the message inside the scanning dialog
      _scanner.setMessage(message: 'Scanning...');
      break;

    case FlutterLibjeidEventConnecting():
      _scanner.setMessage(message: 'Connecting...');
      break;

    case FlutterLibjeidEventParsing():
      _scanner.setMessage(message: 'Parsing...');
      break;

    case FlutterLibjeidEventSuccess(data: FlutterLibjeidCardData data):
      // Use .stopScan() to cancel the scanning process
      _scanner.stopScan();
      _onSuccess(data);
      break;

    case FlutterLibjeidEventFailed(error: FlutterLibjeidError error):
      _scanner.stopScan();
      _onError(error);
      break;

    case FlutterLibjeidEventCancelled():
        break;
  }
});

And then handling the data/error as needed

void _onSuccess(FlutterLibjeidCardData data) {
  switch (data) {
    case ResidentCardData():
      // Do something with the data
      break;

    case MyNumberCardData():
      // Do something with the data
      break;

    case DriverLicenseCardData():
      // Do something with the data
      break;

    case PassportCardData():
      // Do something with the data
      break;
  }
}

void _onError(FlutterLibjeidError error) {
  switch (error) {
    case NfcNotAvailableError():
      // Do something with the error
      break;

    case NfcTagUnableToConnectError():
      // Do something with the error
      break;

    case NfcCardBlockedError():
      // Do something with the error
      break;

    case NfcCardTypeMismatchError():
      // Do something with the error
      break;

    case InvalidMethodArgumentsError():
      // Do something with the error
      break;

    case InvalidCardPinError(int remainingTimes):
      // Do something with the error
      break;

    case InvalidCardKeyError():
      // Do something with the error
      break;

    case UnknownError():
      // Do something with the error
      break;
  }
}

Next, calling the scan method you want to use

await _scanner.scanResidentCard(cardNumber: 'xxxxxxxxxxxx');

await _scanner.scanMyNumberCard(pin: 'xxxx');

await _scanner.scanDriverLicenseCard(pin1: 'xxxx', pin2: 'xxxx');

await _scanner.scanPassportCard(cardNumber: 'xxxxxxxxxx', birthDate: 'xxxxxxxxxx', expiredDate: 'xxxxxxxxxx');

Finally, don't forget to unsubscribe the event stream when you no longer need it

_subscription.cancel();

Issue Tag Connection Lost

There are some reason cause tag connect lost

  • The iPhone is very sensitive to positioning, so even a slight movement of the card during reading may result in "Tag connection lost".
  • There are differences in readability between devices. We have also confirmed that some devices can hardly read cards. Even with the same model, there may be individual differences.
  • Try to keep your card near by tag while reading, don't move it

Issue is reported in official repository: osstech-jp/libjeid-ios-app#1

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a feature, please send a pull request.

flutter_libjeid's People

Contributors

tuyenponos avatar hungps-ponos avatar hungps avatar

Watchers

 avatar

Forkers

hungps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.