/** Challenge request payload used during shortcode bootstrap. */ export interface ChallengeRequest { shortcode: string; codeChallenge: string; codeChallengeMethod?: "S256"; } /** Challenge response payload returned during shortcode bootstrap. */ export interface ChallengeResponse { authorizationCode: string; } /** Authorization request payload used after challenge exchange. */ export interface AuthorizeRequest { codeVerifier: string; platform: string; deviceModel: string; deviceManufacturer: string; deviceSoftware: string; language: string; sdkVersion: string; languageCode: string; } /** Authorization response payload returned by the authorize endpoint. */ export interface AuthorizeResponse { accessToken: string; } /** Session-configuration request payload sent after authorization. */ export interface SessionConfigurationRequest { version: string; platform: string; locale: string; source: string; deviceModel: string; deviceManufacturer: string; deviceSoftware: string; security: string[]; securityFeedback: string; appVersion: string; appDomain: string; } /** Processor-level device-intelligence configuration entry. */ export interface DeviceProcessorConfigurationResponse { intelligenceEnabled?: boolean; behaviorEnabled?: boolean; credentialId?: string | null; environment?: string | null; } /** Desktop-to-mobile timing configuration returned by session configuration. */ export interface DesktopToMobileConfiguration { desktopMetadataStreamTimeoutMs: number; metadataStatusRequestMaxRetries: number; desktopCompleteAutoContinueTimeoutMs: number; qrCodeRefreshIntervalMs: number; } /** Device configuration returned by Trulioo session configuration. */ export interface DeviceConfiguration { intelligenceEnabled: boolean; credentialId: string; environment: string; behaviorEnabled: boolean; flow?: string; enabled?: boolean; } /** @deprecated Use `DeviceConfiguration`. */ export type DeviceIntelligenceConfiguration = DeviceConfiguration; /** Session configuration returned after shortcode initialization succeeds. */ export interface SessionConfigurationResponse { transactionId: string; source: string; intelligenceEnabled?: boolean; behaviorEnabled?: boolean; credentialId?: string | null; environment?: string | null; processors?: DeviceProcessorConfigurationResponse[]; transactionBound?: boolean; redirectUrl?: string; desktopToMobile?: DesktopToMobileConfiguration; deviceConfiguration?: DeviceConfiguration; /** @deprecated Use `deviceConfiguration`. */ deviceIntelligence?: DeviceConfiguration; } /** Request used to seed a Trulioo device event from the runtime encrypted payload bundle. */ export interface DeviceSeedRequest { eventId: string; source: string; devicePlatform: string; deviceData: string; deviceIV: string; deviceKey: string; } /** Normalized encrypted payload bundle produced by the device-intelligence runtime. */ export interface DevicePayloadSubmission { devicePlatform?: string; deviceData: string; deviceIV: string; deviceKey: string; } /** Allowed device-reference entry types accepted by Trulioo device-reference requests. */ export type DeviceReferenceType = "FIRST_NAME" | "LAST_NAME" | "DATE_OF_BIRTH" | "PHONE_NUMBER" | "OPERATING_SYSTEM" | "OS_BROWSER" | "LANGUAGE" | "SCREEN_SIZE" | "BATTERY_LEVEL" | "TIMEZONE" | "ACCESSIBILITY_MODE" | "FIRST_SEEN" | "OTHER"; /** One entry in a device-reference payload submitted to Trulioo. */ export interface DeviceReferenceEntry { type: DeviceReferenceType; value: string; customKey?: string; } /** Additional caller-provided subject fields beyond the built-in subject keys. */ export interface DeviceReferenceOtherField { customKey: string; value: string; } /** * Caller-provided subject reference data for device intelligence. * * The SDK owns and generates basic information such as operating system, * language, screen size, timezone, and battery level internally. */ export interface DeviceSubjectReference { firstName?: string; lastName?: string; dateOfBirth?: string; phoneNumber?: string; other?: DeviceReferenceOtherField[]; } /** Device-reference payload sent to Trulioo. */ export interface DeviceReferencePayload { subject?: DeviceReferenceEntry[]; basicInformation?: DeviceReferenceEntry[]; } /** Device-reference request wrapper sent to Trulioo. */ export interface DeviceReferenceRequest { reference: DeviceReferencePayload; } /** Allowed Trulioo device-event processing states. */ export type DeviceEventStatus = "QUEUED" | "RUNNING" | "COMPLETED" | "FAILED" | "queued" | "running" | "completed" | "failed"; /** Allowed normalized device risk bands returned by Trulioo. */ export type DeviceRiskBand = "NOT_RUN" | "RUN" | "SUSPICIOUS" | "HIGH_RISK"; /** Device evaluation summary returned by Trulioo device processing. */ export interface DeviceEvaluation { riskScore?: number; riskLevel: string; riskBand: DeviceRiskBand; riskReasons: string[]; complete?: boolean; } /** Device association summary returned by Trulioo device processing. */ export interface DeviceAssociationSummary { fingerprint: string; transactionIds: string[]; eventCount?: number; deviceCount?: number; } /** Normalized device result returned by the Trulioo device-intelligence flow. */ export interface DeviceSeedResponse { transactionId: string; eventId: string; requestEventId?: string; processor?: string; schemaFamily: "DEVICE_INTELLIGENCE"; platform: "ANDROID" | "IOS" | "WEB" | "UNKNOWN"; device: Record; insights?: DeviceInsightResponse[]; evaluation: DeviceEvaluation; association: DeviceAssociationSummary; } /** Allowed normalized device insight states. */ export type DeviceInsightState = "Risk" | "No Risk" | "Not Run"; /** One normalized device insight row. */ export interface DeviceInsightResponse { signal: string; category: string; label: string; result: string; insight: string; state: DeviceInsightState; } /** Provider-specific status entry for a device event. */ export interface DeviceEventProviderStatus { provider: string; state: string; detail: string; } /** Trulioo device-event state returned while polling or at terminal completion. */ export interface DeviceEventResponse { eventId: string; processor?: string; status: DeviceEventStatus; failureReason?: string | null; device?: Record | null; insights?: DeviceInsightResponse[]; evaluation?: DeviceEvaluation | null; association?: DeviceAssociationSummary | null; transactionId?: string; source?: string; acceptedAtEpochMs?: number; updatedAtEpochMs?: number; processingDeadlineAtEpochMs?: number; pollPath?: RelativeEndpoint; providers?: DeviceEventProviderStatus[]; } /** Authorized request options for a Trulioo session-scoped HTTP request. */ export interface AuthRequestOptions { accessToken?: string; init?: RequestInit; maxRetries?: number; } /** Relative API path accepted by the low-level Trulioo web client. */ export type RelativeEndpoint = `/${string}`; /** Authorized POST endpoint definition used by `TruliooClient`. */ export interface AuthorizedPostEndpoint { path: RelativeEndpoint; sendBody?: boolean; } /** Authorized GET endpoint definition used by `TruliooClient`. */ export interface AuthorizedGetEndpoint { path: RelativeEndpoint; } /** Authorized binary-upload endpoint definition used by `TruliooClient`. */ export interface AuthorizedUploadEndpoint { path: RelativeEndpoint; } /** Authorized upload request options for a Trulioo session-scoped binary request. */ export interface AuthUploadRequestOptions extends AuthRequestOptions { headers?: HeadersInit; timeoutMs?: number; } /** Endpoint map used by the low-level Trulioo web client. */ export interface AuthEndpoints { challenge: RelativeEndpoint; authorize: RelativeEndpoint; sessionConfiguration: RelativeEndpoint; sdkSeed: RelativeEndpoint; deviceReference: RelativeEndpoint; deviceEventBasePath: RelativeEndpoint; } /** Options for constructing a low-level `TruliooClient`. */ export interface AuthClientOptions { baseUrl: string; fetch?: typeof fetch; defaultHeaders?: HeadersInit; endpoints?: Partial; allowedEndpoints?: RelativeEndpoint[]; }