@microblink/docver-in-browser-sdk
v2.0.2
Published
This package is a wrapper around the [`blinkid-in-browser-sdk`](https://www.npmjs.com/package/@microblink/blinkid-in-browser-sdk).
Downloads
1
Keywords
Readme
This package is a wrapper around the blinkid-in-browser-sdk
.
Along with providing the same exports as blinkid-in-browser-sdk
, it also exposes the endpoint API types, and a few helpers for easier usage with Document Verification:
The initSDK
function:
An optional, alternative way to initialize the BlinkID scanning process.
It provides an easy way to initialize all the necessary core objects (WasmSDK
, BlinkIdCombinedRecognizer
, RecognizerRunner
and VideoRecognizer
), preconfigured to capture images suitable for sending to a Document Verification endpoint. This allows for easier scoping and lifecycle management as well.
Usage:
// initialization using a video element and a licence key
const sdkCore = initSDK(videoElement, { licenceKey: "LICENCE_KEY", // ...other SDK options });
// the rest is the same as on BlinkID
const result = await sdkCore.videoRecognizer.recognize();
You can see this approach in the apps/example-sdk-only
and apps/example-solidjs
examples on the GitHub repository.
The imageDataToBase64
function:
Converts the BlinkID captured images which are of the type imageData
to a base64 string required by the Document Verification API endpoint.
Usage:
const blinkIdResult: BlinkIdCombinedRecognizerResult = {
/*...*/
};
const request: DocVerRequest = {
imageFront: {
imageBase64: imageDataToBase64(blinkIdResult.frontCameraFrame.frame),
},
imageBack: {
imageBase64: imageDataToBase64(blinkIdResult.backCameraFrame.frame),
},
// ... other properties on the request
};
Alongside these two helper functions it also re-exports the DocVerResponse
and DocVerRequest
from @microblink/docver-in-browser-api
so that the user needs to only install a single package.