Giter Site home page Giter Site logo

newlogic / smartscanner-core Goto Github PK

View Code? Open in Web Editor NEW
68.0 7.0 18.0 246.1 MB

ID scanning Android app and library. Supports MRZ, NFC, Barcodes, and ID PASS Lite cards.

License: Apache License 2.0

Kotlin 94.82% Java 5.18%
barcode-scanner idpass kotlin mrz-scanner nfc hacktoberfest

smartscanner-core's Introduction

SmartScanner Core

ID scanning Android app and library. Supports MRZ, NFC, Barcodes, and ID PASS Lite cards.

Get it on Google Play

Note: The library's API might keep evolving before we reach v1.0, so be careful when upgrading between these pre-v1.0 versions. Starting at v1.0 we will be careful in introducing breaking API changes.

Features

  • Scan MRZ
  • Scan NFC
  • Scan Barcode
  • Scan ID PASS Lite
  • Scan OCR
  • Supports Intent Call Out (ODK & Non-ODK)

This repository also includes an Android demo app to test what the library can do.

Related projects

Installation

Declare Maven Central repository in the dependency configuration, then add this library in the dependencies. An example using build.gradle:

repositories {
  mavenCentral()
}

dependencies {
  implementation "org.idpass:idpass-smartscanner:0.0.1-SNAPSHOT"
}

If you want to build this library from source, instructions to do so can be found in the Building from source wiki page.

Usage

The following table shows the intent actions available for each operation available in the library, both in ODK and Non-ODK:

Scan Operation ODK Non-ODK
MRZ org.idpass.smartscanner.odk.MRZ_SCAN org.idpass.smartscanner.MRZ_SCAN
NFC org.idpass.smartscanner.odk.NFC_SCAN org.idpass.smartscanner.NFC_SCAN
Barcode org.idpass.smartscanner.odk.BARCODE_SCAN org.idpass.smartscanner.BARCODE_SCAN
QR code org.idpass.smartscanner.odk.QRCODE_SCAN org.idpass.smartscanner.QRCODE_SCAN
ID PASS Lite org.idpass.smartscanner.odk.IDPASS_LITE_SCAN org.idpass.smartscanner.IDPASS_LITE_SCAN
OCR org.idpass.smartscanner.odk.OCR_SCAN org.idpass.smartscanner.OCR_SCAN

To perform an operation, create an intent for the desired operation. This example shows how to call an intent to scan an MRZ (ODK):

import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {

  private const val OP_SCANNER = 1001 // Activity request code

  override fun onStart() {
    super.onStart()

    try {
      val action = "org.idpass.smartscanner.odk.MRZ_SCAN"
      val intent = Intent(action)
      startActivityForResult(intent, OP_SCANNER)
    } catch (ex: ActivityNotFoundException) {
      ex.printStackTrace()
    }
  }

  public override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
    super.onActivityResult(requestCode, resultCode, intent)

    if (requestCode == OP_SCANNER) {
      if (resultCode == Activity.RESULT_OK) {
        val bundle = intent?.getBundleExtra("result")
      }
    }
  }

}

The bundle variable is a Bundle object containing the scan results. For example, the scanned surname can be obtained through:

val surname = bundle.getString("surname")

Refer to the Result fields reference for the different fields available from the scan results.

Refer to the API Reference for complete information about each scan operation and the different options available.

Refer to the SmartScanner intent extra reference for examples on how to pass different options intent extra to SmartScanner.

Finally, for convenience we recommend using the smartscanner-android-api library which simplifies the app intent call out process.

Running the demo app

The Android demo app is available in this repository's app directory. Open this directory in Android Studio (version 4.1 and above) and the app can be built and run from there.

License

Apache-2.0 License

smartscanner-core's People

Contributors

arnellebalane avatar jeremi avatar jlduragos avatar megaxayda avatar nabaanahith avatar nicholemnl avatar rjmangubat23 avatar typelogic avatar wenge8n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

smartscanner-core's Issues

Fix support for MRZ Passport Scanning

  • Currently, there are problems when scanning MRZ for passports. Which maybe is due to the Image cropping or processing of how the Image is analyzed from the reader
  • Fix Skewed images upon capture

Reorganize the different Analyzer

There are too many unnecessary branches in the code, we need to create an Analyser Interface that implement each of the AnalyzerType.

Add config for NFC Options

Current Behaviour

No dedicated config options for NFC

Expected Behaviour

Add dedicated config options for NFC for integration with plugin apis

name issue

Current Behaviour

showing names not in proper way

Expected Behaviour

show the current name as given name and surname only

  • Version:

Update Scanner camera UI

  • Improve camera box UI when selected
  • Update ID Pass branding
  • Add and improve UI by having scan edges
  • Add transparent overlay to camera

Failed to read Data Groups

Current Behaviour

I scan my passport with smartscanner and the UI showed check marks in the Authentication section. But the debug logs showed failure to verify the Data Group hashes:

W/PassportNFC: Skipping DG1 during HT verification because file could not be read.
W/PassportNFC: Skipping DG2 during HT verification because file could not be read.
W/PassportNFC: Skipping DG11 during HT verification because file could not be read.
W/PassportNFC: Skipping DG12 during HT verification because file could not be read.
W/PassportNFC: Skipping DG15 during HT verification because file could not be read.

Expected Behaviour

The above lines should not appear in the logcat debug messages.

When the above lines does not appear in the logcat debug messages, it means that the Data Group hashes got read successfully and its values re-computed and match. This is important because the correct values of these hashes is a check against content tampering.

Steps to Reproduce the Problem

  1. Use smartscanner-core to scan a passport
  2. Notice that under Authentication section claims passport is valid despite the Data Group hashes are not verified.

Context

The Data Group hashes are hashes of the passport content and is what the Document Signer certificate is certifying. This document signer certificate is further anchored to the country signing certificate present in the csca file.

This issue has dependency of another issue #48

  • Version:

Fix Image crop and path

TODOs:

  • Fix the image resolution from the response via MRZ/Barcode scan
  • Fix the image resolution from the response via Manual Capture
  • Fix image path issues which make the image not properly loaded when used in plugins

Add deobfuscation file and debug symbols for Release build

Current Behaviour

No deobfuscation file and debug symbols and if added, ID PASS Lite crashes the app

Expected Behaviour

Add deobfuscation file and debug symbols and fix ID PASS Lite crash errors the app

Context

Errors encountered:

  • ID PASS Lite crash
    image
  • Google play warnings
    image

Compute Check digit for MRZ Result consistency

Current Behaviour

No check digit verification for MRZ

Expected Behaviour

Add Check digit verification

Context

It should not accept the wrong passport number. In my case the check digit is 2, and if my passport # was 18FVO3800, it would be 4.

Find the Iraq country signing certificate

Current Behaviour

Currently, the smartscanner app does not have the Iraq country signer certificate.

Expected Behaviour

We need to have the Iraq country signer certificate as a trust anchor of the epassport/ID certificate.

Steps to Reproduce the Problem

  1. Use smartscanner-core app to scan an Iraqi Unified ID.
  2. Notice that in the Authentication section, the CSCA is marked as x here

Context

The presence of the Iraq country signer certificate(s) in our csca.ks file shall serve as a trust anchor to verify the epassport/ID certificate content integrity.

  • Version:

Add CSCA file for country certificates

Current Behaviour

At present, there is no CSCA file as a trust anchor of the document signer certificate. This results to CSCA marked with x as shown here

Expected Behaviour

There should be a CSCA file trust anchor to verify contents against tampering. Furthermore, a plan should be in place to update this file in a controlled manner.

Steps to Reproduce the Problem

  1. Use smartscanner-core to scan your passport.
  2. Notice that the CSCA is marked "x" as shown here. This means that the passport's certificate and the integrity of all its contents could not be verified.

Context

  • Version:

NFC noalgorithm and Security errors

Current Behaviour

NFC related Security errors and noalgorithm exceptions when minifyEnabled is set to true for build.gradle

Expected Behaviour

Fix NFC related Security errors and noalgorithm exceptions

Investigate Raphael failed Chip Authentication

Current Behaviour

Use smartscanner to scan your passport/ID. If your passport/ID has Chip Auth feature, then Chip Authentication is performed and it should pass.

Background info: PH passports have no Chip Auth feature. Ken's passport have Chip Auth feature.

Expected Behaviour

In the Authentication section of smartscanner's result page, the Chip should have a checked marked if the passport/ID being scanned has Chip Auth feature. Otherwise, the Chip should not appear in cases where Chip Auth feature is not supported.

Steps to Reproduce the Problem

  1. Raphael scanned his passport using smartscanner app
  2. The page results here showed an x mark in Chip.

Context

The same smartscanner app is able to verify Ken's passport which has a Chip Auth feature as shown here

  • Version:

Add flag to read e-passport photo

Current Behaviour

The reading of the photo content inside DG2 is the most time consuming portion during a read. Around 10 seconds is consumed to read this photo. If this photo is not needed, then it should be skipped.

Expected Behaviour

Use cases that does not need the ID photo should have a significantly faster NFC read. A flag should be used to control this read.

Steps to Reproduce the Problem

  1. Scan an e-passport/unified ID
  2. NFC scanning use case not needing a photo should be significantly faster than use case which need the photo.

Context

NFC scanning duration is an important usability and security feature.

  • Version:

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.