System Design Atlas

Verify identity evidence and eligibility

07 / 10Worked example

Critical flow

How does the callback prevent a false or double release?

The critical sequence begins with an already created verification attempt. The person has submitted their evidence to the provider. Now the server processing decides whether the result is valid and usable for the domain decision.

Starting point V-17 is created; the provider event may arrive late, double or in the wrong order.

Assumptions for the example case

Example design: an operator, a verification provider and a specified purpose of use. Identity and other evidence shall be assessed separately. Login, sessions, and rights across multiple applications are not part of this case. Figures and target values are design assumptions; no real people are checked.

V-17 provider event safely applied to I-17

Critical Process · Participant, Time and Lasting Effect

The verification service shall report: V-17; the subject application reads the status stored only afterwards.

Verification service
Verification API
SQL · Inbox/Outbox
Verification worker
Domain application
  1. 01 Verification service → Verification APIPOST /provider events · E-17

    Signed callback

  2. 02 Verification API · Local processingCheck signature and provider reference
  3. 03 Verification API → SQL · Inbox/OutboxSave inbox event E-17

    Duplicate key durable acceptance

  4. 04 SQL · Inbox/Outbox → Verification APIInbox-Commit

    E-17 is stored restartable

  5. 05 Verification API → Verification service2xx · Acceptance confirmed

    No domain approval

  6. Permanently decoupled: Worker processes the stored inbox later
  7. 06 Verification worker → SQL · Inbox/OutboxReading due inbox event

    Worker polls; SQL does not send a push

  8. 07 SQL · Inbox/Outbox → Verification workerDeliver E-17 with V-17

    The current status is read

  9. 08 Verification worker · Local processingCheck V-17, Person P-17, Purpose Z-3 and Transition
  10. 09 Verification worker → SQL · Inbox/OutboxD-17 + completed + write inbox completion

    A transaction

  11. 10 SQL · Inbox/Outbox → Verification workerTransaction committed

    Decision, status and inbox closure are effective together

  12. 11 Domain application → Verification APIGET /verification-requests/I-17

    Subsequent status search

  13. 12 Verification API → SQL · Inbox/OutboxI-17 Reading Query
  14. 13 SQL · Inbox/Outbox → Verification APIReturn completed and D-17

    Stored domain state

  15. 14 Verification API → Domain applicationcompleted + D-17

    Readable domain state

Result: The domain decision follows callback acceptance; the 2xx response acknowledges receipt.

  • Verification service and domain application
  • API and Worker
  • SQL with Inbox/Outbox

Normal case, duplicate with Worker crash and the old attempt V-16 preserve the same rule: first accept permanently, later check, work exactly once.

A provider event only takes effect after verification of authenticity, assignment, order and domain transition.

Three error cases determine the design

Double message
The unique event key prevents a second effect. After a worker crash, the saved entry is processed again.
Old result after a new attempt
The worker compares the attempt with the current request state. Conflicting ordering triggers status reconciliation instead of overwriting the state blindly.
Decision saved, confirmation lost
The repetition reads the already processed status. A transaction combines domain decision and completion of the inbox entry.

Terms in this step

At least once
A message may arrive multiple times. The receiver must ensure that its domain effect occurs only once.

Try it yourself

Go through the event from signature verification to D-17. Predict what will happen to a duplicate and event for V-16.

A hint for your attempt

Check authenticity, provider reference, current attempt, and allowed transition before the effect. Repetitions remain idempotent.

Compare with a possible solution
Test chain
The API authenticates E-17 and checks the provider reference and assignment to V-17. The worker checks the current state of I-17, then evaluates D-17. Test an invalid signature and a missing reference; expect 0 decisions and a traceable inbox outcome.
Duplicate
The already processed key for E-17 returns the existing inbox and decision state. Test: deliver E-17 three times, including after worker termination; expect exactly one domain effect and an unchanged completion state.
Obsolete test
An authenticated event for the old attempt V-16 is accepted and marked as late, while the current I-17 remains unchanged. Test: send V-16 after V-17; expect 0 changes to D-17 and an auditable warning.

Apply to your project

What delayed or repeated message could create an incorrect state in your system?

The error cases show in step 8, which bottlenecks really justify an expansion.