@idscan/divesdk-plugin
v0.0.1
Published
DIVE SDK from IDScan.net plugin for Ionic Capacitor
Downloads
14
Readme
divesdk-plugin
DIVE SDK from IDScan.net plugin for Ionic Capacitor
Overview
Upon being switched on, the library integrates the component of capturing the documents and faces from a video to your Ionic Capacitor App.
Use cases
- Capture and determination of the document type
- Capture of pdf417
- Capture of MRZ
- Capture of faces
Recommendations
Use a modern phone with a good camera having the definition of not less than 8 megapixels. The capture must be made in a well-lighted room. A document must be located at the uniform background.
Limitations
Only iOS platform Minimum deployment target of iOS 13.0
Demo
Working the plugin you can find on demo Ionic App
Installation
npm install @idscan/divesdk-plugin
npx cap sync
Import
import divesdk from '@idscan/divesdk-plugin'
Configuration
Note: Request an license key for the library by emailing [email protected] or [email protected]
Methods
configure(...)
configure(options: { configuration: string; }) => Promise<void>
| Param | Type |
| ------------- | --------------------------------------- |
| options
| { configuration: base64encoded configuration object; } |
This JSON configuration file describes the steps for scanning various types of documents using the DIVE SDK. The configuration includes settings for resizing uploaded images, automatic continuation, and real face mode. Here is the breakdown of the configuration:
Scructure:
{
"resizeUploadedImage":-1,
"autoContinue":true,
"realFaceMode":"auto",
"documentTypes":[
{
"isActive":true,
"type":"ID",
"steps":[
{
"type":"front",
"name":"Document Front",
"mode":{
"uploader":true,
"video":true
}
},
{
"type":"pdf",
"name":"Document PDF417 Barcode",
"mode":{
"uploader":true,
"video":true
}
},
{
"type":"face",
"name":"Face",
"mode":{
"uploader":true,
"video":true
}
}
]
}]
}
Global Settings:
"resizeUploadedImage"
: The value-1
indicates that the uploaded images will not be resized."autoContinue":true
: The valuetrue
enables automatic continuation of the scanning process."realFaceMode":"auto"
: The"auto"
value allows the SDK to determine the most suitable mode for capturing real face images.
Document Types:
The configuration defines multiple document types, each with its own scanning steps:
ID:
"isActive": bool
: Enables scanning for this document type."type"
: Indicates that this document type is an ID. "ID", "front", "pdf", "face""steps"
: Contains an array of steps required to scan an ID."name"
: Describes the step name."mode"
: Specifies the scanning mode for this step."uploader": bool
: Allows image uploading for this step."video": bool
: Allows video capturing for this step.
Passport:
- Similar structure as the ID document type but with different step names, indicating the scanning of passport documents.
PassportCard:
- Similar structure as the ID document type but with different step names, indicating the scanning of passport cards.
GreenCard:
- Similar structure as the ID document type but with different step names, indicating the scanning of GreenCards.
InternationalId:
- Similar structure as the ID document type but with different step names, indicating the scanning of international ID documents.
Note: All document types have "isActive":true
set, indicating that they are all enabled for scanning.
start()
Run scan process
start() => Promise<{ value: any; }>
Returns: Promise<{ value: any; }>
Example:
import { divesdk } from '@idscan/divesdk-plugin'
divesdk.configure({
configuration: JSON.stringify(DIVEconfiguration)
}).then(()=>{
divesdk.start().then((result) => {
// result of scanning
}).catch((error)=>{
// error in scannign process
});
}).catch((error)=>{
// error in configuration
});
Result of scanning
{
"documentType": 1,
"frontImageBase64": "string",
"backOrSecondImageBase64": "string",
"faceImageBase64": "string",
"trackString": {
"data": "string",
"barcodeParams": "string"
}
}
documentType
(string or int) Type of document.
- ID – 1
- Passport - 2
- PassportCard – 3
- Common Access Card (Old Format) – 4
- Common Access Card (New Format) – 5
- GreenCard – 6
- InternationalId – 7
frontImageBase64
(string) Front of the document which contains the data for OCR and a photo.
backOrSecondImageBase64
(string) Image of the reverse side or back of the document which contains the Barcode (PDF417) or MRZ.
faceImageBase64
(string) Image of the face of the document owner if it is necessary to compare it with the photo of the face on the document.
trackString.data
(string)(optional) PDF417 barcode data (or MRZ data) encoded as a base64 string
trackString.barcodeParams
(string)(optional)
You can send this data in DIVE SDK API for parse and check scanned images.
startDIVEOnline()
startDIVEOnline() => Promise<{ value: any; }>
Returns: Promise<{ value: any; }>
configureDIVEOnline(...)
configureDIVEOnline(options: { applicantID: string; publicToken: string; integrationID: string; sendLocation: boolean; baseURL?: string; }) => Promise<void>
Example:
import { divesdk } from '@idscan/divesdk-plugin';
// applicantID you can create in DIVE control panel https://diveonline.idscan.net/validationRequest
// or by API https://docs.idscan.net/dive/dive-online/swagger.html
// POST request /api/v2/private/Applicants use secret key
const applicantID = '395c03fc-7239-48fe-b437-d7204812fa19';
divesdk.configureDIVEOnline({
applicantID: applicantID,
publicToken: DIVEOnlinePublicToken,
integrationID: DIVEOnlineIntegrationID,
sendLocation: false
}).then(() => {
// Configuration Loaded
divesdk.startDIVEOnline().then((result) => {
// result of scanning applicant
}).catch((error) => {
// error scanning process
});
}).catch((error) => {
// error fetching configuration
})
iOS
iOS requires the following usage description be added and filled out for your app in Info.plist
:
NSCameraUsageDescription
(Privacy - Camera Usage Description
)NSPhotoLibraryAddUsageDescription
(Privacy - Photo Library Additions Usage Description
)NSPhotoLibraryUsageDescription
(Privacy - Photo Library Usage Description
)
Read about Configuring Info.plist
in the iOS Guide for more information on setting iOS permissions in Xcode
If you plan to send coordinates information, add the following permissions to the application
NSLocationAlwaysUsageDescription
(Privacy - Location Always Usage Description
)NSLocationWhenInUseUsageDescription
(Privacy - Location When In Use Usage Description
)