veryfi-lens-wasm 1.0.7 → 1.0.8
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 +55 -2
- package/package.json +1 -1
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
|
|
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
|
+
|