Skip to content

Onfido ​

Identity verification and document scanning with Onfido SDK for NativeScript.

Installation ​

bash
npm install @nstudio/nativescript-onfido

Reference ​

Usage ​

Initialize ​

typescript
import { OnfidoUtils, Onfido, OnfidoCaptureType } from '@nstudio/nativescript-onfido';

OnfidoUtils.init('<your-token>', '<your-app-id>');

Start Verification Flow ​

typescript
Onfido.debugMode = true;

Onfido.start({
  sdkToken: token,
  flowSteps: {
    welcome: true,
    captureDocument: {},
    captureFace: {
      type: OnfidoCaptureType.PHOTO,
    },
  },
}).then(data => {
  console.log('Verification complete:', data);
}).catch((error) => {
  console.error('Verification failed:', error);
});

Configuration Options ​

Flow Steps ​

StepDescription
welcomeShow welcome screen
captureDocumentDocument capture step
captureFaceFace capture step

Capture Types ​

TypeDescription
OnfidoCaptureType.PHOTOCapture a photo
OnfidoCaptureType.VIDEOCapture a video

Document Types ​

Configure captureDocument to specify document types:

typescript
captureDocument: {
  docType: OnfidoDocumentType.PASSPORT,
  countryCode: 'USA'
}

API Reference ​

OnfidoUtils.init(token, appId) ​

Initialize the Onfido SDK.

Onfido.start(config) ​

Start the verification flow. Returns a Promise.

Onfido.debugMode ​

Set to true to enable debug logging.

Platform Notes ​

iOS ​

Ensure camera permissions are configured in Info.plist:

xml
<key>NSCameraUsageDescription</key>
<string>We need camera access for identity verification</string>

Android ​

Add camera permission to your AndroidManifest.xml:

xml
<uses-permission android:name="android.permission.CAMERA" />

License ​

Apache License Version 2.0