@privateid/ultrapass-web-sdk 1.3.1 → 1.3.2-1300478

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 (216) hide show
  1. package/README.md +75 -75
  2. package/dist/apiUtils.d.ts +46 -46
  3. package/dist/apiUtils.js +922 -922
  4. package/dist/application/index.d.ts +7 -7
  5. package/dist/application/index.js +27 -27
  6. package/dist/application/modules/core/document/DocumentService.d.ts +22 -22
  7. package/dist/application/modules/core/document/DocumentService.js +254 -254
  8. package/dist/application/modules/core/document/document.constants.d.ts +15 -15
  9. package/dist/application/modules/core/document/document.constants.js +21 -21
  10. package/dist/application/modules/core/document/document.domain.d.ts +7 -7
  11. package/dist/application/modules/core/document/document.domain.js +1 -1
  12. package/dist/application/modules/core/document/document.types.d.ts +17 -17
  13. package/dist/application/modules/core/document/document.types.js +1 -1
  14. package/dist/application/modules/core/document/document.utils.d.ts +3 -3
  15. package/dist/application/modules/core/document/document.utils.js +58 -58
  16. package/dist/application/modules/core/document/index.d.ts +3 -3
  17. package/dist/application/modules/core/document/index.js +1 -1
  18. package/dist/application/modules/core/face/FaceService.d.ts +33 -33
  19. package/dist/application/modules/core/face/FaceService.js +228 -221
  20. package/dist/application/modules/core/face/FaceService.js.map +1 -1
  21. package/dist/application/modules/core/face/face.constants.d.ts +53 -53
  22. package/dist/application/modules/core/face/face.constants.js +53 -53
  23. package/dist/application/modules/core/face/face.domain.d.ts +10 -10
  24. package/dist/application/modules/core/face/face.domain.js +1 -1
  25. package/dist/application/modules/core/face/face.types.d.ts +41 -38
  26. package/dist/application/modules/core/face/face.types.js +1 -1
  27. package/dist/application/modules/core/face/face.utils.d.ts +15 -15
  28. package/dist/application/modules/core/face/face.utils.js +101 -101
  29. package/dist/application/modules/core/face/index.d.ts +3 -3
  30. package/dist/application/modules/core/face/index.js +1 -1
  31. package/dist/application/modules/global/shared.constants.d.ts +2 -2
  32. package/dist/application/modules/global/shared.constants.js +2 -2
  33. package/dist/application/modules/global/shared.utils.d.ts +25 -25
  34. package/dist/application/modules/global/shared.utils.js +100 -100
  35. package/dist/application/modules/global/shared.utils.js.map +1 -1
  36. package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.d.ts +9 -0
  37. package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.js +32 -0
  38. package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.js.map +1 -0
  39. package/dist/application/modules/internal/feature-flag/feature-flag-init.d.ts +11 -0
  40. package/dist/application/modules/internal/feature-flag/feature-flag-init.js +24 -0
  41. package/dist/application/modules/internal/feature-flag/feature-flag-init.js.map +1 -0
  42. package/dist/application/modules/internal/feature-flag/feature-flag.domain.d.ts +10 -0
  43. package/dist/application/modules/internal/feature-flag/feature-flag.domain.js +7 -0
  44. package/dist/application/modules/internal/feature-flag/feature-flag.domain.js.map +1 -0
  45. package/dist/application/modules/internal/feature-flag/featureFlagInit.d.ts +11 -0
  46. package/dist/application/modules/internal/feature-flag/featureFlagInit.js +44 -0
  47. package/dist/application/modules/internal/feature-flag/featureFlagInit.js.map +1 -0
  48. package/dist/application/modules/internal/feature-flag/index.d.ts +2 -0
  49. package/dist/application/modules/internal/feature-flag/index.js +3 -0
  50. package/dist/application/modules/internal/feature-flag/index.js.map +1 -0
  51. package/dist/application/modules/internal/shared/index.d.ts +2 -0
  52. package/dist/application/modules/internal/shared/index.js +3 -0
  53. package/dist/application/modules/internal/shared/index.js.map +1 -0
  54. package/dist/application/modules/internal/shared/shared.constants.d.ts +2 -0
  55. package/dist/application/modules/internal/shared/shared.constants.js +3 -0
  56. package/dist/application/modules/internal/shared/shared.constants.js.map +1 -0
  57. package/dist/application/modules/internal/shared/shared.utils.d.ts +44 -0
  58. package/dist/application/modules/internal/shared/shared.utils.js +204 -0
  59. package/dist/application/modules/internal/shared/shared.utils.js.map +1 -0
  60. package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.d.ts +28 -0
  61. package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.js +380 -0
  62. package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.js.map +1 -0
  63. package/dist/application/modules/internal/wasm-orchestrator/index.d.ts +6 -0
  64. package/dist/application/modules/internal/wasm-orchestrator/index.js +9 -0
  65. package/dist/application/modules/internal/wasm-orchestrator/index.js.map +1 -0
  66. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.d.ts +28 -0
  67. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.js +35 -0
  68. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.js.map +1 -0
  69. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.d.ts +51 -0
  70. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.js +2 -0
  71. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.js.map +1 -0
  72. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.d.ts +142 -0
  73. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.js +2 -0
  74. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.js.map +1 -0
  75. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.d.ts +86 -0
  76. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.js +201 -0
  77. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.js.map +1 -0
  78. package/dist/application/modules/support/camera/CameraServiceFactory.d.ts +10 -10
  79. package/dist/application/modules/support/camera/CameraServiceFactory.js +33 -33
  80. package/dist/application/modules/support/camera/CameraServiceFactory.js.map +1 -1
  81. package/dist/application/modules/support/camera/camera.constants.d.ts +9 -9
  82. package/dist/application/modules/support/camera/camera.constants.js +48 -48
  83. package/dist/application/modules/support/camera/camera.domain.d.ts +15 -15
  84. package/dist/application/modules/support/camera/camera.domain.js +1 -1
  85. package/dist/application/modules/support/camera/camera.types.d.ts +42 -42
  86. package/dist/application/modules/support/camera/camera.types.js +10 -10
  87. package/dist/application/modules/support/camera/camera.utils.d.ts +157 -157
  88. package/dist/application/modules/support/camera/camera.utils.js +623 -623
  89. package/dist/application/modules/support/camera/index.d.ts +24 -24
  90. package/dist/application/modules/support/camera/index.js +27 -27
  91. package/dist/application/modules/support/camera/services/BaseCameraService.d.ts +41 -41
  92. package/dist/application/modules/support/camera/services/BaseCameraService.js +278 -278
  93. package/dist/application/modules/support/camera/services/DesktopCameraService.d.ts +5 -5
  94. package/dist/application/modules/support/camera/services/DesktopCameraService.js +46 -46
  95. package/dist/application/modules/support/camera/services/FirefoxCameraService.d.ts +5 -5
  96. package/dist/application/modules/support/camera/services/FirefoxCameraService.js +46 -46
  97. package/dist/application/modules/support/camera/services/MacSafariCameraService.d.ts +5 -5
  98. package/dist/application/modules/support/camera/services/MacSafariCameraService.js +47 -47
  99. package/dist/application/modules/support/camera/services/MobileCameraService.d.ts +5 -5
  100. package/dist/application/modules/support/camera/services/MobileCameraService.js +133 -133
  101. package/dist/application/modules/support/engine/EngineService.d.ts +15 -0
  102. package/dist/application/modules/support/engine/EngineService.js +106 -0
  103. package/dist/application/modules/support/engine/EngineService.js.map +1 -0
  104. package/dist/application/modules/support/engine/engine.constants.d.ts +33 -0
  105. package/dist/application/modules/support/engine/engine.constants.js +35 -0
  106. package/dist/application/modules/support/engine/engine.constants.js.map +1 -0
  107. package/dist/application/modules/support/engine/engine.domain.d.ts +23 -0
  108. package/dist/application/modules/support/engine/engine.domain.js +2 -0
  109. package/dist/application/modules/support/engine/engine.domain.js.map +1 -0
  110. package/dist/application/modules/support/engine/engine.types.d.ts +32 -0
  111. package/dist/application/modules/support/engine/engine.types.js +2 -0
  112. package/dist/application/modules/support/engine/engine.types.js.map +1 -0
  113. package/dist/application/modules/support/engine/engine.utils.d.ts +65 -0
  114. package/dist/application/modules/support/engine/engine.utils.js +135 -0
  115. package/dist/application/modules/support/engine/engine.utils.js.map +1 -0
  116. package/dist/application/modules/support/engine/index.d.ts +3 -0
  117. package/dist/application/modules/support/engine/index.js +2 -0
  118. package/dist/application/modules/support/engine/index.js.map +1 -0
  119. package/dist/application/modules/support/permissions/PermissionsService.d.ts +55 -55
  120. package/dist/application/modules/support/permissions/PermissionsService.js +183 -183
  121. package/dist/application/modules/support/permissions/index.d.ts +4 -4
  122. package/dist/application/modules/support/permissions/index.js +2 -2
  123. package/dist/application/modules/support/permissions/permission.utils.d.ts +6 -6
  124. package/dist/application/modules/support/permissions/permission.utils.js +33 -33
  125. package/dist/application/modules/support/permissions/permissions.domain.d.ts +6 -6
  126. package/dist/application/modules/support/permissions/permissions.domain.js +1 -1
  127. package/dist/application/modules/support/permissions/permissions.types.d.ts +9 -9
  128. package/dist/application/modules/support/permissions/permissions.types.js +1 -1
  129. package/dist/application/modules/support/wasm/WasmService.d.ts +25 -25
  130. package/dist/application/modules/support/wasm/WasmService.js +156 -155
  131. package/dist/application/modules/support/wasm/WasmService.js.map +1 -1
  132. package/dist/application/modules/support/wasm/index.d.ts +6 -6
  133. package/dist/application/modules/support/wasm/index.js +8 -8
  134. package/dist/application/modules/support/wasm/wasm.constants.d.ts +78 -78
  135. package/dist/application/modules/support/wasm/wasm.constants.js +86 -86
  136. package/dist/application/modules/support/wasm/wasm.domain.d.ts +52 -52
  137. package/dist/application/modules/support/wasm/wasm.domain.js +1 -1
  138. package/dist/application/modules/support/wasm/wasm.types.d.ts +119 -118
  139. package/dist/application/modules/support/wasm/wasm.types.js +1 -1
  140. package/dist/application/modules/support/wasm/wasm.utils.d.ts +88 -88
  141. package/dist/application/modules/support/wasm/wasm.utils.js +243 -243
  142. package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.d.ts +28 -0
  143. package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.js +324 -0
  144. package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.js.map +1 -0
  145. package/dist/application/modules/support/wasm-orchestrator/index.d.ts +6 -0
  146. package/dist/application/modules/support/wasm-orchestrator/index.js +9 -0
  147. package/dist/application/modules/support/wasm-orchestrator/index.js.map +1 -0
  148. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.d.ts +36 -0
  149. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.js +44 -0
  150. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.js.map +1 -0
  151. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.d.ts +47 -0
  152. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.js +2 -0
  153. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.js.map +1 -0
  154. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.d.ts +136 -0
  155. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.js +2 -0
  156. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.js.map +1 -0
  157. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.d.ts +91 -0
  158. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.js +250 -0
  159. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.js.map +1 -0
  160. package/dist/application/workers/index.d.ts +42 -42
  161. package/dist/application/workers/index.js +8 -8
  162. package/dist/application/workers/wasm/WasmWorkerService.d.ts +66 -0
  163. package/dist/application/workers/wasm/WasmWorkerService.js +801 -0
  164. package/dist/application/workers/wasm/WasmWorkerService.js.map +1 -0
  165. package/dist/application/workers/wasm/index.d.ts +4 -0
  166. package/dist/application/workers/wasm/index.js +9 -0
  167. package/dist/application/workers/wasm/index.js.map +1 -0
  168. package/dist/application/workers/wasm/wasm-worker.constants.d.ts +5 -0
  169. package/dist/application/workers/wasm/wasm-worker.constants.js +6 -0
  170. package/dist/application/workers/wasm/wasm-worker.constants.js.map +1 -0
  171. package/dist/application/workers/wasm/wasm-worker.domain.d.ts +99 -0
  172. package/dist/application/workers/wasm/wasm-worker.domain.js +2 -0
  173. package/dist/application/workers/wasm/wasm-worker.domain.js.map +1 -0
  174. package/dist/application/workers/wasm/wasm-worker.types.d.ts +88 -0
  175. package/dist/application/workers/wasm/wasm-worker.types.js +2 -0
  176. package/dist/application/workers/wasm/wasm-worker.types.js.map +1 -0
  177. package/dist/application/workers/wasm/wasm-worker.utils.d.ts +10 -0
  178. package/dist/application/workers/wasm/wasm-worker.utils.js +130 -0
  179. package/dist/application/workers/wasm/wasm-worker.utils.js.map +1 -0
  180. package/dist/buildConfig.d.ts +3 -0
  181. package/dist/buildConfig.js +7 -0
  182. package/dist/buildConfig.js.map +1 -0
  183. package/dist/cameraUtils.d.ts +77 -77
  184. package/dist/cameraUtils.js +361 -361
  185. package/dist/constants.d.ts +9 -9
  186. package/dist/constants.js +13 -13
  187. package/dist/createCallback.d.ts +56 -56
  188. package/dist/createCallback.js +332 -331
  189. package/dist/createCallback.js.map +1 -1
  190. package/dist/dbUtils.d.ts +14 -14
  191. package/dist/dbUtils.js +148 -148
  192. package/dist/envUtils.d.ts +4 -4
  193. package/dist/envUtils.js +16 -16
  194. package/dist/faceModule.d.ts +196 -196
  195. package/dist/faceModule.js +978 -978
  196. package/dist/featureFlagInit.d.ts +11 -0
  197. package/dist/featureFlagInit.js +44 -0
  198. package/dist/featureFlagInit.js.map +1 -0
  199. package/dist/index.d.ts +38 -38
  200. package/dist/index.js +82 -82
  201. package/dist/main.d.ts +30 -30
  202. package/dist/main.js +84 -84
  203. package/dist/types.d.ts +139 -139
  204. package/dist/types.js +77 -77
  205. package/dist/utils.d.ts +84 -84
  206. package/dist/utils.js +580 -580
  207. package/package.json +102 -102
  208. package/wasm/ultra/nosimd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.js +18 -18
  209. package/wasm/ultra/nosimd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.wasm +0 -0
  210. package/wasm/ultra/nosimd/version.json +2 -2
  211. package/wasm/ultra/simd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.js +18 -18
  212. package/wasm/ultra/simd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.wasm +0 -0
  213. package/wasm/ultra/simd/version.json +2 -2
  214. package/workers/comlink.min.js +7 -7
  215. package/workers/comlink.min.js.map +1 -1
  216. package/workers/wasm.worker.js +936 -924
@@ -1,156 +1,157 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- /* eslint-disable lines-between-class-members */
11
- /* eslint-disable import/prefer-default-export */
12
- import { proxy } from 'comlink';
13
- import { checkBrowserCompatibility, checkLoadSimdBuild, checkSimdSupport, handleCacheContent } from './wasm.utils';
14
- import { getDebugType, printLogs } from '../../global/shared.utils';
15
- import { isLoad, ultraEnroll, ultraPredict, compareEmbeddings, pkiEncrypt, checkIfModelsLoaded, ultraScanBackDocument, ultraScanFrontDocument, ultraCompareEmbeddings, ultraAgeEstimate, ultraDocumentOcr, freeMemory, } from '../../../../utils';
16
- export class WasmService {
17
- constructor() {
18
- this.isInitialized = false;
19
- this.hasSimdSupport = false;
20
- this.checkIfModelsLoaded = (isEnroll) => __awaiter(this, void 0, void 0, function* () {
21
- var _a;
22
- if (!this.isInitialized || !((_a = this.workerFunctions) === null || _a === void 0 ? void 0 : _a.checkIfModelsLoaded)) {
23
- return false;
24
- }
25
- try {
26
- return yield this.workerFunctions.checkIfModelsLoaded(isEnroll);
27
- }
28
- catch (error) {
29
- return false;
30
- }
31
- });
32
- this.predict = (images, isSimd, config, callback) => __awaiter(this, void 0, void 0, function* () {
33
- var _b;
34
- if (!((_b = this.workerFunctions) === null || _b === void 0 ? void 0 : _b.ultraPredict)) {
35
- throw new Error('[WasmService] WASM worker not initialized');
36
- }
37
- return this.workerFunctions.ultraPredict(images, isSimd, config, callback);
38
- });
39
- this.estimateAge = (images, isSimd, config, callback) => __awaiter(this, void 0, void 0, function* () {
40
- var _c;
41
- if (!((_c = this.workerFunctions) === null || _c === void 0 ? void 0 : _c.ultraAgeEstimate)) {
42
- throw new Error('[WasmService] WASM worker not initialized');
43
- }
44
- printLogs('[WasmService] estimateAge config', config);
45
- return this.workerFunctions.ultraAgeEstimate(images, isSimd, config, callback);
46
- });
47
- this.compareEmbeddings = (embeddingsA, embeddingsB, config, callback) => __awaiter(this, void 0, void 0, function* () {
48
- var _d;
49
- if (!((_d = this.workerFunctions) === null || _d === void 0 ? void 0 : _d.ultraCompareEmbeddings)) {
50
- throw new Error('[WasmService] WASM worker not initialized');
51
- }
52
- return this.workerFunctions.ultraCompareEmbeddings(embeddingsA, embeddingsB, config, callback);
53
- });
54
- this.scanFrontPhotoIdDocument = (imageData, config, callback) => __awaiter(this, void 0, void 0, function* () {
55
- var _e;
56
- if (!((_e = this.workerFunctions) === null || _e === void 0 ? void 0 : _e.ultraScanFrontDocument)) {
57
- throw new Error('[WasmService] WASM worker not initialized');
58
- }
59
- return this.workerFunctions.ultraScanFrontDocument(imageData, this.hasSimdSupport, config, callback);
60
- });
61
- this.scanBackDocument = (imageData, isSimd, config, callback) => __awaiter(this, void 0, void 0, function* () {
62
- var _f;
63
- if (!((_f = this.workerFunctions) === null || _f === void 0 ? void 0 : _f.ultraScanBackDocument)) {
64
- throw new Error('[WasmService] WASM worker not initialized');
65
- }
66
- return this.workerFunctions.ultraScanBackDocument(imageData, isSimd, config, callback);
67
- });
68
- this.scanPassport = (imageData, config, callback) => __awaiter(this, void 0, void 0, function* () {
69
- var _g;
70
- if (!((_g = this.workerFunctions) === null || _g === void 0 ? void 0 : _g.ultraScanFrontDocument)) {
71
- throw new Error('[WasmService] WASM worker not initialized');
72
- }
73
- return this.workerFunctions.ultraScanFrontDocument(imageData, this.hasSimdSupport, config, callback);
74
- });
75
- this.documentOcr = (imageData, config, callback) => __awaiter(this, void 0, void 0, function* () {
76
- var _h;
77
- if (!((_h = this.workerFunctions) === null || _h === void 0 ? void 0 : _h.ultraDocumentOcr)) {
78
- throw new Error('[WasmService] WASM worker not initialized');
79
- }
80
- return this.workerFunctions.ultraDocumentOcr(imageData, config, callback);
81
- });
82
- this.pkiEncrypt = (payload) => __awaiter(this, void 0, void 0, function* () {
83
- var _j;
84
- if (!((_j = this.workerFunctions) === null || _j === void 0 ? void 0 : _j.pkiEncrypt)) {
85
- throw new Error('[WasmService] WASM worker not initialized');
86
- }
87
- return this.workerFunctions.pkiEncrypt(payload);
88
- });
89
- // TODO: Bring worker functions to this service.
90
- this.workerFunctions = {
91
- isLoad,
92
- ultraEnroll,
93
- ultraPredict,
94
- compareEmbeddings,
95
- pkiEncrypt,
96
- checkIfModelsLoaded,
97
- ultraScanBackDocument,
98
- ultraScanFrontDocument,
99
- ultraCompareEmbeddings,
100
- ultraAgeEstimate,
101
- ultraDocumentOcr,
102
- freeMemory,
103
- };
104
- }
105
- initialize() {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- this.hasSimdSupport = yield checkSimdSupport();
108
- });
109
- }
110
- // TODO: consider `loadModule` to be called within the initialize method
111
- loadModule(options) {
112
- var _a, _b;
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const compatibility = checkBrowserCompatibility();
115
- if (!compatibility.support) {
116
- return compatibility;
117
- }
118
- const cacheContent = yield handleCacheContent();
119
- const shouldLoadSimdBuild = yield checkLoadSimdBuild();
120
- const wasmErrorCallback = proxy(createCallbackError({ callback: options.wasmFailureCallback }));
121
- try {
122
- if (!((_a = this.workerFunctions) === null || _a === void 0 ? void 0 : _a.isLoad)) {
123
- const message = '[WasmService] WASM worker not initialized - isLoad function not available';
124
- printLogs('[WasmService]', message, 'ERROR');
125
- return { support: false, message };
126
- }
127
- const loaded = yield this.workerFunctions.isLoad(shouldLoadSimdBuild, options.apiUrl, options.sessionToken, options.publicKey, getDebugType(), true, options.timeout, (_b = options.useCdn) !== null && _b !== void 0 ? _b : true, options.shouldRegenerateSession || false, wasmErrorCallback, options.usageScenario || '', cacheContent);
128
- this.isInitialized = true;
129
- printLogs('[WasmService] loadModule', loaded);
130
- return { support: true };
131
- }
132
- catch (error) {
133
- return {
134
- support: false,
135
- message: `Failed to load WASM module: ${error.message}`,
136
- };
137
- }
138
- });
139
- }
140
- enroll(imageData, config, callback) {
141
- var _a;
142
- return __awaiter(this, void 0, void 0, function* () {
143
- if (!((_a = this.workerFunctions) === null || _a === void 0 ? void 0 : _a.ultraEnroll)) {
144
- throw new Error('[WasmService] WASM worker not initialized');
145
- }
146
- return this.workerFunctions.ultraEnroll(imageData, this.hasSimdSupport, config, callback);
147
- });
148
- }
149
- }
150
- function createCallbackError({ callback }) {
151
- return (errorCode) => {
152
- printLogs(`Callback error! Error code: `, errorCode, 'ERROR');
153
- callback(errorCode);
154
- };
155
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /* eslint-disable lines-between-class-members */
11
+ /* eslint-disable import/prefer-default-export */
12
+ import { proxy } from 'comlink';
13
+ import { checkBrowserCompatibility, checkLoadSimdBuild, checkSimdSupport, handleCacheContent } from './wasm.utils';
14
+ import { getDebugType, printLogs } from '../../global/shared.utils';
15
+ import { isLoad, ultraEnroll, ultraPredict, compareEmbeddings, pkiEncrypt, checkIfModelsLoaded, ultraScanBackDocument, ultraScanFrontDocument, ultraCompareEmbeddings, ultraAgeEstimate, ultraDocumentOcr, freeMemory, } from '../../../../utils';
16
+ export class WasmService {
17
+ constructor() {
18
+ this.isInitialized = false;
19
+ this.hasSimdSupport = false;
20
+ this.checkIfModelsLoaded = (isEnroll) => __awaiter(this, void 0, void 0, function* () {
21
+ var _a;
22
+ if (!this.isInitialized || !((_a = this.workerFunctions) === null || _a === void 0 ? void 0 : _a.checkIfModelsLoaded)) {
23
+ return false;
24
+ }
25
+ try {
26
+ return yield this.workerFunctions.checkIfModelsLoaded(isEnroll);
27
+ }
28
+ catch (error) {
29
+ return false;
30
+ }
31
+ });
32
+ this.predict = (images, isSimd, config, callback) => __awaiter(this, void 0, void 0, function* () {
33
+ var _b;
34
+ if (!((_b = this.workerFunctions) === null || _b === void 0 ? void 0 : _b.ultraPredict)) {
35
+ throw new Error('[WasmService] WASM worker not initialized');
36
+ }
37
+ return this.workerFunctions.ultraPredict(images, isSimd, config, callback);
38
+ });
39
+ this.estimateAge = (images, isSimd, config, callback, onAntiSpoofProgress) => __awaiter(this, void 0, void 0, function* () {
40
+ var _c;
41
+ if (!((_c = this.workerFunctions) === null || _c === void 0 ? void 0 : _c.ultraAgeEstimate)) {
42
+ throw new Error('[WasmService] WASM worker not initialized');
43
+ }
44
+ printLogs('[WasmService] estimateAge config', config);
45
+ printLogs('[WasmService] onAntiSpoofProgress received:', onAntiSpoofProgress ? 'YES ✅' : 'NO ❌');
46
+ return this.workerFunctions.ultraAgeEstimate(images, isSimd, config, callback, onAntiSpoofProgress);
47
+ });
48
+ this.compareEmbeddings = (embeddingsA, embeddingsB, config, callback) => __awaiter(this, void 0, void 0, function* () {
49
+ var _d;
50
+ if (!((_d = this.workerFunctions) === null || _d === void 0 ? void 0 : _d.ultraCompareEmbeddings)) {
51
+ throw new Error('[WasmService] WASM worker not initialized');
52
+ }
53
+ return this.workerFunctions.ultraCompareEmbeddings(embeddingsA, embeddingsB, config, callback);
54
+ });
55
+ this.scanFrontPhotoIdDocument = (imageData, config, callback) => __awaiter(this, void 0, void 0, function* () {
56
+ var _e;
57
+ if (!((_e = this.workerFunctions) === null || _e === void 0 ? void 0 : _e.ultraScanFrontDocument)) {
58
+ throw new Error('[WasmService] WASM worker not initialized');
59
+ }
60
+ return this.workerFunctions.ultraScanFrontDocument(imageData, this.hasSimdSupport, config, callback);
61
+ });
62
+ this.scanBackDocument = (imageData, isSimd, config, callback) => __awaiter(this, void 0, void 0, function* () {
63
+ var _f;
64
+ if (!((_f = this.workerFunctions) === null || _f === void 0 ? void 0 : _f.ultraScanBackDocument)) {
65
+ throw new Error('[WasmService] WASM worker not initialized');
66
+ }
67
+ return this.workerFunctions.ultraScanBackDocument(imageData, isSimd, config, callback);
68
+ });
69
+ this.scanPassport = (imageData, config, callback) => __awaiter(this, void 0, void 0, function* () {
70
+ var _g;
71
+ if (!((_g = this.workerFunctions) === null || _g === void 0 ? void 0 : _g.ultraScanFrontDocument)) {
72
+ throw new Error('[WasmService] WASM worker not initialized');
73
+ }
74
+ return this.workerFunctions.ultraScanFrontDocument(imageData, this.hasSimdSupport, config, callback);
75
+ });
76
+ this.documentOcr = (imageData, config, callback) => __awaiter(this, void 0, void 0, function* () {
77
+ var _h;
78
+ if (!((_h = this.workerFunctions) === null || _h === void 0 ? void 0 : _h.ultraDocumentOcr)) {
79
+ throw new Error('[WasmService] WASM worker not initialized');
80
+ }
81
+ return this.workerFunctions.ultraDocumentOcr(imageData, config, callback);
82
+ });
83
+ this.pkiEncrypt = (payload) => __awaiter(this, void 0, void 0, function* () {
84
+ var _j;
85
+ if (!((_j = this.workerFunctions) === null || _j === void 0 ? void 0 : _j.pkiEncrypt)) {
86
+ throw new Error('[WasmService] WASM worker not initialized');
87
+ }
88
+ return this.workerFunctions.pkiEncrypt(payload);
89
+ });
90
+ // TODO: Bring worker functions to this service.
91
+ this.workerFunctions = {
92
+ isLoad,
93
+ ultraEnroll,
94
+ ultraPredict,
95
+ compareEmbeddings,
96
+ pkiEncrypt,
97
+ checkIfModelsLoaded,
98
+ ultraScanBackDocument,
99
+ ultraScanFrontDocument,
100
+ ultraCompareEmbeddings,
101
+ ultraAgeEstimate,
102
+ ultraDocumentOcr,
103
+ freeMemory,
104
+ };
105
+ }
106
+ initialize() {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ this.hasSimdSupport = yield checkSimdSupport();
109
+ });
110
+ }
111
+ // TODO: consider `loadModule` to be called within the initialize method
112
+ loadModule(options) {
113
+ var _a, _b;
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ const compatibility = checkBrowserCompatibility();
116
+ if (!compatibility.support) {
117
+ return compatibility;
118
+ }
119
+ const cacheContent = yield handleCacheContent();
120
+ const shouldLoadSimdBuild = yield checkLoadSimdBuild();
121
+ const wasmErrorCallback = proxy(createCallbackError({ callback: options.wasmFailureCallback }));
122
+ try {
123
+ if (!((_a = this.workerFunctions) === null || _a === void 0 ? void 0 : _a.isLoad)) {
124
+ const message = '[WasmService] WASM worker not initialized - isLoad function not available';
125
+ printLogs('[WasmService]', message, 'ERROR');
126
+ return { support: false, message };
127
+ }
128
+ const loaded = yield this.workerFunctions.isLoad(options.skipSimdCheck ? false : shouldLoadSimdBuild, options.apiUrl, options.sessionToken, options.publicKey, getDebugType(), true, options.timeout, (_b = options.useCdn) !== null && _b !== void 0 ? _b : true, options.shouldRegenerateSession || false, wasmErrorCallback, options.usageScenario || '', cacheContent);
129
+ this.isInitialized = true;
130
+ printLogs('[WasmService] loadModule', loaded);
131
+ return { support: true };
132
+ }
133
+ catch (error) {
134
+ return {
135
+ support: false,
136
+ message: `Failed to load WASM module: ${error.message}`,
137
+ };
138
+ }
139
+ });
140
+ }
141
+ enroll(imageData, config, callback) {
142
+ var _a;
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ if (!((_a = this.workerFunctions) === null || _a === void 0 ? void 0 : _a.ultraEnroll)) {
145
+ throw new Error('[WasmService] WASM worker not initialized');
146
+ }
147
+ return this.workerFunctions.ultraEnroll(imageData, this.hasSimdSupport, config, callback);
148
+ });
149
+ }
150
+ }
151
+ function createCallbackError({ callback }) {
152
+ return (errorCode) => {
153
+ printLogs(`Callback error! Error code: `, errorCode, 'ERROR');
154
+ callback(errorCode);
155
+ };
156
+ }
156
157
  //# sourceMappingURL=WasmService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WasmService.js","sourceRoot":"","sources":["../../../../../src/application/modules/support/wasm/WasmService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAgD;AAChD,iDAAiD;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EACL,MAAM,EACN,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,GACX,MAAM,mBAAmB,CAAC;AAE3B,MAAM,OAAO,WAAW;IAKtB;QAHQ,kBAAa,GAAG,KAAK,CAAC;QACtB,mBAAc,GAAG,KAAK,CAAC;QAoE/B,wBAAmB,GAAG,CAAO,QAAiB,EAAoB,EAAE;;YAClE,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,mBAAmB,CAAA,EAAE;gBACrE,OAAO,KAAK,CAAC;aACd;YAED,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;aACjE;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,KAAK,CAAC;aACd;QACH,CAAC,CAAA,CAAC;QAUF,YAAO,GAAG,CACR,MA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CAC9C,mBAAmB,EACnB,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,SAAS,EACjB,YAAY,EAAE,EACd,IAAI,EACJ,OAAO,CAAC,OAAO,EACf,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,EACtB,OAAO,CAAC,uBAAuB,IAAI,KAAK,EACxC,iBAAiB,EACjB,OAAO,CAAC,aAAa,IAAI,EAAE,EAC3B,YAAY,CACb,CAAC;gBAEF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;gBAC1B,SAAS,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;gBAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;aAC1B;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,+BAA+B,KAAK,CAAC,OAAO,EAAE;iBACxD,CAAC;aACH;;KACF;IAcK,MAAM,CAAC,SAAc,EAAE,MAAc,EAAE,QAA4B;;;YACvE,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,WAAW,CAAA,EAAE;gBACtC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;aAC9D;YAED,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;;KAC3F;CA+FF;AACD,SAAS,mBAAmB,CAAC,EAAE,QAAQ,EAAqB;IAC1D,OAAO,CAAC,SAAc,EAAE,EAAE;QACxB,SAAS,CAAC,8BAA8B,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9D,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"WasmService.js","sourceRoot":"","sources":["../../../../../src/application/modules/support/wasm/WasmService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAgD;AAChD,i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C,MAAM,mCAAI,IAAI,EACtB,OAAO,CAAC,uBAAuB,IAAI,KAAK,EACxC,iBAAiB,EACjB,OAAO,CAAC,aAAa,IAAI,EAAE,EAC3B,YAAY,CACb,CAAC;gBAEF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;gBAC1B,SAAS,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;gBAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;aAC1B;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,+BAA+B,KAAK,CAAC,OAAO,EAAE;iBACxD,CAAC;aACH;;KACF;IAcK,MAAM,CAAC,SAAc,EAAE,MAAc,EAAE,QAA4B;;;YACvE,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,eAAe,0CAAE,WAAW,CAAA,EAAE;gBACtC,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;aAC9D;YAED,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;;KAC3F;CAuGF;AACD,SAAS,mBAAmB,CAAC,EAAE,QAAQ,EAAqB;IAC1D,OAAO,CAAC,SAAc,EAAE,EAAE;QACxB,SAAS,CAAC,8BAA8B,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9D,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
- export { WasmService } from './WasmService';
2
- export type { Wasm } from './wasm.domain';
3
- export type { WasmLoadResult, WasmModuleOptions, EnrollConfig, PredictConfig, DocumentScanConfig, DocumentOcrConfig, AgeEstimationConfig, CompareEmbeddingsConfig, WasmCallbackResult, WasmResultCallback, EncryptionResult, } from './wasm.types';
4
- export { WASM_DATABASE_NAME, WASM_DATABASE_VERSION, DEFAULT_ENROLL_CONFIG, MOBILE_ENROLL_CONFIG_OVERRIDES, DEFAULT_PREDICT_CONFIG, DEFAULT_AGE_ESTIMATION_CONFIG, DEFAULT_DOCUMENT_SCAN_CONFIG, DEFAULT_DOCUMENT_OCR_CONFIG, DEBUG_TYPES_WITH_IMAGES, BROWSER_COMPATIBILITY_MESSAGES, } from './wasm.constants';
5
- export { checkBrowserCompatibility, shouldEnableSimd, getDefaultEnrollConfig, getMobileEnrollConfig, getEnrollConfig, getDefaultPredictConfig, getPredictConfig, getDefaultAgeEstimationConfig, getAgeEstimationConfig, getDefaultDocumentScanConfig, getDocumentScanConfig, getDefaultDocumentOcrConfig, getDocumentOcrConfig, configToJson, shouldCreateDebugImages, getWasmWorkerUrl, isMobilePlatform, printWasmLogs, createWasmDebugImages, } from './wasm.utils';
6
- export { getIsSIMD } from '../../global/shared.utils';
1
+ export { WasmService } from './WasmService';
2
+ export type { Wasm } from './wasm.domain';
3
+ export type { WasmLoadResult, WasmModuleOptions, EnrollConfig, PredictConfig, DocumentScanConfig, DocumentOcrConfig, AgeEstimationConfig, CompareEmbeddingsConfig, WasmCallbackResult, WasmResultCallback, EncryptionResult, } from './wasm.types';
4
+ export { WASM_DATABASE_NAME, WASM_DATABASE_VERSION, DEFAULT_ENROLL_CONFIG, MOBILE_ENROLL_CONFIG_OVERRIDES, DEFAULT_PREDICT_CONFIG, DEFAULT_AGE_ESTIMATION_CONFIG, DEFAULT_DOCUMENT_SCAN_CONFIG, DEFAULT_DOCUMENT_OCR_CONFIG, DEBUG_TYPES_WITH_IMAGES, BROWSER_COMPATIBILITY_MESSAGES, } from './wasm.constants';
5
+ export { checkBrowserCompatibility, shouldEnableSimd, getDefaultEnrollConfig, getMobileEnrollConfig, getEnrollConfig, getDefaultPredictConfig, getPredictConfig, getDefaultAgeEstimationConfig, getAgeEstimationConfig, getDefaultDocumentScanConfig, getDocumentScanConfig, getDefaultDocumentOcrConfig, getDocumentOcrConfig, configToJson, shouldCreateDebugImages, getWasmWorkerUrl, isMobilePlatform, printWasmLogs, createWasmDebugImages, } from './wasm.utils';
6
+ export { getIsSIMD } from '../../global/shared.utils';
@@ -1,9 +1,9 @@
1
- // Main WASM service
2
- export { WasmService } from './WasmService';
3
- // Constants
4
- export { WASM_DATABASE_NAME, WASM_DATABASE_VERSION, DEFAULT_ENROLL_CONFIG, MOBILE_ENROLL_CONFIG_OVERRIDES, DEFAULT_PREDICT_CONFIG, DEFAULT_AGE_ESTIMATION_CONFIG, DEFAULT_DOCUMENT_SCAN_CONFIG, DEFAULT_DOCUMENT_OCR_CONFIG, DEBUG_TYPES_WITH_IMAGES, BROWSER_COMPATIBILITY_MESSAGES, } from './wasm.constants';
5
- // Utilities
6
- export { checkBrowserCompatibility, shouldEnableSimd, getDefaultEnrollConfig, getMobileEnrollConfig, getEnrollConfig, getDefaultPredictConfig, getPredictConfig, getDefaultAgeEstimationConfig, getAgeEstimationConfig, getDefaultDocumentScanConfig, getDocumentScanConfig, getDefaultDocumentOcrConfig, getDocumentOcrConfig, configToJson, shouldCreateDebugImages, getWasmWorkerUrl, isMobilePlatform, printWasmLogs, createWasmDebugImages, } from './wasm.utils';
7
- // Re-export shared utilities
8
- export { getIsSIMD } from '../../global/shared.utils';
1
+ // Main WASM service
2
+ export { WasmService } from './WasmService';
3
+ // Constants
4
+ export { WASM_DATABASE_NAME, WASM_DATABASE_VERSION, DEFAULT_ENROLL_CONFIG, MOBILE_ENROLL_CONFIG_OVERRIDES, DEFAULT_PREDICT_CONFIG, DEFAULT_AGE_ESTIMATION_CONFIG, DEFAULT_DOCUMENT_SCAN_CONFIG, DEFAULT_DOCUMENT_OCR_CONFIG, DEBUG_TYPES_WITH_IMAGES, BROWSER_COMPATIBILITY_MESSAGES, } from './wasm.constants';
5
+ // Utilities
6
+ export { checkBrowserCompatibility, shouldEnableSimd, getDefaultEnrollConfig, getMobileEnrollConfig, getEnrollConfig, getDefaultPredictConfig, getPredictConfig, getDefaultAgeEstimationConfig, getAgeEstimationConfig, getDefaultDocumentScanConfig, getDocumentScanConfig, getDefaultDocumentOcrConfig, getDocumentOcrConfig, configToJson, shouldCreateDebugImages, getWasmWorkerUrl, isMobilePlatform, printWasmLogs, createWasmDebugImages, } from './wasm.utils';
7
+ // Re-export shared utilities
8
+ export { getIsSIMD } from '../../global/shared.utils';
9
9
  //# sourceMappingURL=index.js.map
@@ -1,78 +1,78 @@
1
- export declare const WASM_DATABASE_NAME = "/privid-wasm";
2
- export declare const WASM_DATABASE_VERSION = 21;
3
- export declare const SAFARI_MIN_VERSION_FOR_SIMD = 16;
4
- export declare const SAFARI_MIN_SUBVERSION_FOR_SIMD = 4;
5
- export declare const DEFAULT_ENROLL_CONFIG: {
6
- readonly input_image_format: "rgba";
7
- readonly angle_rotation_left_threshold: 20;
8
- readonly angle_rotation_right_threshold: 20;
9
- readonly threshold_high_vertical_enroll: 0.9;
10
- readonly threshold_down_vertical_enroll: 2.2;
11
- readonly anti_spoofing_threshold: 0.8;
12
- readonly threshold_profile_enroll: 0.66;
13
- readonly blur_threshold_enroll_pred: 40;
14
- readonly threshold_user_too_close: 0.52;
15
- readonly threshold_user_too_far: 0.165;
16
- readonly allow_only_one_face: true;
17
- readonly threshold_user_up: 0.15;
18
- readonly threshold_user_down: 0.9;
19
- readonly threshold_user_left: 0.8;
20
- readonly threshold_user_right: 0.2;
21
- };
22
- export declare const MOBILE_ENROLL_CONFIG_OVERRIDES: {
23
- readonly threshold_user_too_far: 0.31;
24
- readonly threshold_user_too_close: 0.55;
25
- readonly threshold_user_right: 0.2;
26
- readonly threshold_user_left: 0.8;
27
- readonly threshold_profile_enroll: 0.66;
28
- };
29
- export declare const DEFAULT_PREDICT_CONFIG: {
30
- input_image_format: string;
31
- angle_rotation_left_threshold: number;
32
- angle_rotation_right_threshold: number;
33
- anti_spoofing_threshold: number;
34
- threshold_profile_predict: number;
35
- blur_threshold_enroll_pred: number;
36
- threshold_user_too_close: number;
37
- threshold_user_too_far: number;
38
- threshold_user_up: number;
39
- threshold_user_down: number;
40
- threshold_user_left: number;
41
- threshold_user_right: number;
42
- threshold_high_vertical_predict: number;
43
- threshold_down_vertical_predict: number;
44
- url_name_override: string;
45
- disallowed_results: number[];
46
- disable_predict_mf: boolean;
47
- mf_count_override: number;
48
- };
49
- export declare const DEFAULT_AGE_ESTIMATION_CONFIG: {
50
- readonly anti_spoofing_threshold: 0.8;
51
- readonly mf_count_override: 5;
52
- readonly disable_estimate_age_mf: false;
53
- readonly threshold_user_too_close: 0.8;
54
- readonly threshold_profile_enroll: 0.6;
55
- readonly threshold_user_too_far: 0.2;
56
- readonly allow_only_one_face: false;
57
- };
58
- export declare const DEFAULT_DOCUMENT_SCAN_CONFIG: {
59
- readonly input_image_format: "rgba";
60
- readonly fingers_over_document_threshold: 0.2;
61
- };
62
- export declare const DEFAULT_DOCUMENT_OCR_CONFIG: {
63
- readonly input_image_format: "rgba";
64
- readonly calculate_age_from_ocr_text: true;
65
- readonly threshold_doc_x: 0;
66
- readonly threshold_doc_y: 0;
67
- readonly threshold_doc_too_close: 0.99;
68
- readonly threshold_doc_too_far: 0.1;
69
- };
70
- export declare const DEBUG_TYPES_WITH_IMAGES: readonly ["900", "901", "902", "903"];
71
- export declare const BROWSER_COMPATIBILITY_MESSAGES: {
72
- readonly OPERA_MOBILE_NOT_SUPPORTED: "Opera mobile version 72 and below is not support WASM";
73
- readonly OPERA_NOT_SUPPORTED: "Opera version 43 and below is not support WASM";
74
- readonly CHROME_NOT_SUPPORTED: "Chrome version 57 and below is not support WASM";
75
- readonly FIREFOX_NOT_SUPPORTED: "Firefox version 52 and below is not support WASM";
76
- readonly ANDROID_BROWSER_NOT_SUPPORTED: "Android Browser version 96 and below is not supported.";
77
- readonly UNABLE_TO_LOAD_WASM: "Unable to load wasm";
78
- };
1
+ export declare const WASM_DATABASE_NAME = "/privid-wasm";
2
+ export declare const WASM_DATABASE_VERSION = 21;
3
+ export declare const SAFARI_MIN_VERSION_FOR_SIMD = 16;
4
+ export declare const SAFARI_MIN_SUBVERSION_FOR_SIMD = 4;
5
+ export declare const DEFAULT_ENROLL_CONFIG: {
6
+ readonly input_image_format: "rgba";
7
+ readonly angle_rotation_left_threshold: 20;
8
+ readonly angle_rotation_right_threshold: 20;
9
+ readonly threshold_high_vertical_enroll: 0.9;
10
+ readonly threshold_down_vertical_enroll: 2.2;
11
+ readonly anti_spoofing_threshold: 0.8;
12
+ readonly threshold_profile_enroll: 0.66;
13
+ readonly blur_threshold_enroll_pred: 40;
14
+ readonly threshold_user_too_close: 0.52;
15
+ readonly threshold_user_too_far: 0.165;
16
+ readonly allow_only_one_face: true;
17
+ readonly threshold_user_up: 0.15;
18
+ readonly threshold_user_down: 0.9;
19
+ readonly threshold_user_left: 0.8;
20
+ readonly threshold_user_right: 0.2;
21
+ };
22
+ export declare const MOBILE_ENROLL_CONFIG_OVERRIDES: {
23
+ readonly threshold_user_too_far: 0.31;
24
+ readonly threshold_user_too_close: 0.55;
25
+ readonly threshold_user_right: 0.2;
26
+ readonly threshold_user_left: 0.8;
27
+ readonly threshold_profile_enroll: 0.66;
28
+ };
29
+ export declare const DEFAULT_PREDICT_CONFIG: {
30
+ input_image_format: string;
31
+ angle_rotation_left_threshold: number;
32
+ angle_rotation_right_threshold: number;
33
+ anti_spoofing_threshold: number;
34
+ threshold_profile_predict: number;
35
+ blur_threshold_enroll_pred: number;
36
+ threshold_user_too_close: number;
37
+ threshold_user_too_far: number;
38
+ threshold_user_up: number;
39
+ threshold_user_down: number;
40
+ threshold_user_left: number;
41
+ threshold_user_right: number;
42
+ threshold_high_vertical_predict: number;
43
+ threshold_down_vertical_predict: number;
44
+ url_name_override: string;
45
+ disallowed_results: number[];
46
+ disable_predict_mf: boolean;
47
+ mf_count_override: number;
48
+ };
49
+ export declare const DEFAULT_AGE_ESTIMATION_CONFIG: {
50
+ readonly anti_spoofing_threshold: 0.8;
51
+ readonly mf_count_override: 5;
52
+ readonly disable_estimate_age_mf: false;
53
+ readonly threshold_user_too_close: 0.8;
54
+ readonly threshold_profile_enroll: 0.6;
55
+ readonly threshold_user_too_far: 0.2;
56
+ readonly allow_only_one_face: false;
57
+ };
58
+ export declare const DEFAULT_DOCUMENT_SCAN_CONFIG: {
59
+ readonly input_image_format: "rgba";
60
+ readonly fingers_over_document_threshold: 0.2;
61
+ };
62
+ export declare const DEFAULT_DOCUMENT_OCR_CONFIG: {
63
+ readonly input_image_format: "rgba";
64
+ readonly calculate_age_from_ocr_text: true;
65
+ readonly threshold_doc_x: 0;
66
+ readonly threshold_doc_y: 0;
67
+ readonly threshold_doc_too_close: 0.99;
68
+ readonly threshold_doc_too_far: 0.1;
69
+ };
70
+ export declare const DEBUG_TYPES_WITH_IMAGES: readonly ["900", "901", "902", "903"];
71
+ export declare const BROWSER_COMPATIBILITY_MESSAGES: {
72
+ readonly OPERA_MOBILE_NOT_SUPPORTED: "Opera mobile version 72 and below is not support WASM";
73
+ readonly OPERA_NOT_SUPPORTED: "Opera version 43 and below is not support WASM";
74
+ readonly CHROME_NOT_SUPPORTED: "Chrome version 57 and below is not support WASM";
75
+ readonly FIREFOX_NOT_SUPPORTED: "Firefox version 52 and below is not support WASM";
76
+ readonly ANDROID_BROWSER_NOT_SUPPORTED: "Android Browser version 96 and below is not supported.";
77
+ readonly UNABLE_TO_LOAD_WASM: "Unable to load wasm";
78
+ };