export interface EidVerificationConfig { transactionId: string; countryCode: string; /** Optional — pin a specific Trinsic provider ID. Omit for automatic server-side selection. */ providerIdentifier?: string; callbackOrigin?: string; } /** Terminal result — no PII. For PII, call GET /eid/result via the session client directly. */ export interface EidVerificationResult { transactionId: string; outcome: EidOutcome; match: boolean; } export type EidOutcome = "SUCCESS" | "FAILED" | "TIMEOUT" | "ERROR" | "CANCELLED"; export interface EidPrepareResult { providerName: string; launchMethod: EidLaunchMethod; estimatedDurationSeconds: number; ready: boolean; /** Step content TTL in seconds. Non-null when provider URL expires (e.g. Yoti 180s). */ stepContentTtlSeconds?: number; } export type EidLaunchMethod = "LAUNCH_BROWSER" | "DEEPLINK_TO_MOBILE" | "SHOW_CONTENT" | "PERFORM_NATIVE_CHALLENGE" | "NONE"; export type EidState = "IDLE" | "PREPARING" | "READY" | "LAUNCHING" | "AWAITING_AUTH" | "PROCESSING" | "COMPLETED" | "FAILED"; /** A licensed Trinsic identity provider available for EID verification. */ export interface EidProviderInfo { id: string; name: string; countries: string[]; health: string; } export interface EidProvidersListResponse { providers: EidProviderInfo[]; } /** POST /transactions/eid/init — transactionId is in the JWT; not in the request body. */ export interface EidInitRequest { countryCode: string; providerIdentifier?: string; /** * Client-generated UUID. The server appends it as `?ckey=` to the redirect URL * so the hosted callback page can open `BroadcastChannel("eid_callback_")` and * signal back to the SDK in same-origin browser contexts. */ channelKey?: string; } /** POST /transactions/eid/init response — server contract. */ export interface EidInitResponse { transactionId: string; providerUrl: string; providerName: string; providerIdentifier: string; timeoutSeconds: number; /** Trinsic session ID at init time — SDK fallback if it can't parse from redirect URL. */ sessionId?: string; /** * How the provider should be launched. Null/undefined = LAUNCH_BROWSER (hosted mode default). * Direct mode may return: "LaunchBrowser", "DeeplinkToMobile", "ShowContent", "None". */ launchMethod?: string; /** * How results are collected. Null/undefined = CaptureRedirect (hosted mode default). * "PollResult" means the server already dispatched processing — SDK just polls for result. */ resultCollectionMethod?: string; /** * Step content TTL in seconds. Non-null when the provider URL/deep link expires * (e.g. Yoti deep links expire after 180s). SDK should re-prepare before expiry. */ stepContentTtlSeconds?: number; } export type EidResultCollectionMethod = "CaptureRedirect" | "PollResult"; /** POST /transactions/eid/refresh-step response — refreshed provider URL and TTL. */ export interface EidStepRefreshResponse { providerUrl: string; launchMethod: string; stepContentTtlSeconds?: number; } /** POST /transactions/eid/exchange — Trinsic-only contract. */ export interface EidExchangeRequest { sessionId?: string; resultsAccessKey?: string; state: string; error?: { errorCode: string; errorMessage?: string; }; } export interface EidExchangeResponse { status: string; transactionId: string; } /** Poll response — status only (MR 489). Call /eid/result after terminal status for outcome/match. */ export interface EidPollResponse { transactionId: string; status: string; } export type EidRedirectResult = { type: "trinsic_success"; sessionId: string; resultsAccessKey: string; state: string; } | { type: "provider_error"; error: string; description?: string; state: string; } | { type: "cancelled"; } | { type: "popup_blocked"; } | { type: "timeout"; }; export interface EidCallbackMessage { type: "eid_callback"; sessionId?: string; resultsAccessKey?: string; state: string; error?: string; errorDescription?: string; nonce?: string; }