veryfi-lens-wasm 1.0.1 → 1.0.4
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 +10 -7
- package/index.d.ts +6 -0
- package/package.json +7 -6
- package/setup.mjs +42 -0
- package/setup.sh +3 -0
- package/src/lens-ws.js +0 -0
- package/src/wasm/simd/simdBeauty.js +0 -5286
- package/src/wasm/simd/simdBeauty.worker.js +0 -124
- package/src/wasm/wasm2.js +0 -208
- package/src/wasm/wasm3.js +0 -477
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
1.
|
|
2
|
-
2.
|
|
3
|
-
3. Add id='
|
|
4
|
-
4.
|
|
1
|
+
1. run `npm exec veryfi-lens-wasm-setup`, provide it with path to directory where you will serve wasm files for next.js public/wasm
|
|
2
|
+
2. Import package
|
|
3
|
+
3. Add id='veryfi-container' to container you want lens to appear
|
|
4
|
+
4. Add id='blur-detector' to edit screen if you want to use it's logic
|
|
5
|
+
5. Create function
|
|
5
6
|
```
|
|
6
7
|
const startLens = async () => {
|
|
7
|
-
veryfiLens.setUserAgent(navigator.userAgent);
|
|
8
|
+
veryfiLens.setUserAgent(navigator.userAgent); // if package loads before navigator
|
|
8
9
|
veryfiLens.init(sessionToken);
|
|
9
10
|
veryfiLens.startCamera();
|
|
10
11
|
intervalRef = window.setInterval(() => {
|
|
@@ -13,9 +14,11 @@ const startLens = async () => {
|
|
|
13
14
|
};
|
|
14
15
|
```
|
|
15
16
|
5. Call it
|
|
16
|
-
6. Use
|
|
17
|
+
6. Use the following function on capture button
|
|
17
18
|
```
|
|
18
19
|
const takePhoto = () => {
|
|
19
|
-
veryfiLens.capture(setImage, setIsEditing);
|
|
20
|
+
veryfiLens.capture(setImage, setIsEditing);
|
|
21
|
+
// setImage is cropped image setter (for example react's useState hook) returns string
|
|
22
|
+
// setIsEditing returns boolean (we use it to change screens)
|
|
20
23
|
};
|
|
21
24
|
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare module 'veryfi-lens-sdk'
|
|
2
|
+
declare module 'veryfi-lens-sdk/veryfi-lens'
|
|
3
|
+
declare module 'veryfi-lens-sdk/device-uuid'
|
|
4
|
+
declare module 'veryfi-lens-sdk/fingerprint-id'
|
|
5
|
+
declare module 'veryfy-lens-sdk/blur-detector'
|
|
6
|
+
declare module 'veryfy-lens-sdk/lens-wasm'
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfi-lens-wasm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Lens For Web SDK with WASM",
|
|
5
5
|
"main": "veryfi-lens.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"setup": "node setup.mjs"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"veryfi-lens-wasm-setup": "./setup.sh"
|
|
8
11
|
},
|
|
9
12
|
"author": "",
|
|
10
13
|
"license": "ISC",
|
|
11
14
|
"dependencies": {
|
|
12
15
|
"fs-extra": "^11.1.1",
|
|
16
|
+
"inquirer": "^8.0.0",
|
|
13
17
|
"path": "^0.12.7"
|
|
14
|
-
}
|
|
15
|
-
"files": [
|
|
16
|
-
"src/*"
|
|
17
|
-
]
|
|
18
|
+
}
|
|
18
19
|
}
|
package/setup.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
|
|
5
|
+
const defaultPath = path.join(process.cwd(), './public/wasm');
|
|
6
|
+
|
|
7
|
+
const questions = [
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'targetPath',
|
|
11
|
+
message: `Enter the path where you want to copy the WASM files (They have to be accessible to the browser with relative path) (current: ${defaultPath}):`,
|
|
12
|
+
default: defaultPath
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'confirm',
|
|
16
|
+
name: 'confirmCopy',
|
|
17
|
+
message: 'Do you want to proceed with the copying?',
|
|
18
|
+
default: true
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
inquirer.prompt(questions)
|
|
23
|
+
.then((answers) => {
|
|
24
|
+
if (answers.confirmCopy) {
|
|
25
|
+
const sourcePath = path.join(process.cwd(), 'node_modules/veryfi-lens-wasm/src/wasm');
|
|
26
|
+
const targetPath = path.isAbsolute(answers.targetPath)
|
|
27
|
+
? answers.targetPath
|
|
28
|
+
: path.join(process.cwd(), answers.targetPath);
|
|
29
|
+
|
|
30
|
+
fs.copySync(sourcePath, targetPath, { overwrite: true });
|
|
31
|
+
console.log('WASM files copied successfully.');
|
|
32
|
+
} else {
|
|
33
|
+
console.log('WASM files were not copied.');
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.catch((error) => {
|
|
37
|
+
if (error.isTtyError) {
|
|
38
|
+
console.error('Prompt couldn\'t be rendered in the current environment.');
|
|
39
|
+
} else {
|
|
40
|
+
console.error('An error occurred:', error);
|
|
41
|
+
}
|
|
42
|
+
});
|
package/setup.sh
ADDED
package/src/lens-ws.js
DELETED
|
File without changes
|