veryfi-lens-wasm 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -18
- package/index.d.ts +7 -6
- package/package.json +1 -1
- package/src/{opencv.js → wasm/opencv.js} +10324 -45
- package/src/wasm/wasm.js +4 -59
- package/veryfi-lens.js +4 -1
package/README.md
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
|
|
2
|
+
***You can skip first step and copy wasm folder from package directory manually if you want to do so*.**
|
|
3
|
+
1. run `npm exec veryfi-lens-wasm-setup` and provide it with path to directory where you will serve wasm files, **they have to be accessible from your project's entry point with relative paths**
|
|
4
|
+
(for next.js `public/wasm`, for vue+vite `dist/wasm`)
|
|
5
|
+
2. Import package `import VeryfiLens from 'veryfi-lens-wasm'`
|
|
6
|
+
3. Add id='veryfi-container' to container you want lens to appear
|
|
7
|
+
4. Add id='blur-detector' to edit screen if you want to use it's logic
|
|
8
|
+
5. Create function
|
|
6
9
|
```
|
|
7
10
|
const startLens = async () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
veryfiLens.setUserAgent(navigator.userAgent); // if package loads before navigator
|
|
12
|
+
veryfiLens.init(sessionToken);
|
|
13
|
+
veryfiLens.startCamera();
|
|
14
|
+
intervalRef = window.setInterval(() => {
|
|
15
|
+
setSocketStatusColor(veryfiLens.getSocketStatusColor());
|
|
16
|
+
}, INTERVAL);
|
|
17
|
+
};
|
|
15
18
|
```
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
7. Call it
|
|
20
|
+
8. Use the following function on capture button
|
|
18
21
|
```
|
|
19
22
|
const takePhoto = () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
veryfiLens.capture(setImage, setIsEditing);
|
|
24
|
+
// setImage is cropped image setter(for example react's useState hook), returns string
|
|
25
|
+
// setIsEditing returns `true` if image was succesfully cropped (we use it to change screens)
|
|
26
|
+
};
|
|
27
|
+
|
|
24
28
|
```
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
declare module 'veryfi-lens-
|
|
2
|
-
declare module 'veryfi-lens-
|
|
3
|
-
declare module 'veryfi-lens-
|
|
4
|
-
declare module 'veryfi-lens-
|
|
5
|
-
declare module 'veryfy-lens-
|
|
6
|
-
declare module 'veryfy-lens-
|
|
1
|
+
declare module 'veryfi-lens-wasm'
|
|
2
|
+
declare module 'veryfi-lens-wasm/veryfi-lens'
|
|
3
|
+
declare module 'veryfi-lens-wasm/device-uuid'
|
|
4
|
+
declare module 'veryfi-lens-wasm/fingerprint-id'
|
|
5
|
+
declare module 'veryfy-lens-wasm/blur-detector'
|
|
6
|
+
declare module 'veryfy-lens-wasm/lens-wasm'
|
|
7
|
+
declare module 'veryfy-lens-wasm/opencv'
|