verisoul_sdk 0.0.1
verisoul_sdk: ^0.0.1 copied to clipboard
The Flutter Verisoul SDK provides a seamless wrapper around Verisoul’s native iOS and Android SDKs, enabling easy integration for fraud prevention and risk assessment. It includes session management, [...]
Flutter SDK #
Overview #
The purpose of this app is to demonstrate Verisoul's Flutter SDK integration.
To run the app a Verisoul Project ID is required. Schedule a call here to get started.
Setup #
Android #
-
Minimum SDK Requirement: Ensure that your Android
minSdkVersion
is set to 24 or higher. -
Add Revlum Maven Repository: In your Android project, navigate to your
android/build.gradle
file and ensure that the Verisoul Maven repository is added under theallprojects
section. It should look like this:allprojects { repositories { google() mavenCentral() maven { url = uri("https://us-central1-maven.pkg.dev/verisoul/android") } } }
copied to clipboard -
Update Kotlin Version:
To ensure compatibility with the latest features and improvements, you may need to update the Kotlin version used in your project. Open your android/settings.gradle
file and modify the Kotlin plugin version as follows:
plugins {
...
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
}
iOS #
- Add minimum iOS version in the Podfile to 14.0:
platform :ios, '14.0'
- Add Entitlements:
To fully utilize VerisoulSDK, you must add the
App Attest
capability to your project. This capability allows the SDK to perform necessary checks and validations to ensure the integrity and security of your application.
Update your app’s entitlements file:
<key>com.apple.developer.devicecheck.appattest-environment</key>
<string>production/development (depending on your needs)</string>
- Update the privacy manifest file :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
PrivacyInfo.xcprivacy
test
Created by Raine Scott on 1/30/25.
Copyright (c) 2025 ___ORGANIZATIONNAME___.
All rights reserved.
-->
<plist version="1.0">
<dict>
<!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
<key>NSPrivacyTracking</key>
<false/>
<!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
<key>NSPrivacyTrackingDomains</key>
<array/>
<!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<!-- The value provided by Apple for 'Device ID' data type -->
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeDeviceID</string>
<!-- Verisoul Fraud Prevention SDK does not link the 'Device ID' with user's identity -->
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<!-- Verisoul Fraud Prevention SDK does not use 'Device ID' for tracking -->
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<!-- Verisoul Fraud Prevention SDK uses 'Device ID' for App Functionality
(prevent fraud and implement security measures) -->
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
<!-- Privacy manifest file for Verisoul Fraud Prevention SDK for iOS -->
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<!-- The value provided by Apple for 'System boot time APIs' -->
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<!-- Verisoul Fraud Prevention SDK uses 'System boot time APIs' to measure the amount of
time that has elapsed between events that occurred within the SDK -->
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
</dict>
</plist>
Usage #
1. Initialization #
init(env: projectId)
Configure the Verisoul SDK by passing the environment and project ID. This function initializes the networking, device check, and device attestation components.
Parameters:
env (VerisoulEnvironment)
: The environment to configure the SDK with (VerisoulEnvironment.Dev
,VerisoulEnvironment.Sandbox
,VerisoulEnvironment.Prod
).projectId (string)
: Your project's unique identifier.
Example Usage:
import 'package:sdk/entities/verisoul_environment.dart';
import 'package:sdk/sdk.dart';
try {
await _sdkPlugin.init(
env: VerisoulEnvironment.prod,
projectId: "your-project-id");
} catch (error) {
print('Error initializing Verisoul: $error');
}
2. Get Session ID #
getSessionId()
Once the minimum amount of data is gathered, the session ID becomes available. The session ID is needed to request a risk assessment from Verisoul's API. Note that session IDs are short-lived and expire after 24 hours.
import 'package:sdk/sdk.dart';
try {
String id = await _sdkPlugin.getSessionId();
setState(() {
_sessionId = id;
});
} catch (error) {
print('Error fetching session ID: $error');
}
3. Provide Touch Events (Android Only) #
onTouchEvent(x, y, action)
To gather touch events and compare them to device accelerometer sensor data, the app needs to provide touch events to Verisoul. The following implementation captures touch events in Flutter and forwards them to the Verisoul SDK on Android.
📌 Usage Example:
import 'package:sdk/sdk.dart';
import 'package:sdk/entities/motion_action.dart';
Listener(
onPointerDown: (event) {
onTouchEvent(
x: event.localPosition.dx,
y: event.localPosition.dy,
action: MotionAction.actionDown);
},
onPointerMove: (event) {
onTouchEvent(
x: event.localPosition.dx,
y: event.localPosition.dy,
action: MotionAction.actionMove);
},
onPointerUp: (event) {
onTouchEvent(
x: event.localPosition.dx,
y: event.localPosition.dy,
action: MotionAction.actionUp);
},
Future<void> onTouchEvent({
required double x,
required double y,
required MotionAction action,
}) async {
await _sdkPlugin.onTouchEvent(x: x, y: y, action: action);
}
Questions and Feedback #
Comprehensive documentation about Verisoul's iOS SDK and API can be found at docs.verisoul.ai. Additionally, reach out to Verisoul at help@verisoul.ai for any questions or feedback.