Smartscanner
Last updated
Was this helpful?
Last updated
Was this helpful?
Smart Scanner is a mobile app extension built on top of the . It enhances traditional QR code scanning by supporting multiple versions of QR codes and parsing algorithms that vary across different countries.
CSV-Based QR Code Versioning: The app can use a CSV input file to define the different versions of QR codes used in a country.
Direct Value Assignment: QR code type information and configurations can be directly assigned in the ODK formβs data section.
Dynamic Parsing: Smart Scanner identifies the type of QR code from the CSV or data input and applies the appropriate parsing logic.
Form Integration: The scanning results are returned via an intent, providing all the data necessary to fill out a form.
Smart Scanner currently supports three QR code types:
CWT (CBOR Web Token):
The QR code data is encrypted, and the JSON payload is only accessible after verifying the digital signature using a public key.
Plain JSON:
The QR code contains a JSON payload, which is subject to signature verification after scanning. The verification ensures the dataβs integrity by using specific fields from the QR code.
Plain Text:
The QR code directly contains a plain text string, which can be used without additional parsing or verification.
CWT: The verification process must succeed before receiving the JSON payload.
Plain JSON: Verification is done after receiving the payload, ensuring the data hasn't been tampered with.
To use Smart Scanner, you need to pass an intent with a JSON array containing the following inputs:
qr_code_type:
Metadata defining the different QR code types and their versions.
Example:
public_keys (for CWT and JSON types):
Public keys for each version of the QR code to verify its signature.
Example:
field_mapper:
A mapping that defines how form fields correspond to fields in the scanned QR code.
Example:
signature_mapper (for JSON types):
Fields used for signature verification in the JSON QR code. Includes the order of fields and how they should be prettified.
Example:
If no input is passed to the scanner, it returns an error.
If only a public key is passed, the scanner defaults to CWT logic and attempts to decode all fields in the QR code.
Example for public key-only input:
When scanning fails, the following fields and codes are returned:
QRCODE_SCAN_status: true
(success) or false
(failure).
QRCODE_SCAN_status_message: The reason for the failure.
QRCODE_SCAN_status_code: Error code explaining the failure.
101
QR Code Types Not Specified Correctly
102
Public Key Not Specified Correctly
103
Signature Mapper Not Specified Correctly
104
Fields Not Specified Correctly in Scanner Input
105
QR Code Not Recognized
106
Failure But Reason Unknown
A CSV file can be supplied and referenced in the ODK form. It should follow this format:
Instead of using a CSV file, you can directly assign the values in the ODK form's data section:
The ODK form should have variable names consistent with the field mapper in the CSV or data input. The form should include variables for the scanning status and the error codes.
Example structure:
An intent call in the form would look like this: