Warning
This guide is specific to Web SDK 2.x. For Web SDK 1.x, you can find documentation here.
Do not attempt to upgrade or implement without support. Contact your Incode representative to check if you are a candidate for this upgrade.
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.
The built-in UI lists each document as a card, with the first one tagged Recommended, followed by a Scan a new document card. Tapping a card submits that choice immediately. The screen also opens a What data will be shared? sheet and links to Incode's Privacy Policy. When the backend provides it, the name of the organization receiving the document appears in the copy.
This module follows the form-based pattern with a selection state. Picking a document submits it in one step. 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 and the receiving organization's name in parallel. The name lookup can't keep this state going past one second after loading starts. |
documentsFound |
Documents are available; picking one submits it. |
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. |
companyName |
string (optional) |
Name of the organization receiving the reused document. Absent when the backend doesn't provide one. Use it in your own copy. |
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 idle → loading. |
chooseDocument(documentId) |
Select a document by id or pass the SCAN_NEW_DOCUMENT sentinel ('scanNew') without submitting. Only needed for two-step UIs. Ids that aren't among documents are ignored. |
submit(documentId?) |
Submit a document for reuse. Pass an id or SCAN_NEW_DOCUMENT to select and submit in one call. Omit it to submit the current selection. Ids that aren't among documents are ignored. |
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 in one step.
manager.submit(state.documents[0].id);
// Or scan a new document instead: manager.submit(SCAN_NEW_DOCUMENT);
}
});
manager.load();
See also
- Module: Selfie: fallback when reuse is skipped or no candidates found
- Module: Authentication: different re-auth flow (selfie ↔ stored biometric)
- Module Patterns → form-based
- Individual Modules