periculum_identity_sdk

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

Install

dependencies:
  periculum_identity_sdk: ^0.1.1

Platform setup

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