YeboVerify SDKs
YeboVerify provides SDKs for 6 platforms to simplify integration.
SDK Overview
| Platform | Package | Status |
|---|---|---|
| Node.js | @yeboverify/node | ✅ Available |
| React | @yeboverify/react | ✅ Available |
| React Native | @yeboverify/react-native | 🚧 In Progress |
| Swift (iOS) | YeboVerify | 🚧 In Progress |
| Kotlin (Android) | com.yeboverify | 🚧 In Progress |
| Flutter | yeboverify_flutter | 🚧 In Progress |
Node.js SDK
Location: sdk/node/
Installation
bash
npm install @yeboverify/nodeBasic Usage
typescript
import { YeboVerify } from '@yeboverify/node';
const client = new YeboVerify({
apiKey: 'ybv_live_your_api_key'
});
// Submit verification
const { verificationId, status } = await client.verify({
idFront: '/path/to/id-front.jpg', // File path or Buffer
selfie: '/path/to/selfie.jpg',
externalRef: 'user_123', // Optional
documentType: 'National ID' // Optional
});
// Get result
const verification = await client.getVerification(verificationId);
console.log(verification.decision); // 'approved' | 'rejected' | 'needs_review'Poll for Completion
typescript
// Wait for verification to complete (not recommended for production)
const result = await client.pollVerification(verificationId, {
intervalMs: 2000, // Check every 2 seconds
timeoutMs: 60000 // Give up after 60 seconds
});Webhook Verification
typescript
// Verify webhook signature
const isValid = client.verifyWebhook(
rawBody, // Raw request body
req.headers['x-yeboverify-signature'],
'your_webhook_secret'
);
// Parse and verify in one step
const event = client.parseWebhook(rawBody, signature, secret);API Methods
typescript
// Submit verification
verify(options: VerifyOptions): Promise<VerifyResponse>
// Get verification result
getVerification(id: string): Promise<Verification>
// List verifications
listVerifications(options?: ListOptions): Promise<ListResponse>
// Poll until complete
pollVerification(id: string, options?: PollOptions): Promise<Verification>
// Get account info
getAccount(): Promise<Account>
// Update webhook settings
setWebhook(url: string, secret?: string): Promise<void>
// Webhook utilities
verifyWebhook(body, signature, secret): boolean
parseWebhook(body, signature, secret): WebhookEventReact Widget
Location: sdk/react/
Installation
bash
npm install @yeboverify/reactUsage
tsx
import { YeboVerifyWidget } from '@yeboverify/react';
function VerificationPage() {
return (
<YeboVerifyWidget
apiKey="ybv_live_your_api_key"
externalRef="user_123"
onSubmit={(verificationId) => {
console.log('Submitted:', verificationId);
}}
onResult={(result) => {
console.log('Result:', result.decision);
}}
onError={(error) => {
console.error('Error:', error);
}}
primaryColor="#16a34a"
requireIdBack={false}
/>
);
}Props
| Prop | Type | Required | Description |
|---|---|---|---|
apiKey | string | ✓ | Your API key |
baseUrl | string | API base URL | |
externalRef | string | Your reference ID | |
documentType | string | Document type hint | |
onSubmit | function | Called on submission | |
onResult | function | Called with result | |
onError | function | Called on error | |
primaryColor | string | Brand color | |
requireIdBack | boolean | Require ID back photo | |
className | string | CSS class |
Widget Steps
- ID Front - Upload front of ID
- ID Back - Upload back (optional)
- Selfie - Take/upload selfie
- Review - Confirm before submit
- Done - Show result
Customization
The widget is styled with inline CSS and can be customized via primaryColor prop. For deeper customization, use the hook:
tsx
import { useYeboVerify } from '@yeboverify/react';
function CustomVerification() {
const { submit, status, result, error } = useYeboVerify({
apiKey: 'ybv_live_xxx'
});
const handleSubmit = async (files) => {
await submit({
idFront: files.idFront,
selfie: files.selfie
});
};
// Build your own UI...
}React Native SDK
Location: sdk/react-native/
Installation
bash
npm install @yeboverify/react-native
npx pod-install # iOSUsage
tsx
import { YeboVerifyFlow } from '@yeboverify/react-native';
function VerificationScreen() {
return (
<YeboVerifyFlow
apiKey="ybv_live_xxx"
onComplete={(result) => {
navigation.navigate('Home', { verified: result.decision === 'approved' });
}}
onError={(error) => console.error(error)}
/>
);
}Camera Integration
Uses react-native-vision-camera for high-quality captures.
Swift SDK (iOS)
Location: sdk/swift/
Installation (CocoaPods)
ruby
pod 'YeboVerify'Usage
swift
import YeboVerify
let client = YeboVerifyClient(apiKey: "ybv_live_xxx")
// Submit verification
client.verify(
idFront: idFrontImage,
selfie: selfieImage
) { result in
switch result {
case .success(let verification):
print("Submitted: \(verification.verificationId)")
case .failure(let error):
print("Error: \(error)")
}
}
// Get result
client.getVerification(id: verificationId) { result in
// Handle result
}Kotlin SDK (Android)
Location: sdk/kotlin/
Installation (Gradle)
groovy
implementation 'com.yeboverify:sdk:1.0.0'Usage
kotlin
val client = YeboVerifyClient("ybv_live_xxx")
// Submit verification
client.verify(
idFront = idFrontBitmap,
selfie = selfieBitmap
).observe(this) { result ->
when (result) {
is Result.Success -> Log.d("Verification", result.data.verificationId)
is Result.Error -> Log.e("Error", result.exception.message)
}
}Flutter SDK
Location: sdk/flutter/
Installation
yaml
dependencies:
yeboverify_flutter: ^1.0.0Usage
dart
import 'package:yeboverify_flutter/yeboverify_flutter.dart';
final client = YeboVerify(apiKey: 'ybv_live_xxx');
// Submit verification
final result = await client.verify(
idFront: File('path/to/id.jpg'),
selfie: File('path/to/selfie.jpg'),
);
// Check result
print(result.verificationId);
print(result.status);Common Patterns
Webhook Handler (All SDKs)
Webhooks are the recommended way to receive results:
typescript
// Node.js example
app.post('/yeboverify-webhook', (req, res) => {
const client = new YeboVerify({ apiKey: 'xxx' });
try {
const event = client.parseWebhook(
req.rawBody,
req.headers['x-yeboverify-signature'],
process.env.WEBHOOK_SECRET
);
// Handle based on decision
if (event.decision === 'approved') {
await approveUser(event.externalRef);
} else if (event.decision === 'rejected') {
await rejectUser(event.externalRef, event.decisionReason);
} else {
await flagForReview(event.externalRef);
}
res.status(200).send('OK');
} catch (err) {
res.status(401).send('Invalid signature');
}
});