Re-verify and recovery (Pilot)
Use the person code to tell whether the member in front of you is the one who made the account. You keep no ID and no face database: only the code you already stored at sign-up.
Read the integration guide first (steps 1 to 8). This guide uses the same session and result calls.
1. Store the person code at sign-up
When a member verifies at sign-up, the result has unique: true and a personCode. Save it against the account, like any other personal data (it identifies a person within your app, and is different in every other app).
// after GET /v1/sessions/<id>/result at sign-up
if (r.outcome === 'verified' && r.unique) {
await db.accounts.update(accountId, { personCode: r.personCode });
}
2. Verify again later
When you need to recover an account or check a suspicious login, ask the member to verify again. Create a new session from your server (POST /v1/sessions), send only the sessionId to the app, and show the same sheet. Do this from a session you trust as far as you can, for example after an email link. A verified result alone does not prove who owns the account; the code comparison does.
3. Compare codes on your server
Compare in constant time, only for a verified result with unique: true.
import { timingSafeEqual } from 'node:crypto';
const same = (a: string, b: string) =>
a.length === b.length && timingSafeEqual(Buffer.from(a), Buffer.from(b));
async function checkRecovery(accountId: string, sessionId: string) {
const res = await fetch(`https://api.nodid.app/v1/sessions/${sessionId}/result`, {
headers: { Authorization: `Bearer ${process.env.NODID_SECRET_KEY}` },
});
if (res.status === 202) return 'pending';
const r = await res.json();
if (r.outcome !== 'verified' || !r.unique) return 'not_verified';
const stored = await db.accounts.personCodes(accountId); // one or more codes
if (stored.some((c) => same(c, r.personCode))) return 'match';
return 'no_match';
}
match: it is the same passport identity as at sign-up. Let the member back in through your usual recovery step.no_match: do not lock the member out and do not assume fraud. The code changes when the name on the passport changes, or when someone verifies with a second passport. Send them to support, or, from a signed-in session, let them add the new code as a second code for the same member.- A code that matches a different account goes to support. Never merge or ban automatically.
The code is a "likely same person" signal. Two different people can, rarely, share one (same name, birth date and nationality).
What you see
Only the outcome and the code. No name, date of birth, photo or passport number. Reasons for a failed check stay on the member's phone.