Document Reader SDK Architecture
This page provides the in-depth exploration of the Document Reader SDK architecture. Whether you're working on a mobile, web, or desktop application, understanding the inner workings of our SDK will empower you to harness its capabilities to the fullest.
- Mobile SDK
- Web Components
- Web Service
- Complete Server-Side Verification
- Integration with Face SDK
- Online Processing
Mobile SDK
The API framework provides the external interface for controlling the process and getting the result. It depends on the Common framework that is an interface for working with the camera and other modules that are used in other Regula SDKs.
The internal Core framework provides recognition functionality where all the processing happens. Only the API framework uses the Core framework. Developers cannot access the Core framework directly, but must reference it in the project.
Resources contain the document data. They are mandatory to have if you use the Core type that supports document type recognition.
All processing is performed completely offline. No data leaves your mobile device. There is no need to have the Web Service running.
Regula provides solutions for both Native and Hybrid apps:
As NFC is required to perform RFID chip processing, it's available only on mobile devices using the Document Reader SDK for Mobile. Web Components don't support RFID chip processing.
Web Components
Web Components let you add document verification to your website. Web Components capture a document from the device camera or process an uploaded image, crop the image by the document boundaries, recognize the Machine Readable Zone (MRZ) and barcodes.
The Web Components package contains UI Web Components and the Document Reader SDK:
-
UI Web Components are intended to recognize identity documents with a built-in user interface.
-
The Document Reader SDK is intended to recognize identity documents and allows you to create your own user interface.
During document processing, these components interact with the Document Reader Service, which in turn communicates with WebAssembly (WASM).
WebAssembly (WASM) provides the recognition functionality where all the processing happens.
As Web Components don't support Document Type and Visual Zone recognition, once the processing is completed, you can send an image taken by Web Components to Web Service for further processing.
Web Service
The Web Service operates via an HTTP(S) protocol. It receives a request and invokes the Core library that processes this request. When the Core library returns the results, they are sent back by the Web Service.
The Document Reader Web Service is distributed as:
- Docker image
- Packages for Linux: Ubuntu, RHEL, and Debian
- Packages for Windows architectures
(x86)and(x64) - Cloud deployments, for example, on Amazon Web Services
To use the Web Service, you need to send an image and processing parameters via API. For details, see the OpenAPI specification.
To simplify the integration and further maintenance, we supply API clients for popular programming languages. There are four API clients:
- JavaScript client for the browser and Node.js based on Axios
- Java client compatible with Java Virtual Machine (JVM) and Android
- Python client version 3.5+
- C# client for .NET and .NET Core
You can configure Storage to collect data after processing is complete.
Depending on the Web Service configuration and usage, the Storage can keep the request and response, as well as additional data. For details, see How to connect Storage.
A database stores the transaction information, public and private keys. It is required to be configured in case of the Server-Side Verification.
Complete Server-Side Verification
Complete Server-Side Verification is an additional layer of protection against fraud. While it's true that all authenticity checks can be successfully completed on smartphones and edge devices, Regula Mobile SDK or Regula Web Components might not suffice. There's a potential risk of verification results being intercepted and modified by fraudsters directly on the same device.
In the "zero trust to mobile" approach, we introduce Complete Server-Side Verification. Document data, device metadata, transaction information are also saved in the Storage and Database after the processing is completed. During the RFID chip reading (optional for physical documents) or mDL reading (via NFC), Regula Web Service is engaged in generating session keys and challenges, which are subsequently saved to Storage and Database. During the reprocessing, Regula Web Service fetches data from the Storage and Database. Once reprocessing is completed, you can then determine whether to trust Regula Mobile SDK or Regula Web Components results.
For Complete Server-Side Verification setup instructions for different components, see the articles:
- Web Service
- Mobile SDK (for physical documents)
- Mobile SDK (for Mobile Driver's License)
- Web Components
Integration with Face SDK
Integration with Face SDK adds an automatic face match and search by a portrait taken from the document (Visual Zone and RFID chip) or a live owner photo. If the face match and search are configured in the settings, they start once the document processing is completed.
Online Processing
The Online Processing feature allows you to partially or fully delegate the document processing from the Mobile SDK to the Web Service. Explore How to set up Online Processing and see the available modes further.
Manual mode
To simplify the document processing on the mobile side and keep the mobile app size significantly smaller, you can perform all document processing on the Web Service while the Mobile SDK is just used for capturing document images. In this case, you don't need to add the Core framework or documents database, and don't need to license the mobile app. The automatic document boundary detection and cropping become unavailable on the mobile side.
Auto mode
To make automatic detecting the document boundaries and cropping available on the mobile side, add the Core framework and the documents database (if necessary).