periculum_identity_sdk

Flutter SDK for Periculum Insights identity comparison: guided face liveness (ML Kit) + server-side ID photo match (BVN, NIN, PHONENUMBER, FRSC).

Sales demo (HTML)

Static walkthrough for customers (no liveness/API): see demo/ — host index.html on any static URL or run python3 -m http.server in that folder.

Install

dependencies:
  periculum_identity_sdk: ^0.1.1

Platform setup

Branding

The SDK ships with Insights colors (#2A38A4, #1C256D, #363C4F), DM Sans, and the official wordmark (same assets as frontend/insights / mono link flows). Override only if you white-label:

final client = PericulumIdentityClient(
  baseUrl: '...',
  accessTokenProvider: () async => token,
  theme: PericulumIdentityTheme.insights, // default
);

Set showInsightsBranding: false on a custom PericulumIdentityTheme to hide the logo header on the ID input step.

Authentication

Use the same OAuth Bearer token you already use for Insights API calls (Keycloak client credentials / user token). The SDK does not embed API keys; your backend tenant wallet is debited on successful 200 responses, same as other verify endpoints.

Usage

A — Business fixes ID type and number (customer only does face scan)

final result = await client.verifyWithConfig(
  context: context,
  config: IdentityVerificationConfig(
    fixedIdType: IdentityDocumentType.bvn,
    fixedIdNumber: '22222222222',
  ),
);

B — Business fixes BVN only; customer enters their BVN

final result = await client.verifyWithConfig(
  context: context,
  config: IdentityVerificationConfig(
    fixedIdType: IdentityDocumentType.bvn,
    allowedIdTypes: [IdentityDocumentType.bvn],
  ),
);

C — Customer chooses from ID types your product allows

final result = await client.verifyWithConfig(
  context: context,
  config: IdentityVerificationConfig(
    allowCustomerToChooseIdType: true,
    allowedIdTypes: [
      IdentityDocumentType.bvn,
      IdentityDocumentType.nin,
    ], // or omit and call fetchIdTypeOptions() for tenant defaults
  ),
);

Liveness

The SDK runs active liveness (ML Kit): single-face checks, distance hints, center → blink → head turn, accurate post-capture face validation — not a gallery pick.

final client = PericulumIdentityClient(
  baseUrl: 'https://insights-api.aws.insights-periculum.com',
  accessTokenProvider: () async => myInsightsBearerToken,
  livenessConfig: const FaceLivenessConfig(stepTimeout: Duration(seconds: 60)),
);

API

Method Insights endpoint
verifyIdentity / verifyWithConfig PUT /verify/identity-comparison
fetchIdTypeOptions GET /verify/identity-comparison/id-types

Webhooks

When webhooks are enabled on your tenant, a successful match triggers an encrypted webhook with responseType: IDENTITY_COMPARISON and identityComparisonResponse (match score + identity details).

Publish to pub.dev

Maintainers only — integrators should depend on the published package version.

cd frontend/periculum_identity_sdk
dart pub publish --dry-run
dart pub publish