Installation
There are 2 ways of using Lens For Web SDK:
- Web Assembly (WASM) - Recommended
- Fast
- Accurate
- Frames are processed on a client
- Requires extra steps in installation and usage
- Web Socket
- Easy to install and use
- Frames are sent via socket to our endpoint and processed there
info
WASM Lens utilize SharedArrayBuffer, which requires cross-origin isolation.
To enable it your top level document must include following headers:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Please read more here
Prerequisites
- Install Node.js https://nodejs.org
- If you don’t have an existing project - create one
- Download veryfi-lens-wasm package
- Directly from https://github.com/veryfi/veryfi-lens-wasm into project's folder if using vanilla JS without bundlers
- Run
npm instal veryfi-lens-wasm
if using frameworks/bundlers
- Vanilla JS
- Frameworks
Please check out our demo example for Vanilla JS on https://github.com/veryfi/veryfi-lens-demo-vanillajs
- If you dont have it - create
index.html
file, add basic layout - Copy
wasm
directory from SDK folder to the root of your project (or next toindex.html
if it's not on the root level) - Add
<div id='veryfi-container'></div>
(might require to haveheight: 100%
andoverflow: hidden
depending on your layout)
info
If you are not using bundlers, you might get ua-parser error. To fix it add export default UAParser
to ua-parser.cjs
file in sdk/wasm
folder.
- Copy
wasm
folder from SDK and place next to yourindex.html
or topublic
orassets
, depending on your framework and settings (it should be accesible via relative path, for example on localhost:3000/wasm)- Manually from
node_modules/veryfi-lens-wasm
- Run
npm exec veryfi-lens-wasm-setup
and follow instructions
- Manually from
- Add
<div id='veryfi-container'></div>
to one of pages/components