@capgo/capacitor-verisoul
v8.0.9
Published
Capacitor plugin for Verisoul fraud prevention sessions.
Maintainers
Readme
@capgo/capacitor-verisoul
Capacitor plugin for Verisoul native fraud-prevention sessions.
Installation
You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:
npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-verisoul` plugin in my project.If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
npm install @capgo/capacitor-verisoul
npx cap synciOS setup
Verisoul recommends enabling App Attest for stronger iOS device checks. Add the capability in Xcode and include the entitlement that matches your environment:
<key>com.apple.developer.devicecheck.appattest-environment</key>
<string>production</string>Use development for test builds.
Android setup
The plugin adds the Verisoul Maven repository and required network permissions. If your app build cannot resolve ai.verisoul:android, add this repository to your app root Gradle repositories:
maven { url = uri("https://us-central1-maven.pkg.dev/verisoul/android") }Usage
import { Verisoul } from '@capgo/capacitor-verisoul';
await Verisoul.configure({
environment: 'prod',
projectId: 'YOUR_PROJECT_ID',
});
const { sessionId } = await Verisoul.getSessionId();
await Verisoul.reinitialize();On Android, forward touch events when you need Verisoul touch-signal collection:
await Verisoul.recordTouchEvent({
x: 120,
y: 240,
action: 'down',
});API
configure(...)
configure(options: ConfigureOptions) => Promise<void>Initialize Verisoul. Call this once, early in app startup.
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | ConfigureOptions |
getSessionId()
getSessionId() => Promise<SessionIdResult>Return the current Verisoul session identifier.
The value may take a few seconds to become available after configure().
Returns: Promise<SessionIdResult>
reinitialize()
reinitialize() => Promise<void>Reset Verisoul signal collection and create a fresh session.
Use this when account context changes, for example after logout/login.
recordTouchEvent(...)
recordTouchEvent(options: RecordTouchEventOptions) => Promise<void>Forward a touch event to Verisoul.
Android uses this for bot-detection touch signals. iOS resolves without work because the iOS SDK does not expose a matching public API.
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | RecordTouchEventOptions |
Interfaces
ConfigureOptions
| Prop | Type | Description |
| ----------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| environment | VerisoulEnvironment | Verisoul project environment. Use prod or production for production traffic and sandbox for testing. |
| projectId | string | Verisoul project identifier. |
SessionIdResult
| Prop | Type | Description |
| --------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------- |
| sessionId | string | Verisoul session identifier. Send this value to your backend before calling Verisoul's server-side assessment APIs. |
RecordTouchEventOptions
| Prop | Type | Description |
| ------------ | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x | number | Touch X coordinate in view pixels. |
| y | number | Touch Y coordinate in view pixels. |
| action | VerisoulTouchAction | Touch action. Android forwards this to the native Verisoul SDK. iOS currently ignores this method because the Verisoul iOS SDK does not expose the same public touch-event hook. |
Type Aliases
VerisoulEnvironment
'dev' | 'sandbox' | 'staging' | 'prod' | 'production'
VerisoulTouchAction
'down' | 'up' | 'move' | 0 | 1 | 2
