SDK reference · Incode Web SDK 2 Reference / Web SDK 2 Individual Modules

Identity Reuse Module

Note

This guide is specific to Web SDK 2.0. If you are still using 1.x, you can find documentation here. Contact your Incode Representative for upgrade information and check if you are a candidate for this upgrade.

Full rollout to all clients still TBD.

The Identity Reuse module offers a returning user the identity documents they already verified with partner organizations, so they can reuse one instead of capturing a fresh ID and selfie.

Follows the form-based pattern with a selection state. The user picks a document and submits their choice. See the patterns page for the shared lifecycle.

Tag

<incode-identity-reuse> is a standard Web Component. Importing the UI subpath registers the custom element; importing the CSS applies the module's styles.

import '@incodetech/web/identity-reuse';
import '@incodetech/web/identity-reuse/styles.css';

Properties

Property Type Required Description
config IdentityReuseConfig No options
onFinish () => void Called when the user's choice is submitted
onError (error: string) => void Called when an error occurs

Configuration

The module takes no configuration:

type IdentityReuseConfig = {};

Which prior documents are offered is configured server-side.

State machine

IdentityReuseState is a discriminated union over status. The selection state (documentsFound) is unique to this module:

Status Description
idle Initial state, waiting for load().
loading Fetching reusable documents from the backend.
documentsFound Documents are available; the user picks one and confirms.
submitting Submitting the chosen document for reuse.
finished Terminal.
error Recoverable error; the user can retry or skip. Carries error.

When status === 'documentsFound':

Property Type Description
documents ReusableDocument[] Ordered documents; index 0 is the best match. Render the first entry as recommended — position is the only signal.
selectedDocumentId SelectedDocumentId | undefined The current selection, or 'scanNew' when the user chose to scan a new document. Populated with documents[0].id on entry.

Each ReusableDocument carries id, documentType (camelCase, for example driversLicense), maskedNumber (for example 00*****29), countryCode (ISO 3166-1 alpha-3), and verifiedAt (Unix epoch in seconds). Format countryCode and verifiedAt in your own UI — the module passes both through unchanged.

API methods

Method Purpose
load() Fetch reusable documents. Moves idleloading.
chooseDocument(documentId) Select a document by id, or pass the SCAN_NEW_DOCUMENT sentinel ('scanNew') to skip reuse.
submit() Confirm the selection. Submits the chosen document, or finishes without submitting for 'scanNew'.
skip() Skip identity reuse entirely and finish the module.
retry() Reload documents after an error.

Plus the universal lifecycle: subscribe, getState, reset, stop.

SCAN_NEW_DOCUMENT, the SelectedDocumentId type, and ReusableDocument are exported from @incodetech/core/identity-reuse:

import {
  createIdentityReuseManager,
  SCAN_NEW_DOCUMENT,
} from '@incodetech/core/identity-reuse';

const manager = createIdentityReuseManager({ config: {} });

manager.subscribe((state) => {
  if (state.status === 'documentsFound') {
    // Reuse the recommended document.
    manager.chooseDocument(state.documents[0].id);
    manager.submit();
  }
});

manager.load();

See also

Was this page helpful?