For the complete documentation index, see llms.txt. This page is also available as Markdown.

checkCapabilities

Checks whether the device meets the Minimum requirements before mounting the SDK.

Details

Check whether the browser and device meet the Minimum requirements to run the Biometric flow, before mounting <facephi-sdk-provider> in the DOM.

Syntax

import { checkCapabilities } from '@facephi/sdk-web-wc/capabilities.mjs';

const { camera, wasm, browser } = await checkCapabilities();

Description

Function exported by @facephi/sdk-web-wc in the subpath /capabilities.mjs. It allows you to decide, before starting the session, whether the user can continue on this device or whether it is better to route them to another device or another business path.

Does not require apiKey, does not validate the License and does not download resources. The entry point has no dependencies, so it does not pull in the engine, languages, or UI components.

Replaces the method checkCapabilities() of the Legacy widgets.

Return value

Promise<WidgetCheckCapabilities>, with three booleans:

Property
Meaning

camera

At least one video input device has been detected.

wasm

WebAssembly is available and can compile and instantiate a module.

browser

The browser APIs required by the widgets are present.

Considerations

  • The check does not call getUserMedia, so it does not show any camera permission dialog. It can be invoked when the page loads with no friction for the user.

  • As a trade-off, browsers that hide devices until permission is granted (Safari and others based on WebKit) return camera: false on a perfectly valid device.

  • In an insecure origin (http other than localhost), navigator.mediaDevices does not exist and camera will always be false.

  • The check does not apply the camera anti-fraud filter that the widgets do when they mount. A virtual camera passes this check and is still rejected later.

wasm and browser are hard conditions: if any of them is false, the Biometric flow cannot run in that browser.


Example

Use from CDN, without bundler

Direct use of the Widget, without SDK

The Widget packages expose the same function in their own subpath, available from @facephi/[email protected] and @facephi/[email protected]. In earlier versions the subpath does not exist and the import fails with ERR_MODULE_NOT_FOUND.

Last updated