Skip to main content
This guide provides a conceptual overview of OneSDK integration with basic code examples. The code snippets shown are illustrative and need to be adapted into your specific framework and application architecture. For complete, working examples:

Core Modules Overview

OneSDK Modules Data Capture Flow

OneSDK modules data capture flow diagram

Quick Integration Guide

1

Install OneSDK

npm install @frankieone/one-sdk
2

Initialize the SDK

Note: The sample code below is just an example. Never generate tokens on the frontend — doing so can expose your credentials. Always generate tokens securely on your backend and pass them to your app as needed.
import OneSdk from "@frankieone/one-sdk";
// fetch your token
const tokenResultRaw = await fetch(
  "https://backend.kycaml.uat.frankiefinancial.io/auth/v2/machine-session",
  {
    method: "POST",
    headers: {
      authorization: "machine " + btoa(`${CUSTOMER_ID}:${API_KEY}`),
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      permissions: {
        preset: "one-sdk",
        // you can pass either your own unique customer reference
        // or if entity already created/existed, you can pass it's ID here
        reference: "customer-reference",
        entityId: "abc-def-ghi",
      },
    }),
  },
);

const oneSdk = await OneSdk({
  session: tokenResultRaw,
  mode: "production",
  recipe: {
    ocr: {
      maxDocumentCount: 3,
    },
  },
});
3

Configure Modules

// Example: Initialize Individual and Biometrics modules
const individual = oneSdk.individual();
const biometrics = oneSdk.component("biometrics");
4

Start Verification

// Example: Mounting Biometrics Component
biometrics.mount("#bio-el");

biometrics.on("detection_complete", (event) => {
  console.log("Biometric capture completed");
});

biometrics.on("results", (results) => {
  console.log("Verification results:", results);
});

Implementation Best Practices

try {
  await individual.submit();
} catch (error) {
  if (error.code === 'CONSENT_REQUIRED') {
    // Handle missing consent
  } else if (error.code === 'VALIDATION_ERROR') {
    // Handle validation errors
  }
}
// Example: Coordinated verification flow
const verifyUser = async () => {
  // 1. Capture basic information
  await individual.setProfileType('standard_kyc');

  // 2. Perform document verification
  const docResult = await idv.verifyDocument();

  // 3. Run biometric checks
  const bioResult = await biometrics.verifyFace();

  // 4. Submit for final verification
  return individual.submit();
};
Initialize modules only when needed and release resources after use. This is especially important for camera-based operations in the Biometrics and OCR modules.

Common Integration Scenarios

const basicKyc = async () => {
  const individual = oneSdk.individual();
  const idv = oneSdk.idv();

  await individual.addConsent('general');
  await idv.captureDocument('PASSPORT');
  return individual.submit();
};
Each module can be used independently or as part of a comprehensive verification flow. Check individual module documentation for detailed implementation guidelines.

Content Security Policy (CSP) Settings

You may need to adjust your Content Security Policy (CSP) settings to allow vendors’ scripts and resources to load correctly. Below are the additional CSP rules required based on the vendor you are integrating with: