veryfi-lens-wasm 1.0.7 → 1.0.9

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.
Files changed (3) hide show
  1. package/README.md +55 -2
  2. package/package.json +2 -2
  3. package/setup.mjs +4 -3
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  ***You can skip first step and copy wasm folder from package directory manually if you want to do so*.**
3
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`)
4
+ (for next.js `public/wasm`)
5
5
  2. Import package `import VeryfiLens from 'veryfi-lens-wasm'`
6
6
  3. Add id='veryfi-container' to container you want lens to appear
7
7
  4. Add id='blur-detector' to edit screen if you want to use it's logic
@@ -25,4 +25,57 @@ veryfiLens.capture(setImage, setIsEditing);
25
25
  // setIsEditing returns `true` if image was succesfully cropped (we use it to change screens)
26
26
  };
27
27
 
28
- ```
28
+ ```
29
+
30
+ To use wasm in dev environment, you have to use https and ssl
31
+ And also add following to next.config.js:
32
+ ```
33
+ async headers() {
34
+ return [
35
+ {
36
+ source: '/(.*)',
37
+ headers: [
38
+ {
39
+ key: 'Cross-Origin-Opener-Policy',
40
+ value: 'same-origin'
41
+ },
42
+ {
43
+ key: 'Cross-Origin-Embedder-Policy',
44
+ value: 'require-corp'
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ },
50
+ experimental: {
51
+ urlImports: ["https://unpkg.com/wasm-feature-detect/dist/umd/index.js"],
52
+ },
53
+ webpack: (config) => {
54
+ config.resolve.fallback = { fs: false, path:false, "crypto": false };
55
+ return config;
56
+ },
57
+ ```
58
+ This to vite.config.js (if using vite and vue)
59
+ ```
60
+ server: {
61
+ https: {
62
+ key: fs.readFileSync(path.resolve(__dirname, 'localhost-key.pem')), //path to your local serificate
63
+ cert: fs.readFileSync(path.resolve(__dirname, 'localhost.pem')),},
64
+ proxy: {},
65
+ hmr: {
66
+ protocol: 'wss',
67
+ timeout: 30000,
68
+ },
69
+ watch: {},
70
+ open: true,
71
+ host: true,
72
+ strictPort: false,
73
+ force: false,
74
+ cors: true,
75
+ headers: {
76
+ 'Cross-Origin-Opener-Policy': 'same-origin',
77
+ 'Cross-Origin-Embedder-Policy': 'require-corp',
78
+ }
79
+ }
80
+ ```
81
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfi-lens-wasm",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Lens For Web SDK with WASM",
5
5
  "main": "veryfi-lens.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "bin": {
10
10
  "veryfi-lens-wasm-setup": "./setup.sh"
11
11
  },
12
- "author": "",
12
+ "author": "George Veryfi",
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
15
  "fs-extra": "^11.1.1",
package/setup.mjs CHANGED
@@ -2,14 +2,15 @@ import inquirer from 'inquirer';
2
2
  import path from 'path';
3
3
  import fs from 'fs-extra';
4
4
 
5
- const defaultPath = path.join(process.cwd(), './public/wasm');
5
+ const defaultPath = path.join(process.cwd());
6
6
 
7
7
  const questions = [
8
8
  {
9
9
  type: 'input',
10
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
11
+ message: `Enter the path where you want to copy WASM files (They have to be accessible to the browser with relative path)
12
+ current: ${defaultPath} + /public/wasm (you are changing what goes after +):`,
13
+ default: defaultPath + '/public/wasm'
13
14
  },
14
15
  {
15
16
  type: 'confirm',