Entrust / Onfido
components/entrust/client.py wraps the Onfido REST API that backs Entrust Identity
Verification. Consumed by POST /entrust/sessions and the
aftermath task (validate_identity_document (Entrust / Onfido)).
|
Au10tix / Entrust coexistence. Entrust Identity Verification (Onfido) is the eventual
replacement for Au10tix identity-document validation. During the rollout both vendors run
under the same |
Configuration
Base URL |
|
Workflow |
|
Auth |
|
Webhook secret |
|
Session HTTP behaviour
The client builds a requests.Session with a retrying adapter:
retry = HTTPRetry(
total=5,
backoff_factor=0.5,
status_forcelist=(429, 500, 502, 503, 504),
respect_retry_after_header=True,
raise_on_status=False,
)
Only idempotent methods are retried (urllib3’s default allowed set excludes POST), so creating
an applicant or a workflow run is never silently duplicated. respect_retry_after_header honours
Onfido’s 429 backoff, and raise_on_status=False lets the client’s own raise_for_status()
surface the final error unchanged. This matters because reconciling one completed run fans out
into many GETs — one per workflow step and one per downloaded file.
Methods
Session creation
| Method | Call |
|---|---|
|
|
|
|
Reading a run
| Method | Call |
|---|---|
|
|
|
|
|
|
|
Convenience: list, then hydrate every step (skipping entries without an |
Captured artifacts
| Method | Call |
|---|---|
|
|
|
The selfie. |
|
Liveness video. |
|
Onfido’s alternative liveness modality — a run produces one or the other depending on the SDK flow. |
|
Downloads all documents and live photos as `EntrustFile`s, ready for multipart re-upload. |
|
Same for live videos and motion captures, kept separate so the aftermath task can upload liveness media in its own request after the documents. |
EntrustFile
@dataclass
class EntrustFile:
filename: str
content_type: str
content: bytes
side: Optional[str] = None # front / back — documents only
document_type: Optional[str] = None # Onfido type, e.g. driving_licence
issuing_country: Optional[str] = None # ISO country, e.g. LKA
kind: str = KIND_DOCUMENT # document | live_photo | live_video | motion_capture
kind lets callers decide which per-file metadata applies (an expiry attaches to documents and
liveness media but not to the selfie). content_type is mapped from Onfido’s file_type
(jpg/jpeg → image/jpeg, png, pdf, mov → video/quicktime, mp4, webm), defaulting
to application/octet-stream. A missing file_name becomes {kind}_{id}.{file_type}.
Error handling
Every call ends in response.raise_for_status(), so non-2xx raises requests.HTTPError.
Callers translate that:
-
POST /entrust/sessionspasses an Onfido 4xx through with the parsed upstream body underentrust_error, and maps 5xx or connection errors to502. -
The aftermath task lets download failures propagate so the SWF activity fails and retries; step hydration is the one best-effort exception (the run summary is archived without
tasks).
Tests
development/unit_tests/components_/entrust/test_client.py.
The full vendor contract is available as an attachment: Onfido Public API v3.6 spec.