zkOBS - Open Banking Services
Use Case
This guide provides detailed instructions on how to integrate zkMe’s zkTLS SDK into your Flutter mobile application for secure Open Banking Services (zkOBS) verification. Through Platform Channels, your Flutter app can seamlessly interact with the native zkTLS SDK on Android and iOS platforms, enabling user data authorization and verification without redirection to external browsers or third-party applications.
This integration approach aims to reduce user friction and drop-off while ensuring sensitive data is never exposed to the app. Users generate privacy-preserving cryptographic proofs, making it an ideal solution for mobile-first products that require secure verification with a single cross-platform Flutter codebase.
Requirements & Compatibility
Before starting the integration, ensure your development environment meets the following minimum requirements:
Android
Android 7.0 (API 24)
Android 14 (API 34)
iOS
iOS 13.0
CocoaPods
The SDK is provided as native libraries. It is compatible with all stable Flutter releases that support standard Platform Channels. No additional Flutter-side dependencies are required beyond the services library.
Integration Workflow Overview
Integrating the SDK requires platform-specific native integration for Android and iOS:
Android Native Integration: Configure your Android project to include the SDK and handle calls from Flutter to start the verification process.
iOS Native Integration: Configure your iOS project to include the SDK and invoke the native zkTLS verification flow from your view controller.
Android Native Integration
This section details how to integrate the zkTLS SDK into the Android portion of your Flutter project and implement the Platform Channel handler to respond to calls from Dart.
Step 1. Add Maven Repository
Add a private Maven repository in settings.gradle.kts (or settings.gradle) in the project root directory.
Step 2. Add Dependencies
Add the SDK dependency in the build.gradle.kts (or build.gradle) file of your app module.
Note: Click the Sync Now button in Android Studio and wait for the dependency download to complete.
Step 3. Handle Flutter Calls and Start Verification
To start the verification process on Android when triggered from Flutter, add the following code to your MainActivity. This code invokes the native SelvageSdk.startVerification() API and handles verification callbacks, including success, error, and cancellation.
API Reference
SelvageSdk
The main entry class of the SDK, providing verification-related methods.
Method: startVerification
Parameters:
context
Context
Android context, typically an Activity.
requestId
String
Unique identifier for this verification request.
appId
String
App ID
apiKey
String
API key
providerId
String
Provider identifier for the verification flow.
callback
SelvageSdk.Callback
Callback used to receive verification results.
Return Value: None.
SelvageSdk.Callback
Verification result callback interface.
Methods:
onSuccess(result: SelvageVerificationResult): Called when the verification flow completes successfully.
Parameters:
result: SelvageVerificationResult: Result object delivered on successful verification.
onError(error: SelvageVerificationError): Called when the verification flow fails.
Parameters:
error: SelvageVerificationError: Error object describing the failure.
onCancelled(): Called when the user cancels the verification flow.
Parameters: None.
SelvageVerificationResult
Result object delivered via SelvageSdk.Callback.onSuccess when the verification flow completes successfully.
Properties:
sessionId
String
Session ID
proofsJson
String
Proof data in JSON format.
Example: Handling a successful verification result
iOS Native Integration
Step 1. Podfile Integration
Podfile IntegrationAdd the following to your Podfile:
Step 2. Initial Setup
Step 3. iOS Configuration
3.1 Info.plist
Ensure the following network security configuration is included in your Info.plist:
3.2 Build Settings
In your Xcode project’s Build Settings, configure the following:
Enable Bitcode
No
Flutter does not support Bitcode.
Build Active Architecture Only
Debug: Yes, Release: No
Ensure Release builds include all architectures.
Excluded Architectures (Debug)
i386
Exclude 32-bit emulator architectures.
Step 4. Start Verification on iOS
API Reference
SelvageSdk
The main entry class of the SDK, providing static methods.
Method: startVerificationWithAuth
Parameters:
presenter
UIViewController?
The view controller used to present the verification interface. If nil, the SDK automatically locates the currently displayed view controller.
appId
String
Application ID issued by zkTLS.
apiKey
String
API key associated with your application.
providerId
String
Provider identifier for the verification flow.
callback
Callback
Callback interface used to receive verification results.
Return Value: None.
VerificationResult
Result object delivered via the verification success callback when the verification flow completes successfully.
Properties:
sessionId
String
Unique identifier of the verification session.
proofsJson
String
Proof payload in JSON format. This value should be submitted to your backend for verification.
Example: Handling a successful verification result
VerificationError
Error type delivered via the verification failure callback when the verification flow fails. This error object describes the reason why the verification did not complete successfully.
Error Cases:
invalidArguments(message)Indicates that one or more required arguments are missing or invalid.sdkBusyIndicates that the SDK is currently processing another verification request.verificationFailed(message, _, type)Indicates that the verification process completed but did not meet the required verification criteria.flutterChannelError(code, message, _)Indicates an internal error occurred while communicating with the Flutter platform channel.
Example: Handling a verification failure
FAQs
This section collects common questions and their solutions that developers may encounter while using the SDK.
How to handle network disconnection?
The SDK will throw a zkTlsException upon network disconnection. Developers should catch this exception at the application layer and prompt the user to check their network connection or retry later.
Why did my data collection request fail?
Please check the following: Is the API Key correct? Is the zkTLS backend service address reachable? Is the Provider Schema valid? Is the target URL accessible? Detailed error messages can be obtained by enabling SDK logging.
Does the SDK support data collection from all websites?
The zkTLS protocol theoretically supports all TLS-based HTTPS websites. However, the specific data extraction capability depends on the definition of the Provider Schema and the website structure. For complex websites or those with dynamic content, customized Provider Schemas may be required. It is recommended to thoroughly test target websites before integration.
Last updated