The Client type
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
| Field | Type | Default | Notes |
|---|---|---|---|
BaseURL | string (required) | n/a | https://api.drukverify.com in production |
APIKey | string (required) | n/a | dv_sk_live_… or dv_sk_test_… |
Timeout | time.Duration | 30s | Per-request HTTP timeout. Set at least 90s for chained fraud plus OCR. |
HTTPClient | *http.Client | new pooled client | Override for tests / custom transport |
Headers | map[string]string | nil | Extra static headers on every request |
APIVersion | string | SDK constant | Pin 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(),
})