快速入门
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-verisoul`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/verisoul/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
“安装”章节你可以使用我们的 AI 辅助设置来安装插件。使用以下命令将 Capgo skills 添加到你的 AI 工具中:
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下 prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-verisoul` plugin in my project.如果你更想手动设置,请运行以下命令安装插件,并按照下方各平台的说明操作:
bun add @capgo/capacitor-verisoulbunx cap sync快速入门
章节标题为“快速入门”import { Verisoul } from '@capgo/capacitor-verisoul';
await Verisoul.configure({ environment: 'dev', projectId: 'project-id-123',});示例:getSessionId
标题为“示例:getSessionId”的章节import { Verisoul } from '@capgo/capacitor-verisoul';
const result = await Verisoul.getSessionId();console.log(result);示例:reinitialize
标题为“示例:重新初始化”的章节import { Verisoul } from '@capgo/capacitor-verisoul';
await Verisoul.reinitialize();常见坑点
章节标题为“常见陷阱”- 初始化一次: 在应用启动时运行 setup。
- 原生同步:运行
bunx cap sync在插件升级后。 - 唯一可信来源:信任
src/definitions.ts在 GitHub 仓库中。
配置 Verisoul
“配置 Verisoul” 部分调用 configure() 一次,在应用启动早期。使用 sandbox 用于测试, prod 用于生产流量。
import { Verisoul } from '@capgo/capacitor-verisoul';
await Verisoul.configure({ environment: 'prod', projectId: 'YOUR_PROJECT_ID',});获取 Session ID
“获取会话 ID” 部分当 Verisoul 收集到足够的原生信号后,请求会话 ID 并将其发送到您的后端。您的后端应调用 Verisoul 的服务器端 API 进行风险评估。
const { sessionId } = await Verisoul.getSessionId();
await fetch('/api/risk/verisoul', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ sessionId }),});账号变更时重置
章节标题“账户变更时重置”调用 reinitialize() 当用户上下文发生变化时,例如退出登录后以另一个账号登录。
await Verisoul.reinitialize();Android 触摸信号
标题为“Android 触摸信号”的章节在 Android 上,当你的应用需要 Verisoul 采集触摸模式时,转发触摸事件。
await Verisoul.recordTouchEvent({ x: 120, y: 240, action: 'down',});平台设置
标题为“平台设置”的章节- iOS 配置 涵盖 App Attest entitlement 相关说明。
- Android 配置 涵盖 Verisoul Maven 仓库及权限。
从入门指南继续
“从入门指南继续”章节如果你正在使用 快速入门 要集成 Verisoul 会话,请将其与 @capgo/capacitor-verisoul 有关 API 概览, iOS 配置 有关 App Attest 说明, Android 配置 用于 Gradle 配置,以及 使用 @capgo/capacitor-verisoul 用于插件教程。