Skip to main content

KycSDK

The KycSDK class provides headless methods for managing a KYC session.

Constructor

new KycSDK(config: KycConfig)

Parameters

ParameterTypeDescription
configKycConfigConfiguration object for the headless SDK.

Methods

init(sessionIdOrUserId?: string): Promise<void>

Bootstraps the KYC session with the backend.

  • If a sessionId is passed, it attempts to resume an existing session.
  • If a userId is passed, it creates a new session for that user.

start(): void

Begins the execution of the workflow steps. Throws an error if called before init().

on(event: string, callback: Callback): void

Registers an event listener for state changes and step progress.

sendOtp(contact: { email?: string; phoneNumber?: string }): Promise<any>

Triggers an OTP to be sent to the specified contact.

submitOtp(otp: string): Promise<any>

Validates an OTP submitted by the user.

uploadDocument(type: string, subtype: string, base64: string): Promise<any>

Uploads a document (like an ID card) encoded as a base64 string for extraction and validation.

initiateLiveness(contact: { referencePhotoBase64?: string }): Promise<any>

Initiates a liveness check session against a reference photo.

startLiveness(): Promise<any>

Begins the active liveness capture session.

screenCompliance(firstName: string, lastName: string): Promise<any>

Runs a PEP/AML compliance screening against the provided names.

verifyBvn(data: BVNData): Promise<any>

Verifies a Nigerian BVN against the provided demographic details.

destroy(): void

Cleans up the internal state machine and event listeners.