Skip to main content

The Client type

Status

The Go SDK is source-available on request and is not yet released: v2 has no tagged version and is not published to a module proxy, so go get against the module path below will not resolve until it is. It covers OCR, face, liveness and sessions; fraud detection and verification sessions are not in it. Server-side integrations that need those today should call the REST API directly or use the JavaScript SDK.

Constructed once per process, shared across all goroutines. Safe for concurrent use.

client, err := ekyc.NewClient(ekyc.Config{
BaseURL: "https://api.drukverify.com",
APIKey: os.Getenv("EKYC_SECRET_KEY"),
Timeout: 30 * time.Second,
})

Config fields​

FieldTypeDefaultNotes
BaseURLstring (required)n/ahttps://api.drukverify.com in production
APIKeystring (required)n/adv_sk_live_… or dv_sk_test_…
Timeouttime.Duration30sPer-request HTTP timeout. Set at least 90s for chained fraud plus OCR.
HTTPClient*http.Clientnew pooled clientOverride for tests / custom transport
Headersmap[string]stringnilExtra static headers on every request
APIVersionstringSDK constantPin a specific API version

Namespaces​

Client exposes four field namespaces, each constructed eagerly in NewClient:

client.OCR // *OCRClient
client.Face // *FaceClient
client.Liveness // *LivenessClient
client.Sessions // *SessionsClient

Mode parsing​

client.Mode is "live" or "test", parsed from the API key prefix. Useful for guardrails:

if isProduction && client.Mode == "test" {
log.Fatal("refusing to start with test key in production")
}

Concurrency​

*Client is safe for concurrent use. Construct once in your main, share via dependency injection. The underlying *http.Client is connection-pooled, so there is no need to construct one per request.

Test harness​

For unit tests, point BaseURL at a httptest.Server:

srv := httptest.NewServer(/* handler */)
defer srv.Close()

client, _ := ekyc.NewClient(ekyc.Config{
BaseURL: srv.URL,
APIKey: "dv_sk_test_x",
HTTPClient: srv.Client(),
})