Repository navigation
Liveness Support Checker Example
Target version: 7.0+
Below is how to check that a device is capable of running a transaction on a given webpage:
import { iProovSupport } from "@iproov/web-sdk/iProovSupport.js"
const checker = new iProovSupport(console)
const { supported, granted, tests, flags } = await checker.check({ emit: false })ℹ️ There is no assurance-type option. Motion permission has been required for both Dynamic and Express since v5.0.0, so the same checks run either way. An
assuranceTypevalue passed to the constructor is accepted but ignored — earlier versions of this page showed one, and it never had any effect.
Here is a breakdown of the results:
-
supportedis a boolean value indicating whether this device can run a transaction on the webpage -
grantedis a boolean or null value indicatingtrueif permission was granted,falseif permission was denied, ornullif permission was not requested -
testsis an object of test results mapping to their results. Ifsupportedorgrantedis false, then the relevant support test that failed the check will be set tofalseinsidetests -
flagsdescribes how the page is framed rather than passing or failing anything:in_iframe,cross_origin_iframe, andrequires_iframe_bridgewhen the claim will have to be handed to a top-level tab
The tests keys are videoInput, wasm, userMedia, frontCamera, fullscreen, browser, gyro and localStorage. Each is null if unchecked, true if supported and false if not.
To pre-warm permissions, instead of check, you will need to run:
const { supported, granted } = await checker.checkWithPermission()If granted === false, then either the camera or device motion permissions will have been denied by the user.