import type { AgentScorecard, AgentStats, GetAgentScorecardOptions, GetAgentScorecardParams, SigningSession, SigningEvidenceUploadParams, SigningEvidenceUploadResult, SigningReceipt, SigningSubmissionCapture, AgentSDKConfig, AgentProfile, AbandonWorkflowParams, AbandonWorkflowResult, ChangePasswordParams, ClientTimingPayload, CreateWorkflowParams, CreateWorkflowResult, DocumentMetadata, FlowContext, GraduateWorkflowParams, GraduateWorkflowResult, LoginChallengeParams, LoginChallengeResult, LoginParams, LoginRequestOptions, LoginResult, LoginWithProjectResolutionOptions, LoginWithProjectResolutionResult, LogoutParams, PreSubmissionCheckOptions, PushTokenRegistration, PreSubmissionCheckResult, RegisterPushTokenParams, ReissueWorkflowTokenResult, RefreshResult, SubmitFlowOptions, UnregisterPushTokenParams, UnregisterPushTokenResult, UploadDocumentInput, UploadDocumentOptions, UploadResult, ListWorkflowsParams, WorkflowDetail, WorkflowSummaryPage, WorkflowStatus, WorkflowSummary } from './types.js'; /** * Ballerine Agent SDK — typed HTTP client for agent-assisted KYC endpoints. * * Works in any JS runtime (Node, browser, React Native) via configurable fetch. * * @example * ```typescript * import { AgentSDK } from '@mikashboks/react-native-agent-sdk'; * * const sdk = new AgentSDK({ * baseUrl: 'https://api.verify.example.com/api/v1', * projectId: 'proj_123', * }); * * const { accessToken, agent } = await sdk.login({ phone: '23276123456', password: 'temp123' }); * const { workflowId, workflowToken } = await sdk.createWorkflow({ * customerInfo: { firstName: 'Aminata', lastName: 'Kamara', phone: '23276123456' }, * workflowDefinitionId: 'kyc_onboarding_sierra_leone', * }); * ``` */ export declare class AgentSDK { private readonly http; private accessToken; private refreshTokenValue; private readonly onTokenRefresh?; private refreshInFlight; constructor(config: AgentSDKConfig); /** Set tokens directly (e.g., restored from secure storage on app launch). */ setTokens(accessToken: string, refreshToken: string): void; /** Get the current access token (for external inspection). */ getAccessToken(): string | null; /** Get the current refresh token (for external persistence). */ getRefreshToken(): string | null; /** Clear all tokens (logout). */ clearTokens(): void; /** Create a short-lived attestation challenge for password login. */ createLoginChallenge(params: LoginChallengeParams, options?: LoginRequestOptions): Promise; /** * Login with phone + password. On success, stores tokens internally. * If `mustChangePassword` is true, the app should redirect to change-password. */ login(params: LoginParams): Promise; /** * Login without requiring a preselected project. The backend either returns * tokens for the single matching project or credentialed project choices. */ loginWithProjectResolution(params: LoginParams, options?: LoginWithProjectResolutionOptions): Promise; /** * Refresh the access token using the stored refresh token. * Automatically rotates both tokens. */ refresh(refreshToken?: string): Promise; /** Change password. Requires the current password. */ changePassword(params: ChangePasswordParams): Promise; /** * Revoke the current agent session. * Best-effort: clears local tokens even if the backend request fails. */ logout(params?: LogoutParams): Promise; /** Register the current device for agent push notifications. */ registerPushToken(params: RegisterPushTokenParams): Promise; /** Unregister the current device from agent push notifications. */ unregisterPushToken(params: UnregisterPushTokenParams): Promise; /** Get the authenticated agent's profile and tenant config. */ getProfile(): Promise; /** * Create a new KYC workflow for a customer. * Returns a workflowToken used for all subsequent collection-flow calls. */ createWorkflow(params: CreateWorkflowParams): Promise; /** Start the configured full-KYC graduation workflow from an approved provisional result. */ graduateWorkflow(workflowId: string, params?: GraduateWorkflowParams): Promise; /** Reissue a fresh collection-flow token for an existing active workflow. */ reissueWorkflowToken(workflowId: string): Promise; /** Start a narrowly scoped authorization session, including completed KYC cases. */ createSigningSession(workflowId: string): Promise; /** Signing evidence has its own append-only storage; never use replaceable ID document slots. */ uploadSigningEvidence(workflowId: string, file: UploadDocumentInput, params: SigningEvidenceUploadParams, options?: UploadDocumentOptions): Promise; /** Authorize the current application without restarting an already completed KYC. */ finalizeSigningApplication(workflowId: string, capture: SigningSubmissionCapture): Promise; getSigningReceipts(workflowId: string): Promise; /** Release an unused pre-created workflow before creating a replacement. */ abandonWorkflow(params: AbandonWorkflowParams): Promise; /** List the agent's workflows (PII-redacted after submission). */ listWorkflows(params?: ListWorkflowsParams): Promise; /** List the agent's workflows with cursor pagination metadata. */ listWorkflowsPage(params?: ListWorkflowsParams): Promise; /** Get the verification status of a specific workflow. */ getWorkflowStatus(workflowId: string): Promise; /** Get agent-safe details for a specific workflow. */ getWorkflowDetails(workflowId: string): Promise; /** Get aggregated counts for the authenticated agent dashboard. */ getWorkflowStats(): Promise; /** * Get the signed-in agent's own quality figures for the last 7, 30 or 90 * days (default 30), with their branch average. Same auth, project header * and token refresh as getWorkflowStats(). An older server without the * endpoint rejects with NotFoundError; a body that does not match * AgentScorecard rejects with AgentSDKError (responseBody holds the body). */ getAgentScorecard(params?: GetAgentScorecardParams, options?: GetAgentScorecardOptions): Promise; /** * Upload a document image to the workflow's collection flow. * * @param workflowToken - The token returned from createWorkflow() * @param file - File/Blob or React Native upload part to upload (image) * @param metadata - Document type, side, geolocation */ uploadDocument(workflowToken: string, file: UploadDocumentInput, metadata: DocumentMetadata, options?: UploadDocumentOptions): Promise; /** * Sync the collection flow context (document selections, form data, etc.). */ syncContext(workflowToken: string, context: Record, options?: { expectedApplicationRevision: string; }): Promise; /** * Submit the collection flow (triggers verification pipeline). */ submitFlow(workflowToken: string, context?: Record, options?: SubmitFlowOptions): Promise; /** * Run the backend pre-submission gate before final submission. */ preSubmissionCheck(workflowToken: string, context: Record, options?: PreSubmissionCheckOptions): Promise; /** * Record client-side collection-flow timing telemetry. */ recordClientTiming(workflowToken: string, payload: ClientTimingPayload): Promise; /** * Get the current collection flow context. */ getFlowContext(workflowToken: string): Promise; } /** * Runtime check of the agent scorecard contract. Extra fields are allowed. * Counts are whole numbers from 0; branch rates are 0..1 or null. */ export declare function isAgentScorecard(value: unknown): value is AgentScorecard; //# sourceMappingURL=agent-sdk.d.ts.map