blinkid-react-native
Advanced tools
Comparing version 1.4.2 to 2.0.0-0
@@ -32,2 +32,3 @@ 'use strict'; | ||
export const MYKADKeys = require('./keys/mykad_keys') | ||
export const PDF417Keys = require('./keys/pdf417_keys') | ||
export const PDF417Keys = require('./keys/pdf417_keys') | ||
export const NZDLFrontKeys = require('./keys/nzdl_front_keys') |
{ | ||
"name": "blinkid-react-native", | ||
"version": "1.4.2", | ||
"description": "A small and powerful ID card scanning library. Powered by MicroBlink (www.microblink.com).", | ||
"version": "2.0.0-0", | ||
"description": "A small and powerful ID card scanning library. Powered by Microblink (www.microblink.com).", | ||
"main": "index.js", | ||
@@ -11,2 +11,19 @@ "repository": { | ||
"keywords": [ | ||
"scan", | ||
"id", | ||
"scanner", | ||
"identity", | ||
"ID", | ||
"passport", | ||
"licence", | ||
"sdk", | ||
"ocr", | ||
"USDL", | ||
"PDF417", | ||
"MRZ", | ||
"MRTD", | ||
"barcode", | ||
"DL", | ||
"card", | ||
"document", | ||
"microblink", | ||
@@ -16,8 +33,6 @@ "react-native", | ||
"ID", | ||
"scanner", | ||
"OCR", | ||
"ios", | ||
"android" | ||
], | ||
"author": "MicroBlink", | ||
"author": "Microblink", | ||
"license": "MIT", | ||
@@ -24,0 +39,0 @@ "homepage": "https://github.com/BlinkID/blinkid-react-native", |
110
README.md
@@ -14,3 +14,3 @@ # BlinkID SDK wrapper for React Native | ||
BlinkID React Native was built and tested with [React Native v0.48.3](https://github.com/facebook/react-native/releases/tag/v0.48.3) | ||
BlinkID React Native was built and tested with [React Native v0.55.0](https://github.com/facebook/react-native/releases/tag/v0.55.0) | ||
@@ -95,3 +95,3 @@ ## Installation | ||
target 'TargetName' do | ||
pod 'PPBlinkID', '~> 2.15.0' | ||
pod 'PPBlinkID', '~> 2.17.3' | ||
end | ||
@@ -120,3 +120,3 @@ ``` | ||
* Use these recognizer types | ||
* Available: RECOGNIZER_USDL, RECOGNIZER_MRTD, RECOGNIZER_EUDL, RECOGNIZER_DOCUMENT_FACE | ||
* Available: | ||
* RECOGNIZER_USDL - scans barcodes located on the back of US driver license | ||
@@ -126,3 +126,5 @@ * RECOGNIZER_MRTD - scans Machine Readable Travel Document, contained in various IDs and passports | ||
* RECOGNIZER_MYKAD - scans the front of Malaysian ID | ||
* RECOGNIZER_NZDL_FRONT - scans the front side of New Zealand DL | ||
* RECOGNIZER_DOCUMENT_FACE - scans documents with face image and returns document images | ||
* RECOGNIZER_PDF417 - scans PDF417 type of barcode | ||
*/ | ||
@@ -135,3 +137,4 @@ | ||
* useFrontCamera : if it is set to false, back camera is used, else front | ||
* shouldReturnCroppedImage : if true, cropped images in the recognition process will be returned | ||
* shouldReturnDocumentImage : if true, cropped document images in the recognition process will be returned | ||
* shouldReturnFaceImage : if true, cropped face images in the recognition process will be returned | ||
* shouldReturnSuccessfulImage : if true, image on which scan gave valid scanning result will be returned | ||
@@ -143,5 +146,6 @@ * recognizers : array which contains recognizers that will be activated | ||
* Scan method returns scan fields in JSON format and image(s) (image is returned as Base64 encoded JPEG) | ||
* scanningResult.resultImageCropped : cropped document image | ||
* scanningResult.resultImageSuccessful : full image on which scan gave valid scanning result | ||
* scanningResult.resultList : array of scanning results in JSON format (each activated recognizer can produce its own result) | ||
* scanningResult.resultList[i].resultImageDocument : cropped document image | ||
* scanningResult.resultList[i].resultImageFace : cropped face image | ||
*/ | ||
@@ -151,3 +155,3 @@ | ||
import React, { Component } from 'react'; | ||
import {BlinkID, MRTDKeys, USDLKeys, EUDLKeys, MYKADKeys} from 'blinkid-react-native'; | ||
import {BlinkID, MRTDKeys, USDLKeys, EUDLKeys, MYKADKeys, PDF417Keys, NZDLFrontKeys} from 'blinkid-react-native'; | ||
import { | ||
@@ -166,5 +170,5 @@ AppRegistry, | ||
// iOS license key for applicationID: org.reactjs.native.example.BlinkIDReactNative | ||
ios: 'E2ONP7QK-SGLUN3RH-YIEFNMOT-Q23AMHC6-U7EIRDKV-ZZJO73HG-3ZOUG574-VLZMR3HC', | ||
ios: 'JGB6SUY2-MH7ZOUKB-L7UA7GP5-L3TYCFZQ-I3XGO774-UL225CKU-EOYRYXVH-ZCEPUZN4', | ||
// android license key for applicationID: com.blinkidreactnative | ||
android: 'GXGKDUE2-3Y752W4Y-VTOX3N5M-2QZO73JY-L3DTQXWH-HBPMOOC6-Y44F5RZY-L3DU6TK3' | ||
android: 'JMXSJB6V-B3JBFNNF-DJWHC444-YZDHLI2P-P6XYVQNJ-TCWNIMXP-5U4F5RZY-L3DU6TK3' | ||
}) | ||
@@ -182,4 +186,6 @@ | ||
super(props); | ||
this.state = {showImage: false, | ||
resultImage: '', | ||
this.state = {showImageDocument: false, | ||
resultImageDocument: '', | ||
showImageFace: false, | ||
resultImageFace: '', | ||
results: '', | ||
@@ -195,4 +201,6 @@ licenseKeyErrorMessage: ''}; | ||
useFrontCamera: false, | ||
shouldReturnCroppedImage: true, | ||
shouldReturnDocumentImage: true, | ||
shouldReturnSuccessfulImage: false, | ||
// Returns face image when BlinkID.RECOGNIZER_DOCUMENT_FACE is used | ||
shouldReturnFaceImage: true, | ||
recognizers: [ | ||
@@ -208,3 +216,7 @@ // scans documents with face image and returns document images | ||
// scans MyKad (Malaysian ID) | ||
BlinkID.RECOGNIZER_MYKAD | ||
BlinkID.RECOGNIZER_MYKAD, | ||
// scans the front side of New Zealand DL | ||
BlinkID.RECOGNIZER_NZDL_FRONT, | ||
// scans PDF417 type of barcode | ||
BlinkID.RECOGNIZER_PDF417 | ||
] | ||
@@ -216,2 +228,6 @@ }) | ||
let fieldDelim = ";\n"; | ||
let shouldShowResultImageDocument = false; | ||
let shouldShowResultImageFace = false; | ||
let imageDocument = ""; | ||
let imageFace = ""; | ||
for (let i = 0; i < resultList.length; i++) { | ||
@@ -293,2 +309,24 @@ // Get individual resilt | ||
} else if (recognizerResult.resultType == "NZDLFront result") { | ||
var fields = recognizerResult.fields | ||
// NZDLFrontKeys are keys from keys/nzdl_front_keys.js | ||
resultsFormattedText += /** Personal information */ | ||
"First names: " + fields[NZDLFrontKeys.FirstNames] + fieldDelim + | ||
"Surname: " + fields[NZDLFrontKeys.Surname] + fieldDelim + | ||
"Date of birth: " + fields[NZDLFrontKeys.DateOfBirth] + fieldDelim + | ||
"Address: " + fields[NZDLFrontKeys.Address] + fieldDelim + | ||
"Date of expiry: " + fields[NZDLFrontKeys.ExpiryDate] + fieldDelim + | ||
"Date of issue: " + fields[NZDLFrontKeys.IssueDate] + fieldDelim + | ||
"License number: " + fields[NZDLFrontKeys.LicenseNumber] + fieldDelim + | ||
"Card version: " + fields[NZDLFrontKeys.CardVersion] + fieldDelim + | ||
"Donor indicator: " + fields[NZDLFrontKeys.DonorIndicator] + fieldDelim; | ||
} else if (recognizerResult.resultType == "PDF417 result") { | ||
var fields = recognizerResult.fields | ||
// PDF417Keys are keys from keys/pdf417_keys.js | ||
resultsFormattedText += "Barcode data: " + fields[PDF417Keys.BarcodeData] + fieldDelim; | ||
} else if (recognizerResult.resultType == "DocumentFace result") { | ||
@@ -298,9 +336,20 @@ // document face recognizer returns only images | ||
resultsFormattedText += '\n'; | ||
if (recognizerResult.resultImageDocument) { | ||
shouldShowResultImageDocument = true; | ||
imageDocument = 'data:image/jpg;base64,' + recognizerResult.resultImageDocument.base64; | ||
} | ||
if (recognizerResult.resultImageFace) { | ||
shouldShowResultImageFace = true; | ||
imageFace = 'data:image/jpg;base64,' + recognizerResult.resultImageFace.base64; | ||
} | ||
} | ||
// image is returned as base64 encoded JPEG, we expect resultImageCorpped because we have activated obtaining of cropped images (shouldReturnCroppedImage: true) | ||
// image is returned as base64 encoded JPEG, we expect resultImageDocument and resultImageFace because we have activated obtaining of document and face images (shouldReturnDocumentImage: true, shouldReturnFaceImage: true) | ||
// to obtain image from successful scan, activate option (shouldReturnSuccessfulImage: true) and get is with scanningResult.resultImageSuccessful | ||
this.setState({ showImage: scanningResult.resultImageCropped, resultImage: 'data:image/jpg;base64,' + scanningResult.resultImageCropped, results: resultsFormattedText}); | ||
this.setState({showImageDocument: shouldShowResultImageDocument, resultImageDocument: imageDocument, | ||
showImageFace: shouldShowResultImageFace, resultImageFace: imageFace, results: resultsFormattedText}); | ||
} | ||
} catch(error) { | ||
this.setState({ showImage: false, resultImage: '', results: error.message}); | ||
this.setState({ showImageDocument: false, resultImageDocument: '', showImageFace: false, resultImageFace: '', results: error.message}); | ||
} | ||
@@ -311,3 +360,4 @@ | ||
render() { | ||
let displayImage = this.state.resultImage; | ||
let displayImageDocument = this.state.resultImageDocument; | ||
let displayImageFace = this.state.resultImageFace; | ||
let displayFields = this.state.results; | ||
@@ -328,9 +378,16 @@ let licenseKeyErrorMessage = this.state.licenseKeyErrorMessage; | ||
scrollEventThrottle={200}y> | ||
{renderIf(this.state.showImage, | ||
{renderIf(this.state.showImageDocument, | ||
<View style={styles.imageContainer}> | ||
<Image | ||
resizeMode='contain' | ||
source={{uri: displayImage, scale: 3}} style={styles.imageResult}/> | ||
source={{uri: displayImageDocument, scale: 3}} style={styles.imageResult}/> | ||
</View> | ||
)} | ||
{renderIf(this.state.showImageFace, | ||
<View style={styles.imageContainer}> | ||
<Image | ||
resizeMode='contain' | ||
source={{uri: displayImageFace, scale: 3}} style={styles.imageResult}/> | ||
</View> | ||
)} | ||
<Text style={styles.results}>{displayFields}</Text> | ||
@@ -382,12 +439,15 @@ </ScrollView> | ||
+ Available recognizers are: | ||
+ **RECOGNIZER_USDL** - scans barcodes located on the back of US driver's license | ||
+ **RECOGNIZER_MRTD** - scans Machine Readable Travel Document, contained in various IDs and passports | ||
+ **RECOGNIZER_EUDL** - scans the front of European driver's license | ||
+ **RECOGNIZER\_USDL** - scans barcodes located on the back of US driver's license | ||
+ **RECOGNIZER\_MRTD** - scans Machine Readable Travel Document, contained in various IDs and passports | ||
+ **RECOGNIZER\_EUDL** - scans the front of European driver's license | ||
+ **RECOGNIZER\_MYKAD** - scans the front of Malaysian ID | ||
+ **RECOGNIZER\_NZDL\_FRONT** - scans the front side of New Zealand DL | ||
+ **RECOGNIZER\_DOCUMENT\_FACE** - scans documents with face image and returns document images | ||
+ **RECOGNIZER\_PDF417** - scans PDF417 type of barcode | ||
+ Scan method returns scan fields in JSON format and images (image is returned as Base64 encoded JPEG) | ||
+ **scanningResult.resultList** : array of scanning results in JSON format (each activated recognizer can produce its own result) | ||
+ **scanningResult.resultImageCropped** : cropped document image | ||
+ **scanningResult.resultImageSuccessful** : full image on which scan gave valid scanning result | ||
+ Scan method returns scan fields in JSON format and image(s) (image is returned as Base64 encoded JPEG) | ||
+ **scanningResult.resultImageSuccessful** : full image on which scan gave valid scanning result | ||
+ **scanningResult.resultList** : array of scanning results in JSON format (each activated recognizer can produce its own result) | ||
+ **scanningResult.resultList[i].resultImageDocument** : cropped document image | ||
+ **scanningResult.resultList[i].resultImageFace** : cropped face image | ||
@@ -394,0 +454,0 @@ + LicenseKey parameter must be provided. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191837
918
444
22
1