Flutter Component SDK
Take direct control of individual identity components in your Flutter app. Capture identification documents and faces, run context-aware signing, and submit the collected data to Assentify DXP.
Install · Initialize · CaptureComponent SDK overview
The Assentify SDK has several capabilities and functionalities that empower developers to take complete control of the identity extraction process.
The Assentify SDK complements the Assentify DXP platform (SaaS). The developer leverages the available data by using the response information from the supported components, or data provided by the app user. The SDK allows the developer to submit all extracted data to Assentify to gain access to further features such as Compliance, AML, client profile, and other capabilities that the DXP covers.
The key components supported and available in the SDK are:
- BlockLoader : the core context component for a submission.
- Identification Document Capture : extract information from an ID card, passport, or other document.
- Face Capture / Matching : match a live source face against a target image.
- Context-aware signing : create token pre-filled documents and add a signature.
- Submission : send the collected data to Assentify DXP.
Definitions
| Term | Description |
|---|---|
| StepID | The StepID represents the ID of the Step in the Engagement block that you configure in the Flow Builder on the portal (for example the StepID of Face Capture or ID Capture). You will need it to submit your data to the portal. |
Requirements
The Assentify Component SDK is available for Android native, iOS native, Flutter, and React Native. Before you initialize the SDK you will require the following variables, all of which can be retrieved from the Assentify DXP portal:
| Variable | Where to find it |
|---|---|
| API Key | Developers section. Create a new API Key or reuse an existing one, then assign Claims to limit access. |
| Tenant Identifier | Developers › Flow Configuration. Select your flow and the Engagement block to view the Tenant Identifier. |
| Interaction Hash | Flow Manager. Open your flow; the Digital Engagement Link uses the format https://platform.assentify.com?interaction={HASH}. Copy the HASH part. |
Installation
Add the Assentify Component SDK to your Flutter project. Then run flutter pub get to fetch the package.
Platform setup
The capture components use the device camera, and NFC document reading uses the device NFC reader. Ensure your Android and iOS projects declare the permissions required for camera access, and, where you use startNfc, NFC capabilities. Configure these per the standard Flutter platform channels for your Android and iOS targets.
Initialization
To leverage the capabilities of the Assentify Component SDK, the developer must initialize the SDK on each application start-up. Initialization ensures the developer has the key information required to begin using the Component SDK.
1. environmentalConditions configuration
| Property | Description |
|---|---|
enableDetect: true | Detection feature is enabled. |
enableGuide: true | Guide feature is enabled, to assist users during scanning. |
processingColor: "#" | Custom color setting with a hex code. |
HoldHandColor: "#" | Color setting for the hand-holding guide or indicator with a hex code. |
2. assentifySdk configuration
The assentifySdk object is an instance of AssentifySdk and is initialized with several parameters.
| Parameter | Description |
|---|---|
apiKey: "" | Placeholder for the API key. |
tenantIdentifier: "" | Placeholder for a tenant identifier. |
interaction: "" | Placeholder for interaction type or ID. |
processMrz: true | Enables Machine-Readable Zone (MRZ) processing, for passports or other identity documents. |
storeCapturedDocument: true | Enables storing the captured document. |
performLivenessDocument: true | Enables liveness document detection, ensuring the document is physically present. |
performLivenessFace: true | Enables liveness user detection, ensuring the user is physically present. |
storeImageStream: true | Enables storage of image streams. |
saveCapturedVideoID: true | Enables saving of the captured video associated with ID validation. |
saveCapturedVideoFace: true | Enables saving of the video that captures the face. |
Retrieving your values from the DXP portal
- Visit the Assentify DXP and click the Developers section, then click Flow Configuration.
- Select the flow you want to use with your application, then from the drop-down menu select the Engagement block you would like to target.
- With the block selected, review the flow information and retrieve the Tenant Identifier from this section.
- To retrieve the API Key, create a new API Key or leverage an existing one. Assign Claims to an API Key to limit the amount of access it has.
- To fetch the Interaction Hash, click Flow Manager and select your flow. When the Digital Engagement Link loads on the right side panel in the format
https://platform.assentify.com?interaction={HASH}, copy the HASH part.
Initialization events
| Callback | Description |
|---|---|
onAssentifySdkInitSuccess | Initialization callback when the SDK has successfully been initialized. |
onAssentifySdkInitError | Callback executed upon failure to initialize the SDK. |
getTemplates function. This returns a List<TemplatesByCountry>. Store the result to be used later in the process when processing an ID card.BlockLoader
The Assentify BlockLoader is a core component provided to the developer to perform several functions and capabilities. The BlockLoader provides the developer with core properties that give context to the Assentify DXP platform:
DeviceNameFlowNameTimeStartedApplicationUserAgentInstanceHash
These properties are built into the BlockLoader. The developer can also access the DXP and add additional properties if needed, for example phoneNumber and clientIdentifier. These custom properties can transfer custom information to Assentify DXP, which can later be mapped to WebHooks or other platform capabilities. The developer has no limit on the number of properties that can be added to the BlockLoader.
How to add a property to the BlockLoader
- Go to the Flow Manager and select the flow you want to edit.
- Click the view more button on the Engagement Block.
- In the input field, type the name of the property, then press the add button.
- Completed.
How to use the BlockLoader properties as a developer
Once the developer adds these properties using the DXP, the developer defines those properties inside their application and uses them to set the BlockLoader Step for Submission. All custom properties added can be used to perform additional capabilities on the Assentify DXP, such as running decisions and mapping webhooks. To make use of the custom properties added on the Assentify DXP, declare these properties inside your app. Assentify uses the OnBoardMe_Property_{propertyName} naming nomenclature for all custom properties.
Identification Document Capture
The Identification Document Capture is a standalone, event-driven component that provides a means by which the developer can extract information from an ID card. The ID type is determined by the configuration set in Assentify DXP. The developer or business user can log in to Assentify and manage these configurations at any time, even after the application has gone live. This provides the flexibility to support as many ID cards as possible without recompiling and deploying the application.
This component returns many different types of information depending on the ID type being scanned, such as a Civil ID versus a Driving License, using dynamic keys and mappings built into the SDK. A global model is available for developers to extract information from the base model and the available property dictionary. The developer has complete freedom to perform additional operations on the data as necessary for specific business scenarios.
The component has a built-in user interface that can be used by default, or the developer can use their own custom user interface by turning off the guides and default interface. The component can fully leverage the native tools while giving complete control of what is displayed on the user interface using the events fired as part of the scanning process.
Methods
| Method | Description |
|---|---|
getTemplates | Receives all the configured, supported Identification Document Templates in the system (such as Passport, Lebanese Civil ID, Lebanese Driving License, French Resident Permit, etc.). You need the template when starting the ID scanning feature to inform the ID scanning which template you are using, and to create a list for the user to select which ID to provide. |
startScanID | The startScanIDCard method begins the ID scanning process. |
startScanPassport | Begins the passport scanning process. |
startScanOther | Begins the scanning process for other documents. |
startContextAwareSigning | Begins the context-aware signing process. |
startNfc | Begins the NFC process. |
startScanIDCard parameters
| Parameter | Description |
|---|---|
flippingCard | Show card animation after scanning each page. |
onEvent | Specify the function that will be called during the scanning process. |
templates | A list of KycDocumentDetails that can be retrieved from the stored response from getTemplates. |
Language (optional) | Optionally set the language that the OCR will process the extracted content from the ID card. |
startScanPassport parameters
| Parameter | Description |
|---|---|
onEvent | Specify the function that will be called during the scanning process. |
Language (optional) | Optionally set the language that the OCR will process the extracted content from the ID card. |
startScanOther parameters
| Parameter | Description |
|---|---|
onEvent | Specify the function that will be called during the scanning process. |
Language (optional) | Optionally set the language that the OCR will process the extracted content from the ID card. |
startContextAwareSigning parameters
| Parameter | Description |
|---|---|
onHasTokens | A specific function called to retrieve the list of document tokens. |
onError | A specific function invoked if an error occurs while starting the context-aware signing process. |
startNfc parameters
| Parameter group | Description |
|---|---|
| NFC page design | image, backGroundColor, textColor, title / subtitle, backIconColor, backIconBackGroundColor, progressBarColor. |
| Language (optional) | Optionally set the OCR language. |
onEvent | Specify the function that will be called during the scanning process. |
How to initialize the ID card scanning
- Initialize the Assentify SDK object.
- Call
AssentifySdk.startScanIDCard(). - Configure the
startScanIDCardparameters. - The
startScanIDCardaccepts aList<KycDocumentDetails>parameter that includes all the available templates that are retrieved.
How to initialize the passport scanning
- Initialize the Assentify SDK object.
- Call
AssentifySdk.startScanPassport(). - Configure the
startScanPassportparameters. - Completed.
How to initialize the NFC scanning
- Initialize the Assentify SDK object.
- Scan the passport using
startScanPassport(). - Call
AssentifySdk.startNfc(). - Configure the
startNfcparameters.
How to initialize other ID scanning
- Initialize the Assentify SDK object.
- Call
AssentifySdk.startScanOther(). - Configure the
startScanOtherparameters. - Completed.
ScanIDCard you receive each page in order via the onComplete callback. The camera automatically starts scanning the next page after each callback.Face Capture / Matching
The Face Capture and Matching step is a standalone, event-driven component that allows the developer to perform face matching between a live source and a target image. The developer offers the target image, while the selfie camera captures the source image. All features and capabilities of the Face Capture / Matching component are driven by the configuration the developer or business user configures on Assentify DXP. The developer may choose to override this configuration.
How to use the Face Acquisition component
- Initialize the Assentify SDK object.
- Call
AssentifySdk.startFaceMatch(). - Configure the
startFaceMatchparameters. - Supply the target base-64 encoded face image.
- Show a count down 3, 2, 1 before starting the scan.
imageUrl from the onComplete callback for document scanning, convert it to base64, and use it in the face match. When a document has multiple sides, choose an order (page) that contains a face. When the document URL is retrieved from the document scan, Assentify flags that it has a face extracted based on the template.Context-aware signing
The context-aware step allows developers to programmatically create files that are pre-filled with tokens. These tokens are retrieved from the Assentify DXP. After the file is created and populated with the necessary data, the method enables the addition of a user signature. This process ensures the generation and management of context-aware files.
How to use the context-aware method
- Initialize the Assentify SDK object.
- Call
AssentifySdk.startContextAwareSigning()to initialize thecontextAwareSigningobject. - Retrieve the document tokens from the previous step and create a map object using these document tokens as the keys. Fill the map with the desired values. Then call the
createUserDocumentmethod fromAssentifySdk().contextAwareSigningand pass the map object you created. - Retrieve the
createUserDocumentResponseModelreturned from theonCreateUserDocumentInstancecallback and convert thetemplateInstanceobject fromcreateUserDocumentResponseModelfrom base64 to a PDF file. - Add a signature image as a base64 string and call the
signaturemethod fromAssentifySdk().contextAwareSigningwithcreateUserDocumentResponseModelas adocumentIdandcreateUserDocumentResponseModel.templateInstanceIdas adocumentInstanceId.
Submission
Submission is a built-in function of the SDK that allows the developer to initiate the data transmission from the integrating app to Assentify DXP. Submission can be used to add additional properties to the BlockLoader and perform data aggregation and manipulation before sending it to Assentify. For example, the developer may want to send additional eKYC information, user-specific data, or data to bridge between the Assentify DXP and the back-end services of the integrating application. The developer may also perform additional functions such as custom date formatting, translation, transliteration, and calculations.
These tools let the developer customize any flow that requires ID Capture and face-matching operations, while also empowering the business to send additional data for further processing by leveraging the full capabilities of the Assentify DXP.
How to submit data to Assentify DXP
One of the key features of the Assentify Component SDK is being able to submit all the collected data to Assentify DXP so business users can review it. The simplest way to submit is to leverage the existing code provided in the demo application (Android, iOS).
Define variables for the BlockLoader. The data is submitted with the language you chose during the scan. You can add custom keys, such as a phone number. Prepare your list of steps with the outputProperties obtained for each step, for example:
sharedStepDefinitionsStepFace = SubmitRequestModel(item.stepId, StepsName.FaceMatch, values);
sharedStepDefinitionsStepDoc = SubmitRequestModel(item.stepId, StepsName.DocumentCapture, values);
Data models
TemplatesByCountry
| Field | Type | Description |
|---|---|---|
| name | String | The name of the country. |
| sourceCountryCode | String | The ISO-2 country code. |
| flag | String | The country flag image. |
| templates | List<Templates> | The list of templates by country. |
KycDocumentDetails
| Field | Type | Description |
|---|---|---|
| name | String | The name of the document. |
| order | Int | The order of the page (front, back, etc.). |
| templateSpecimen | String | The default specimen representing the ID type being used (Civil ID, Driving License, etc.). |
| templateProcessingKeyInformation | String | The template Id. |
Templates
| Field | Type | Description |
|---|---|---|
| id | Int | The template Id. |
| sourceCountryFlag | String | The flag of the country as a URL. |
| sourceCountryCode | String | The ISO-2 country code. |
| kycDocumentType | String | The name of the Template. |
| sourceCountry | String | The country name. |
| kycDocumentDetails | List<KycDocumentDetails> | A list of KycDocumentDetails. |
ConfigModel
| Field | Type | Description |
|---|---|---|
| stepId | Int | Identifier for the step. |
| flowName | String | Name of the flow. |
| blockName | String | Name of the block. |
| instanceHash | String | Hash value of the instance. |
| stepDefinition | Any? | Step definition, can be any type. |
| flowInstanceId | String | Identifier for the flow instance. |
| tenantIdentifier | String | Identifier for the tenant. |
| blockIdentifier | String | Identifier for the block. |
| flowIdentifier | String | Identifier for the flow. |
| customProperties | Map<String, Any> | Custom properties map with string keys and any values. |
| defaultLanguageId | Int | Identifier for the default language. |
| instanceId | String | Identifier for the instance. |
| userStateStepMap | Map<String, List<UserState>> | Mapping of user states. |
| stepDefinitions | List<StepDefinitions> | List of step definitions. |
StepDefinitions
| Field | Type | Description |
|---|---|---|
| stepId | Int | Identifier for the step. |
| stepDefinition | String | Definition of the step. |
| customization | Customization | Customization options. |
| outputProperties | List<OutputProperties> | List of output properties. |
OutputProperties
| Field | Type | Description |
|---|---|---|
| id | Int | Identifier for the output property. |
| key | String | Key for the output property. |
| displayName | String | Display name for the output property. |
| isRequired | Boolean | Whether the property is required. |
| isExcluded | Boolean | Whether the property is excluded. |
| type | Int | Type identifier for the property. |
Customization
| Field | Type | Description |
|---|---|---|
| ProcessMrz | Boolean? | Whether to process MRZ (Machine Readable Zone). |
| StoreCapturedDocument | Boolean? | Whether to store captured documents. |
| PerformLivenessDetection | Boolean? | Whether to perform liveness detection. |
| StoreImageStream | Boolean? | Whether to store image streams. |
| SaveCapturedVideo | Boolean? | Whether to save captured video. |
| identificationDocuments | List<IdentificationDocuments>? | List of identification documents. |
PassportExtractedModel
| Field | Type | Description |
|---|---|---|
| outputProperties | Map<String, Any>? | Output properties map. |
| transformedProperties | Map<String, String>? | Transformed properties map. |
| extractedData | Map<String, Any>? | Extracted data map. |
| imageUrl | String? | URL for the image. |
| faces | List<String>? | List of detected faces. |
| identificationDocumentCapture | IdentificationDocumentCapture? | Identification document capture details. |
OtherExtractedModel
| Field | Type | Description |
|---|---|---|
| outputProperties | Map<String, Any>? | Output properties map. |
| transformedProperties | Map<String, String>? | Transformed properties map. |
| extractedData | Map<String, Any>? | Extracted data map. |
| additionalDetails | Map<String, Any>? | Additional details map. |
| transformedDetails | Map<String, String>? | Transformed details map. |
| imageUrl | String? | URL for the image. |
| faces | List<String>? | List of detected faces. |
| identificationDocumentCapture | IdentificationDocumentCapture? | Identification document capture details. |
IDExtractedModel
| Field | Type | Description |
|---|---|---|
| outputProperties | Map<String, Any>? | Output properties map. |
| transformedProperties | Map<String, String>? | Transformed properties map. |
| extractedData | Map<String, Any>? | Extracted data map. |
| imageUrl | String? | URL for the image. |
| faces | List<String>? | List of detected faces. |
| identificationDocumentCapture | IdentificationDocumentCapture? | Identification document capture details. |
FaceExtractedModel
| Field | Type | Description |
|---|---|---|
| outputProperties | Map<String, Any>? | Output properties map. |
| extractedData | Map<String, Any>? | Extracted data map. |
| baseImageFace | String? | Base image face. |
| secondImageFace | String? | Second image face. |
| percentageMatch | Int? | Percentage match between faces. |
| isLive | Boolean? | Whether the face is live. |
| identificationDocumentCapture | IdentificationDocumentCapture? | Identification document capture details. |
IdentificationDocumentCapture
| Field | Type | Description |
|---|---|---|
| name | Dynamic? | Name of the document holder. |
| surname | Dynamic? | Surname of the document holder. |
| documentType | Dynamic? | Type of the document. |
| birthDate | Dynamic? | Birthdate of the document holder. |
| documentNumber | Dynamic? | Document number. |
| sex | Dynamic? | Sex of the document holder. |
| expiryDate | Dynamic? | Expiry date of the document. |
| country | Dynamic? | Country of the document. |
| nationality | Dynamic? | Nationality of the document holder. |
| idType | Dynamic? | ID type of the document. |
| faceCapture | Dynamic? | Face capture details. |
| image | Dynamic? | Image of the document. |
| isSkippedAfterMRZFails | Dynamic? | Whether MRZ failed after skipping. |
| isFailedFront | Dynamic? | Whether the front check failed. |
| isFailedBack | Dynamic? | Whether the back check failed. |
| skippedStatus | Dynamic? | Skipped status. |
| capturedVideoFront | Dynamic? | Captured video of the front. |
| capturedVideoBack | Dynamic? | Captured video of the back. |
| livenessStatus | Dynamic? | Liveness status of the document holder. |
| isFrontAuth | Dynamic? | Whether the front is authorized. |
| isBackAuth | Dynamic? | Whether the back is authorized. |
| isExpired | Dynamic? | The document isExpired (true, false). |
| isTampering | Dynamic? | The document is tampered (true, false). |
| tamperHeatMap | Dynamic? | The URL to the tampering heatmap. |
| isBackTampering | Dynamic? | The back of the document has been tampered. |
| backTamperHeatmap | Dynamic? | The URL to the heatmap of the back side of the document. |
| originalBackImage | Dynamic? | The URL to the back side of the image. |
| ghostImage | Dynamic? | The URL to the ghost image. |
| idMaritalStatus | Dynamic? | The marital status. |
| idDateOfIssuance | Dynamic? | The date of issuance. |
| idCivilRegisterNumber | Dynamic? | The civil register number. |
| idPlaceOfResidence | Dynamic? | The place of residence. |
| idProvince | Dynamic? | The province. |
| idGovernorate | Dynamic? | The governorate. |
| idMothersName | Dynamic? | The mother's name. |
| idFathersName | Dynamic? | The father's name. |
| idPlaceOfBirth | Dynamic? | The place of birth. |
| idBackImage | Dynamic? | The URL to the back image. |
| idBloodType | Dynamic? | The blood type. |
| idDrivingCategory | Dynamic? | The driving category. |
| idIssuanceAuthority | Dynamic? | The issuance authority that issued the ID. |
| idArmyStatus | Dynamic? | The army status. |
| idProfession | Dynamic? | The profession of the ID holder. |
| idUniqueNumber | Dynamic? | The unique number on the ID card. |
| idDocumentTypeNumber | Dynamic? | The ID document number. |
| idFees | Dynamic? | The fees paid. |
| idReference | Dynamic? | The reference data associated with the ID card. |
| idRegion | Dynamic? | The region. |
| idRegistrationLocation | Dynamic? | The registration location. |
| idFaceColor | Dynamic? | The face color. |
| idEyeColor | Dynamic? | The eye color. |
| idSpecialMarks | Dynamic? | Any special marks (tattoos, etc.). |
| idCountryOfStay | Dynamic? | The current country of stay. |
| idIdentityNumber | Dynamic? | The Identity Number of the ID. |
| idPresentAddresss | Dynamic? | The card holder present address. |
| idPermanentAddresss | Dynamic? | The card holder permanent address. |
| idFamilyNumber | Dynamic? | The family number. |
| identityNumberBack | Dynamic? | The identity number found on the back of the ID card. |
DocumentTokensModel
| Field | Type | Description |
|---|---|---|
| id | Int | Token id. |
| templateId | int | The template selected id. |
| tokenValue | String | The token value. |
| displayName | String | The display name. |
| tokenTypeEnum | int | The token type index value. |
Events
| Event | Description |
|---|---|
onSend | Starts processing. |
onRetry | Invoked when processing fails. |
onComplete | Called when processing is complete. |
onWrongTemplate | ID Card. Called when trying to scan a wrong ID base in the submitted template. |
onStartNfcScan() | NFC. Called when NFC starts. |
onCompleteNfcScan() | NFC. Called when NFC processing is complete. |
onErrorNfcScan() | NFC. Invoked when processing fails. |
Language transformation
A list of LanguageTransformationModel objects is created and populated with different language transformation configurations.
languageTransformationList is a list containing LanguageTransformationModel objects. Each model specifies the type of language transformation (either translation or transliteration), a key-value pair, the target language, and the data type for that transformation.
LanguageTransformationModel defines the structure for each language transformation and requires the following parameters:
| Parameter | Description |
|---|---|
languageTransformationEnum | The type of transformation (transliteration or translation). |
| Key and value strings | Placeholders such as "Your Key" and "Your Value" for specific content you want to work with. |
| Language | The target language (for example English, Arabic, Azerbaijani). |
| DataType | The type of data being transformed (text, date, number). |
FAQ
Can you set what data the ResponseModels have from the admin page?
No, the response models are static and are based on responses from the core ID orchestrator.
When the onComplete callback is triggered (for example for the passport), can that data be retrieved or a hook triggered on our backend?
When the callback is triggered, the application receives all the information. It is the responsibility of the application to transfer that data to any specific backend at this point. If the data can be transferred at a later stage or once it has been submitted to the platform, you can define a webhook in the connector block to be triggered after submission to inform your backend or send you specific data.
What are the KycDocumentDetails on the ScanIDCard? How would I know how many to add to the list?
The template chosen from the getTemplates() callback.
Are there any actions allowed to be triggered programmatically on the scan screens (ScanIDCard, FaceMatch, etc.)?
For features like ScanIDCard and FaceMatch, these are returned as fragments, allowing you to draw on top of them. For ScanIDCard, you receive each page in order via the onComplete callback. The camera automatically starts scanning the next page after each callback.
On the FaceMatchActivity there is a static document image being loaded to be matched against the face. How can I get the document scanned on the previous step to pass it to the face match?
You can obtain the imageUrl from the onComplete callback for document scanning, convert it to base64, and use it in face match.
What happens if the document has multiple sides? How can I find which side had the photo of the user to pass to the FaceMatch?
You must choose an order (page) that contains a face to set it for face match. When the document URL is retrieved from the document scan, Assentify flags that it has a face extracted based on the template.
What data should you submit on startSubmitData? Are these specified from the admin page?
You must prepare your list of steps with the outputProperties obtained for each step, for example a SubmitRequestModel for FaceMatch and one for DocumentCapture.
On the StepNames file there are various keys used for uploading the data on startSubmitData. How do these correlate with the admin page? Where can I find this mapping?
In Flow Builder, after selecting a flow from Flow Manager, you are presented with the blocks that make up the flow. To view the additional keys per flow, select the magnifier icon on the BlockLoader to see all the data there. You can also define and add new data points.