@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.
- package/README.md +75 -75
- package/dist/apiUtils.d.ts +46 -46
- package/dist/apiUtils.js +922 -922
- package/dist/application/index.d.ts +7 -7
- package/dist/application/index.js +27 -27
- package/dist/application/modules/core/document/DocumentService.d.ts +22 -22
- package/dist/application/modules/core/document/DocumentService.js +254 -254
- package/dist/application/modules/core/document/document.constants.d.ts +15 -15
- package/dist/application/modules/core/document/document.constants.js +21 -21
- package/dist/application/modules/core/document/document.domain.d.ts +7 -7
- package/dist/application/modules/core/document/document.domain.js +1 -1
- package/dist/application/modules/core/document/document.types.d.ts +17 -17
- package/dist/application/modules/core/document/document.types.js +1 -1
- package/dist/application/modules/core/document/document.utils.d.ts +3 -3
- package/dist/application/modules/core/document/document.utils.js +58 -58
- package/dist/application/modules/core/document/index.d.ts +3 -3
- package/dist/application/modules/core/document/index.js +1 -1
- package/dist/application/modules/core/face/FaceService.d.ts +33 -33
- package/dist/application/modules/core/face/FaceService.js +228 -221
- package/dist/application/modules/core/face/FaceService.js.map +1 -1
- package/dist/application/modules/core/face/face.constants.d.ts +53 -53
- package/dist/application/modules/core/face/face.constants.js +53 -53
- package/dist/application/modules/core/face/face.domain.d.ts +10 -10
- package/dist/application/modules/core/face/face.domain.js +1 -1
- package/dist/application/modules/core/face/face.types.d.ts +41 -38
- package/dist/application/modules/core/face/face.types.js +1 -1
- package/dist/application/modules/core/face/face.utils.d.ts +15 -15
- package/dist/application/modules/core/face/face.utils.js +101 -101
- package/dist/application/modules/core/face/index.d.ts +3 -3
- package/dist/application/modules/core/face/index.js +1 -1
- package/dist/application/modules/global/shared.constants.d.ts +2 -2
- package/dist/application/modules/global/shared.constants.js +2 -2
- package/dist/application/modules/global/shared.utils.d.ts +25 -25
- package/dist/application/modules/global/shared.utils.js +100 -100
- package/dist/application/modules/global/shared.utils.js.map +1 -1
- package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.d.ts +9 -0
- package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.js +32 -0
- package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.js.map +1 -0
- package/dist/application/modules/internal/feature-flag/feature-flag-init.d.ts +11 -0
- package/dist/application/modules/internal/feature-flag/feature-flag-init.js +24 -0
- package/dist/application/modules/internal/feature-flag/feature-flag-init.js.map +1 -0
- package/dist/application/modules/internal/feature-flag/feature-flag.domain.d.ts +10 -0
- package/dist/application/modules/internal/feature-flag/feature-flag.domain.js +7 -0
- package/dist/application/modules/internal/feature-flag/feature-flag.domain.js.map +1 -0
- package/dist/application/modules/internal/feature-flag/featureFlagInit.d.ts +11 -0
- package/dist/application/modules/internal/feature-flag/featureFlagInit.js +44 -0
- package/dist/application/modules/internal/feature-flag/featureFlagInit.js.map +1 -0
- package/dist/application/modules/internal/feature-flag/index.d.ts +2 -0
- package/dist/application/modules/internal/feature-flag/index.js +3 -0
- package/dist/application/modules/internal/feature-flag/index.js.map +1 -0
- package/dist/application/modules/internal/shared/index.d.ts +2 -0
- package/dist/application/modules/internal/shared/index.js +3 -0
- package/dist/application/modules/internal/shared/index.js.map +1 -0
- package/dist/application/modules/internal/shared/shared.constants.d.ts +2 -0
- package/dist/application/modules/internal/shared/shared.constants.js +3 -0
- package/dist/application/modules/internal/shared/shared.constants.js.map +1 -0
- package/dist/application/modules/internal/shared/shared.utils.d.ts +44 -0
- package/dist/application/modules/internal/shared/shared.utils.js +204 -0
- package/dist/application/modules/internal/shared/shared.utils.js.map +1 -0
- package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.d.ts +28 -0
- package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.js +380 -0
- package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.js.map +1 -0
- package/dist/application/modules/internal/wasm-orchestrator/index.d.ts +6 -0
- package/dist/application/modules/internal/wasm-orchestrator/index.js +9 -0
- package/dist/application/modules/internal/wasm-orchestrator/index.js.map +1 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.d.ts +28 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.js +35 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.js.map +1 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.d.ts +51 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.js +2 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.js.map +1 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.d.ts +142 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.js +2 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.js.map +1 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.d.ts +86 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.js +201 -0
- package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.js.map +1 -0
- package/dist/application/modules/support/camera/CameraServiceFactory.d.ts +10 -10
- package/dist/application/modules/support/camera/CameraServiceFactory.js +33 -33
- package/dist/application/modules/support/camera/CameraServiceFactory.js.map +1 -1
- package/dist/application/modules/support/camera/camera.constants.d.ts +9 -9
- package/dist/application/modules/support/camera/camera.constants.js +48 -48
- package/dist/application/modules/support/camera/camera.domain.d.ts +15 -15
- package/dist/application/modules/support/camera/camera.domain.js +1 -1
- package/dist/application/modules/support/camera/camera.types.d.ts +42 -42
- package/dist/application/modules/support/camera/camera.types.js +10 -10
- package/dist/application/modules/support/camera/camera.utils.d.ts +157 -157
- package/dist/application/modules/support/camera/camera.utils.js +623 -623
- package/dist/application/modules/support/camera/index.d.ts +24 -24
- package/dist/application/modules/support/camera/index.js +27 -27
- package/dist/application/modules/support/camera/services/BaseCameraService.d.ts +41 -41
- package/dist/application/modules/support/camera/services/BaseCameraService.js +278 -278
- package/dist/application/modules/support/camera/services/DesktopCameraService.d.ts +5 -5
- package/dist/application/modules/support/camera/services/DesktopCameraService.js +46 -46
- package/dist/application/modules/support/camera/services/FirefoxCameraService.d.ts +5 -5
- package/dist/application/modules/support/camera/services/FirefoxCameraService.js +46 -46
- package/dist/application/modules/support/camera/services/MacSafariCameraService.d.ts +5 -5
- package/dist/application/modules/support/camera/services/MacSafariCameraService.js +47 -47
- package/dist/application/modules/support/camera/services/MobileCameraService.d.ts +5 -5
- package/dist/application/modules/support/camera/services/MobileCameraService.js +133 -133
- package/dist/application/modules/support/engine/EngineService.d.ts +15 -0
- package/dist/application/modules/support/engine/EngineService.js +106 -0
- package/dist/application/modules/support/engine/EngineService.js.map +1 -0
- package/dist/application/modules/support/engine/engine.constants.d.ts +33 -0
- package/dist/application/modules/support/engine/engine.constants.js +35 -0
- package/dist/application/modules/support/engine/engine.constants.js.map +1 -0
- package/dist/application/modules/support/engine/engine.domain.d.ts +23 -0
- package/dist/application/modules/support/engine/engine.domain.js +2 -0
- package/dist/application/modules/support/engine/engine.domain.js.map +1 -0
- package/dist/application/modules/support/engine/engine.types.d.ts +32 -0
- package/dist/application/modules/support/engine/engine.types.js +2 -0
- package/dist/application/modules/support/engine/engine.types.js.map +1 -0
- package/dist/application/modules/support/engine/engine.utils.d.ts +65 -0
- package/dist/application/modules/support/engine/engine.utils.js +135 -0
- package/dist/application/modules/support/engine/engine.utils.js.map +1 -0
- package/dist/application/modules/support/engine/index.d.ts +3 -0
- package/dist/application/modules/support/engine/index.js +2 -0
- package/dist/application/modules/support/engine/index.js.map +1 -0
- package/dist/application/modules/support/permissions/PermissionsService.d.ts +55 -55
- package/dist/application/modules/support/permissions/PermissionsService.js +183 -183
- package/dist/application/modules/support/permissions/index.d.ts +4 -4
- package/dist/application/modules/support/permissions/index.js +2 -2
- package/dist/application/modules/support/permissions/permission.utils.d.ts +6 -6
- package/dist/application/modules/support/permissions/permission.utils.js +33 -33
- package/dist/application/modules/support/permissions/permissions.domain.d.ts +6 -6
- package/dist/application/modules/support/permissions/permissions.domain.js +1 -1
- package/dist/application/modules/support/permissions/permissions.types.d.ts +9 -9
- package/dist/application/modules/support/permissions/permissions.types.js +1 -1
- package/dist/application/modules/support/wasm/WasmService.d.ts +25 -25
- package/dist/application/modules/support/wasm/WasmService.js +156 -155
- package/dist/application/modules/support/wasm/WasmService.js.map +1 -1
- package/dist/application/modules/support/wasm/index.d.ts +6 -6
- package/dist/application/modules/support/wasm/index.js +8 -8
- package/dist/application/modules/support/wasm/wasm.constants.d.ts +78 -78
- package/dist/application/modules/support/wasm/wasm.constants.js +86 -86
- package/dist/application/modules/support/wasm/wasm.domain.d.ts +52 -52
- package/dist/application/modules/support/wasm/wasm.domain.js +1 -1
- package/dist/application/modules/support/wasm/wasm.types.d.ts +119 -118
- package/dist/application/modules/support/wasm/wasm.types.js +1 -1
- package/dist/application/modules/support/wasm/wasm.utils.d.ts +88 -88
- package/dist/application/modules/support/wasm/wasm.utils.js +243 -243
- package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.d.ts +28 -0
- package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.js +324 -0
- package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.js.map +1 -0
- package/dist/application/modules/support/wasm-orchestrator/index.d.ts +6 -0
- package/dist/application/modules/support/wasm-orchestrator/index.js +9 -0
- package/dist/application/modules/support/wasm-orchestrator/index.js.map +1 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.d.ts +36 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.js +44 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.js.map +1 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.d.ts +47 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.js +2 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.js.map +1 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.d.ts +136 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.js +2 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.js.map +1 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.d.ts +91 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.js +250 -0
- package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.js.map +1 -0
- package/dist/application/workers/index.d.ts +42 -42
- package/dist/application/workers/index.js +8 -8
- package/dist/application/workers/wasm/WasmWorkerService.d.ts +66 -0
- package/dist/application/workers/wasm/WasmWorkerService.js +801 -0
- package/dist/application/workers/wasm/WasmWorkerService.js.map +1 -0
- package/dist/application/workers/wasm/index.d.ts +4 -0
- package/dist/application/workers/wasm/index.js +9 -0
- package/dist/application/workers/wasm/index.js.map +1 -0
- package/dist/application/workers/wasm/wasm-worker.constants.d.ts +5 -0
- package/dist/application/workers/wasm/wasm-worker.constants.js +6 -0
- package/dist/application/workers/wasm/wasm-worker.constants.js.map +1 -0
- package/dist/application/workers/wasm/wasm-worker.domain.d.ts +99 -0
- package/dist/application/workers/wasm/wasm-worker.domain.js +2 -0
- package/dist/application/workers/wasm/wasm-worker.domain.js.map +1 -0
- package/dist/application/workers/wasm/wasm-worker.types.d.ts +88 -0
- package/dist/application/workers/wasm/wasm-worker.types.js +2 -0
- package/dist/application/workers/wasm/wasm-worker.types.js.map +1 -0
- package/dist/application/workers/wasm/wasm-worker.utils.d.ts +10 -0
- package/dist/application/workers/wasm/wasm-worker.utils.js +130 -0
- package/dist/application/workers/wasm/wasm-worker.utils.js.map +1 -0
- package/dist/buildConfig.d.ts +3 -0
- package/dist/buildConfig.js +7 -0
- package/dist/buildConfig.js.map +1 -0
- package/dist/cameraUtils.d.ts +77 -77
- package/dist/cameraUtils.js +361 -361
- package/dist/constants.d.ts +9 -9
- package/dist/constants.js +13 -13
- package/dist/createCallback.d.ts +56 -56
- package/dist/createCallback.js +332 -331
- package/dist/createCallback.js.map +1 -1
- package/dist/dbUtils.d.ts +14 -14
- package/dist/dbUtils.js +148 -148
- package/dist/envUtils.d.ts +4 -4
- package/dist/envUtils.js +16 -16
- package/dist/faceModule.d.ts +196 -196
- package/dist/faceModule.js +978 -978
- package/dist/featureFlagInit.d.ts +11 -0
- package/dist/featureFlagInit.js +44 -0
- package/dist/featureFlagInit.js.map +1 -0
- package/dist/index.d.ts +38 -38
- package/dist/index.js +82 -82
- package/dist/main.d.ts +30 -30
- package/dist/main.js +84 -84
- package/dist/types.d.ts +139 -139
- package/dist/types.js +77 -77
- package/dist/utils.d.ts +84 -84
- package/dist/utils.js +580 -580
- package/package.json +102 -102
- package/wasm/ultra/nosimd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.js +18 -18
- package/wasm/ultra/nosimd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.wasm +0 -0
- package/wasm/ultra/nosimd/version.json +2 -2
- package/wasm/ultra/simd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.js +18 -18
- package/wasm/ultra/simd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.wasm +0 -0
- package/wasm/ultra/simd/version.json +2 -2
- package/workers/comlink.min.js +7 -7
- package/workers/comlink.min.js.map +1 -1
- package/workers/wasm.worker.js +936 -924
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export type WasmLoadResult = {
|
|
2
|
+
support: boolean;
|
|
3
|
+
message?: string;
|
|
4
|
+
};
|
|
5
|
+
type ApiUrl = {
|
|
6
|
+
collections: {
|
|
7
|
+
default: {
|
|
8
|
+
named_urls: {
|
|
9
|
+
base_url: string;
|
|
10
|
+
predict?: string;
|
|
11
|
+
enroll?: string;
|
|
12
|
+
validate_api_key?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type WasmModuleParams = {
|
|
18
|
+
apiUrl: ApiUrl;
|
|
19
|
+
sessionToken: string;
|
|
20
|
+
publicKey: string;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
useCdn?: boolean;
|
|
23
|
+
usageScenario?: string;
|
|
24
|
+
shouldRegenerateSession?: boolean;
|
|
25
|
+
wasmFailureCallback?: (result: any) => void;
|
|
26
|
+
skipSimdCheck?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type EnrollConfig = {
|
|
29
|
+
input_image_format: string;
|
|
30
|
+
angle_rotation_left_threshold: number;
|
|
31
|
+
angle_rotation_right_threshold: number;
|
|
32
|
+
threshold_high_vertical_enroll: number;
|
|
33
|
+
threshold_down_vertical_enroll: number;
|
|
34
|
+
anti_spoofing_threshold: number;
|
|
35
|
+
threshold_profile_enroll: number;
|
|
36
|
+
blur_threshold_enroll_pred: number;
|
|
37
|
+
threshold_user_too_close: number;
|
|
38
|
+
threshold_user_too_far: number;
|
|
39
|
+
allow_only_one_face: boolean;
|
|
40
|
+
threshold_user_up: number;
|
|
41
|
+
threshold_user_down: number;
|
|
42
|
+
threshold_user_left: number;
|
|
43
|
+
threshold_user_right: number;
|
|
44
|
+
};
|
|
45
|
+
export type PredictConfig = {
|
|
46
|
+
input_image_format: string;
|
|
47
|
+
angle_rotation_left_threshold: number;
|
|
48
|
+
angle_rotation_right_threshold: number;
|
|
49
|
+
anti_spoofing_threshold: number;
|
|
50
|
+
threshold_profile_predict: number;
|
|
51
|
+
blur_threshold_enroll_pred: number;
|
|
52
|
+
threshold_user_too_close: number;
|
|
53
|
+
threshold_user_too_far: number;
|
|
54
|
+
threshold_user_up: number;
|
|
55
|
+
threshold_user_down: number;
|
|
56
|
+
threshold_user_left: number;
|
|
57
|
+
threshold_user_right: number;
|
|
58
|
+
threshold_high_vertical_predict: number;
|
|
59
|
+
threshold_down_vertical_predict: number;
|
|
60
|
+
url_name_override: string;
|
|
61
|
+
disallowed_results: number[];
|
|
62
|
+
disable_predict_mf: boolean;
|
|
63
|
+
mf_count_override: number;
|
|
64
|
+
};
|
|
65
|
+
export type DocumentScanConfig = {
|
|
66
|
+
input_image_format: string;
|
|
67
|
+
fingers_over_document_threshold?: number;
|
|
68
|
+
document_scan_barcode_only?: boolean;
|
|
69
|
+
detect_barcode_without_parsing?: boolean;
|
|
70
|
+
detect_document_only?: boolean;
|
|
71
|
+
};
|
|
72
|
+
export type DocumentOcrConfig = {
|
|
73
|
+
input_image_format: string;
|
|
74
|
+
calculate_age_from_ocr_text: boolean;
|
|
75
|
+
threshold_doc_x: number;
|
|
76
|
+
threshold_doc_y: number;
|
|
77
|
+
threshold_doc_too_close: number;
|
|
78
|
+
threshold_doc_too_far: number;
|
|
79
|
+
};
|
|
80
|
+
export type AgeEstimationConfig = {
|
|
81
|
+
anti_spoofing_threshold: number;
|
|
82
|
+
mf_count_override: number;
|
|
83
|
+
disable_estimate_age_mf: boolean;
|
|
84
|
+
threshold_user_too_close: number;
|
|
85
|
+
threshold_profile_enroll: number;
|
|
86
|
+
threshold_user_too_far: number;
|
|
87
|
+
allow_only_one_face: boolean;
|
|
88
|
+
};
|
|
89
|
+
export type CompareEmbeddingsConfig = {
|
|
90
|
+
encrypt_compare_result?: boolean;
|
|
91
|
+
};
|
|
92
|
+
export type WasmCallbackResult = {
|
|
93
|
+
operation: string;
|
|
94
|
+
id: string;
|
|
95
|
+
response_str: any;
|
|
96
|
+
};
|
|
97
|
+
export type WasmResultCallback = (operation: string, id: string, response_str: any) => void;
|
|
98
|
+
export type EncryptionResult = {
|
|
99
|
+
encryptedKey: string;
|
|
100
|
+
iv: string;
|
|
101
|
+
gcmAad: string;
|
|
102
|
+
gcmTag: string;
|
|
103
|
+
encrptedMessage: string;
|
|
104
|
+
};
|
|
105
|
+
export type WorkerFunctions = {
|
|
106
|
+
isLoad: (simd: boolean, url: any, sessionToken: string, publicKey: string, debugType: string, cacheConfig: boolean, timeout: number | null, useCdn: boolean, shouldRegenerateSession?: boolean, wasmFailureCallback?: any, usageScenario?: string, cacheContent?: string) => Promise<string>;
|
|
107
|
+
ultraPredict: any;
|
|
108
|
+
ultraEnroll: any;
|
|
109
|
+
ultraAgeEstimate: any;
|
|
110
|
+
pkiEncrypt: any;
|
|
111
|
+
freeMemory: any;
|
|
112
|
+
ultraCompareEmbeddings: any;
|
|
113
|
+
ultraScanFrontDocument: any;
|
|
114
|
+
ultraScanBackDocument: any;
|
|
115
|
+
ultraDocumentOcr: any;
|
|
116
|
+
};
|
|
117
|
+
export type CompareEmbeddingsParams = {
|
|
118
|
+
documentEmbeddings: string;
|
|
119
|
+
enrollEmbeddings: string;
|
|
120
|
+
config: Record<string, unknown>;
|
|
121
|
+
callback: WasmResultCallback;
|
|
122
|
+
encryptCompareResult?: boolean;
|
|
123
|
+
};
|
|
124
|
+
export type ScanFrontPhotoIdParams = {
|
|
125
|
+
imageData: ImageData;
|
|
126
|
+
config: string;
|
|
127
|
+
callback: WasmResultCallback;
|
|
128
|
+
};
|
|
129
|
+
export type ScanPassportParams = ScanFrontPhotoIdParams;
|
|
130
|
+
export type ScanBackPhotoIdParams = {
|
|
131
|
+
imageData: ImageData;
|
|
132
|
+
isSimd: boolean;
|
|
133
|
+
config: string;
|
|
134
|
+
callback: WasmResultCallback;
|
|
135
|
+
};
|
|
136
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-orchestrator.types.js","sourceRoot":"","sources":["../../../../../src/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { WasmLoadResult, EnrollConfig, PredictConfig, AgeEstimationConfig, DocumentScanConfig, DocumentOcrConfig } from './wasm-orchestrator.types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if the current browser supports WASM
|
|
4
|
+
*/
|
|
5
|
+
export declare function checkBrowserCompatibility(): WasmLoadResult;
|
|
6
|
+
/**
|
|
7
|
+
* Determine if SIMD should be enabled based on browser and OS
|
|
8
|
+
*/
|
|
9
|
+
export declare function shouldEnableSimd(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Get default enrollment configuration
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDefaultEnrollConfig(): Partial<EnrollConfig>;
|
|
14
|
+
/**
|
|
15
|
+
* Get enrollment configuration optimized for mobile
|
|
16
|
+
*/
|
|
17
|
+
export declare function getMobileEnrollConfig(): Partial<EnrollConfig>;
|
|
18
|
+
/**
|
|
19
|
+
* Get enrollment configuration with user overrides
|
|
20
|
+
*/
|
|
21
|
+
export declare function getEnrollConfig(userConfig?: Partial<EnrollConfig>, isMobile?: boolean): Partial<EnrollConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* Get default prediction configuration
|
|
24
|
+
*/
|
|
25
|
+
export declare function getDefaultPredictConfig(): Partial<PredictConfig>;
|
|
26
|
+
/**
|
|
27
|
+
* Get prediction configuration with user overrides
|
|
28
|
+
*/
|
|
29
|
+
export declare function getPredictConfig(userConfig?: Partial<PredictConfig>): Partial<PredictConfig>;
|
|
30
|
+
/**
|
|
31
|
+
* Get default age estimation configuration
|
|
32
|
+
*/
|
|
33
|
+
export declare function getDefaultAgeEstimationConfig(): Partial<AgeEstimationConfig>;
|
|
34
|
+
/**
|
|
35
|
+
* Get age estimation configuration with user overrides
|
|
36
|
+
*/
|
|
37
|
+
export declare function getAgeEstimationConfig(userConfig?: Partial<AgeEstimationConfig>): Partial<AgeEstimationConfig>;
|
|
38
|
+
/**
|
|
39
|
+
* Get default document scan configuration
|
|
40
|
+
*/
|
|
41
|
+
export declare function getDefaultDocumentScanConfig(): DocumentScanConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Get document scan configuration with user overrides
|
|
44
|
+
*/
|
|
45
|
+
export declare function getDocumentScanConfig(userConfig?: Partial<DocumentScanConfig>): DocumentScanConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Get default document OCR configuration
|
|
48
|
+
*/
|
|
49
|
+
export declare function getDefaultDocumentOcrConfig(): DocumentOcrConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Get document OCR configuration with user overrides
|
|
52
|
+
*/
|
|
53
|
+
export declare function getDocumentOcrConfig(userConfig?: Partial<DocumentOcrConfig>): DocumentOcrConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Convert configuration object to JSON string
|
|
56
|
+
*/
|
|
57
|
+
export declare function configToJson(config: any): string;
|
|
58
|
+
/**
|
|
59
|
+
* Check if debug type enables image creation
|
|
60
|
+
*/
|
|
61
|
+
export declare function shouldCreateDebugImages(debugType: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Generate worker URL for WASM
|
|
64
|
+
*/
|
|
65
|
+
export declare function getWasmWorkerUrl(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Check if current platform is mobile for mobile-specific configurations
|
|
68
|
+
*/
|
|
69
|
+
export declare function isMobilePlatform(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Print WASM-specific logs (wrapper around shared printLogs)
|
|
72
|
+
*/
|
|
73
|
+
export declare function printWasmLogs(message: string, data?: any, type?: 'LOG' | 'WARN' | 'ERROR'): void;
|
|
74
|
+
/**
|
|
75
|
+
* Create debug images for WASM operations
|
|
76
|
+
*/
|
|
77
|
+
export declare function createWasmDebugImages(images: ImageData[], title: string, operation: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Get URL parameter
|
|
80
|
+
*/
|
|
81
|
+
export declare function getUrlParameter(sParam: string, defaultValue: string): string;
|
|
82
|
+
export declare function handleCacheContent(): Promise<string>;
|
|
83
|
+
export declare function checkLoadSimdBuild(): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Get SIMD support status
|
|
86
|
+
*/
|
|
87
|
+
export declare function checkSimdSupport(): Promise<boolean>;
|
|
88
|
+
export declare function checkSimdSupportForSafariVersion(version: string): boolean;
|
|
89
|
+
export declare function createCallbackError({ callback }: {
|
|
90
|
+
callback: any;
|
|
91
|
+
}): (errorCode: any) => void;
|
|
@@ -0,0 +1,250 @@
|
|
|
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
|
+
import { detect } from 'detect-browser';
|
|
11
|
+
import { simd } from 'wasm-feature-detect';
|
|
12
|
+
import { DEFAULT_ENROLL_CONFIG, DEFAULT_PREDICT_CONFIG, DEFAULT_AGE_ESTIMATION_CONFIG, DEFAULT_DOCUMENT_SCAN_CONFIG, DEFAULT_DOCUMENT_OCR_CONFIG, BROWSER_COMPATIBILITY_MESSAGES, SAFARI_MIN_VERSION_FOR_SIMD, SAFARI_MIN_SUBVERSION_FOR_SIMD, } from './wasm-orchestrator.constants';
|
|
13
|
+
import { iOS, isMobileDevice, printLogs, getDebugType, imageDataToBase64 } from '../../global/shared.utils';
|
|
14
|
+
import { clearDB } from '../../../../dbUtils';
|
|
15
|
+
/**
|
|
16
|
+
* Check if the current browser supports WASM
|
|
17
|
+
*/
|
|
18
|
+
export function checkBrowserCompatibility() {
|
|
19
|
+
const { name: browserName, version, os } = detect();
|
|
20
|
+
// Mobile checks
|
|
21
|
+
if (os === 'iOS' || iOS()) {
|
|
22
|
+
if (browserName === 'opera' && parseInt(version.split('.')[0], 10) <= 72) {
|
|
23
|
+
return { support: false, message: BROWSER_COMPATIBILITY_MESSAGES.OPERA_MOBILE_NOT_SUPPORTED };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (os === 'Android OS') {
|
|
27
|
+
if (browserName === 'opera' && parseInt(version.split('.')[0], 10) <= 72) {
|
|
28
|
+
return { support: false, message: BROWSER_COMPATIBILITY_MESSAGES.OPERA_MOBILE_NOT_SUPPORTED };
|
|
29
|
+
}
|
|
30
|
+
if (browserName === 'android' && parseInt(version.split('.')[0], 10) <= 96) {
|
|
31
|
+
return { support: false, message: BROWSER_COMPATIBILITY_MESSAGES.ANDROID_BROWSER_NOT_SUPPORTED };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Desktop browser checks
|
|
35
|
+
if (browserName === 'chrome' && parseInt(version.split('.')[0], 10) <= 57) {
|
|
36
|
+
return { support: false, message: BROWSER_COMPATIBILITY_MESSAGES.CHROME_NOT_SUPPORTED };
|
|
37
|
+
}
|
|
38
|
+
if (browserName === 'firefox' && parseInt(version.split('.')[0], 10) <= 52) {
|
|
39
|
+
return { support: false, message: BROWSER_COMPATIBILITY_MESSAGES.FIREFOX_NOT_SUPPORTED };
|
|
40
|
+
}
|
|
41
|
+
if (browserName === 'opera' && parseInt(version.split('.')[0], 10) <= 43) {
|
|
42
|
+
return { support: false, message: BROWSER_COMPATIBILITY_MESSAGES.OPERA_NOT_SUPPORTED };
|
|
43
|
+
}
|
|
44
|
+
return { support: true };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Determine if SIMD should be enabled based on browser and OS
|
|
48
|
+
*/
|
|
49
|
+
export function shouldEnableSimd() {
|
|
50
|
+
const { name: browserName, os } = detect();
|
|
51
|
+
if (iOS() || os === 'iOS' || (os === 'Mac OS' && browserName !== 'chrome')) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get default enrollment configuration
|
|
58
|
+
*/
|
|
59
|
+
export function getDefaultEnrollConfig() {
|
|
60
|
+
return Object.assign({}, DEFAULT_ENROLL_CONFIG);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get enrollment configuration optimized for mobile
|
|
64
|
+
*/
|
|
65
|
+
export function getMobileEnrollConfig() {
|
|
66
|
+
return Object.assign({}, DEFAULT_ENROLL_CONFIG);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get enrollment configuration with user overrides
|
|
70
|
+
*/
|
|
71
|
+
export function getEnrollConfig(userConfig, isMobile = false) {
|
|
72
|
+
const baseConfig = isMobile ? getMobileEnrollConfig() : getDefaultEnrollConfig();
|
|
73
|
+
return Object.assign(Object.assign({}, baseConfig), userConfig);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get default prediction configuration
|
|
77
|
+
*/
|
|
78
|
+
export function getDefaultPredictConfig() {
|
|
79
|
+
return Object.assign({}, DEFAULT_PREDICT_CONFIG);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get prediction configuration with user overrides
|
|
83
|
+
*/
|
|
84
|
+
export function getPredictConfig(userConfig) {
|
|
85
|
+
return Object.assign(Object.assign({}, DEFAULT_PREDICT_CONFIG), userConfig);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get default age estimation configuration
|
|
89
|
+
*/
|
|
90
|
+
export function getDefaultAgeEstimationConfig() {
|
|
91
|
+
return Object.assign({}, DEFAULT_AGE_ESTIMATION_CONFIG);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get age estimation configuration with user overrides
|
|
95
|
+
*/
|
|
96
|
+
export function getAgeEstimationConfig(userConfig) {
|
|
97
|
+
return Object.assign(Object.assign({}, DEFAULT_AGE_ESTIMATION_CONFIG), userConfig);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get default document scan configuration
|
|
101
|
+
*/
|
|
102
|
+
export function getDefaultDocumentScanConfig() {
|
|
103
|
+
return Object.assign({}, DEFAULT_DOCUMENT_SCAN_CONFIG);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get document scan configuration with user overrides
|
|
107
|
+
*/
|
|
108
|
+
export function getDocumentScanConfig(userConfig) {
|
|
109
|
+
return Object.assign(Object.assign({}, DEFAULT_DOCUMENT_SCAN_CONFIG), userConfig);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get default document OCR configuration
|
|
113
|
+
*/
|
|
114
|
+
export function getDefaultDocumentOcrConfig() {
|
|
115
|
+
return Object.assign({}, DEFAULT_DOCUMENT_OCR_CONFIG);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get document OCR configuration with user overrides
|
|
119
|
+
*/
|
|
120
|
+
export function getDocumentOcrConfig(userConfig) {
|
|
121
|
+
return Object.assign(Object.assign({}, DEFAULT_DOCUMENT_OCR_CONFIG), userConfig);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Convert configuration object to JSON string
|
|
125
|
+
*/
|
|
126
|
+
export function configToJson(config) {
|
|
127
|
+
return JSON.stringify(config);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if debug type enables image creation
|
|
131
|
+
*/
|
|
132
|
+
export function shouldCreateDebugImages(debugType) {
|
|
133
|
+
return ['900', '901', '902', '903'].includes(debugType);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Generate worker URL for WASM
|
|
137
|
+
*/
|
|
138
|
+
export function getWasmWorkerUrl() {
|
|
139
|
+
var _a;
|
|
140
|
+
const windowOrigin = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin;
|
|
141
|
+
return `${windowOrigin}/workers/wasm.worker.js`;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Check if current platform is mobile for mobile-specific configurations
|
|
145
|
+
*/
|
|
146
|
+
export function isMobilePlatform() {
|
|
147
|
+
return isMobileDevice();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Print WASM-specific logs (wrapper around shared printLogs)
|
|
151
|
+
*/
|
|
152
|
+
export function printWasmLogs(message, data = '', type = 'LOG') {
|
|
153
|
+
printLogs(`WASM: ${message}`, data, type);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Create debug images for WASM operations
|
|
157
|
+
*/
|
|
158
|
+
export function createWasmDebugImages(images, title, operation) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const debugType = getDebugType();
|
|
161
|
+
if (!shouldCreateDebugImages(debugType)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const promises = images.map((imageData) => imageDataToBase64(imageData));
|
|
165
|
+
const base64Images = yield Promise.all(promises);
|
|
166
|
+
base64Images.forEach((base64, index) => {
|
|
167
|
+
const a = document.createElement('a');
|
|
168
|
+
a.href = base64;
|
|
169
|
+
a.download = `${title}_${operation}_${index}.png`;
|
|
170
|
+
document.body.appendChild(a);
|
|
171
|
+
a.click();
|
|
172
|
+
document.body.removeChild(a);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get URL parameter
|
|
178
|
+
*/
|
|
179
|
+
export function getUrlParameter(sParam, defaultValue) {
|
|
180
|
+
const sPageURL = window.location.search.substring(1);
|
|
181
|
+
const sURLVariables = sPageURL.split('&');
|
|
182
|
+
let sParameterName;
|
|
183
|
+
let i;
|
|
184
|
+
for (i = 0; i < sURLVariables.length; i++) {
|
|
185
|
+
sParameterName = sURLVariables[i].split('=');
|
|
186
|
+
if (sParameterName[0] === sParam) {
|
|
187
|
+
return typeof sParameterName[1] === undefined ? defaultValue : decodeURIComponent(sParameterName[1]);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return defaultValue;
|
|
191
|
+
}
|
|
192
|
+
export function handleCacheContent() {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
const clearCacheParam = getUrlParameter('clear_cache', 'false');
|
|
195
|
+
const cacheAge = localStorage.getItem('cacheAge');
|
|
196
|
+
const cacheContent = localStorage.getItem('cache_content') || '';
|
|
197
|
+
if (!cacheAge) {
|
|
198
|
+
localStorage.setItem('cacheAge', Date.now().toString());
|
|
199
|
+
}
|
|
200
|
+
if ((cacheAge && Date.now() - Number(cacheAge) > 24 * 60 * 60 * 1000) || clearCacheParam === 'true') {
|
|
201
|
+
printLogs('ClearingCache', '');
|
|
202
|
+
yield clearDB();
|
|
203
|
+
localStorage.clear();
|
|
204
|
+
localStorage.setItem('cacheAge', Date.now().toString());
|
|
205
|
+
}
|
|
206
|
+
return cacheContent;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
export function checkLoadSimdBuild() {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
const hasSIMDSupport = yield checkSimdSupport();
|
|
212
|
+
printLogs(`Is SIMD:' ${hasSIMDSupport}`, '');
|
|
213
|
+
const { name: browserName, version } = detect();
|
|
214
|
+
if (browserName === 'safari') {
|
|
215
|
+
return checkSimdSupportForSafariVersion(version);
|
|
216
|
+
}
|
|
217
|
+
return hasSIMDSupport;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get SIMD support status
|
|
222
|
+
*/
|
|
223
|
+
export function checkSimdSupport() {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
try {
|
|
226
|
+
const simdSupport = yield simd();
|
|
227
|
+
printLogs('SIMD support', simdSupport);
|
|
228
|
+
return simdSupport;
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
export function checkSimdSupportForSafariVersion(version) {
|
|
236
|
+
const versionAsArray = version.split('.');
|
|
237
|
+
const parsedVersion = parseInt(versionAsArray[0], 10);
|
|
238
|
+
const parsedSubVersion = parseInt(versionAsArray[1], 10);
|
|
239
|
+
if (parsedVersion < SAFARI_MIN_VERSION_FOR_SIMD && parsedSubVersion < SAFARI_MIN_SUBVERSION_FOR_SIMD) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
export function createCallbackError({ callback }) {
|
|
245
|
+
return (errorCode) => {
|
|
246
|
+
printLogs(`Callback error! Error code: `, errorCode, 'ERROR');
|
|
247
|
+
callback(errorCode);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=wasm-orchestrator.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-orchestrator.utils.js","sourceRoot":"","sources":["../../../../../src/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAS3C,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,EAC9B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;IAEpD,gBAAgB;IAChB,IAAI,EAAE,KAAK,KAAK,IAAI,GAAG,EAAE,EAAE;QACzB,IAAI,WAAW,KAAK,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;YACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B,CAAC,0BAA0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M,WAAW,GAAG,MAAM,IAAI,EAAE,CAAC;YACjC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YACvC,OAAO,WAAW,CAAC;SACpB;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CAAA;AAED,MAAM,UAAU,gCAAgC,CAAC,OAAe;IAC9D,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,aAAa,GAAG,2BAA2B,IAAI,gBAAgB,GAAG,8BAA8B,EAAE;QACpG,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAqB;IACjE,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,42 +1,42 @@
|
|
|
1
|
-
export declare const isLoad: (simd: boolean, url: any, session_token: string, public_key: string, debug_type: string, cacheConfig: boolean, timeout: number, useCdn: boolean, shouldRegenerateSession?: boolean, wasmFailureCallback?: any, usageScenario?: string, cacheContent?: string) => Promise<string>, ultraEnroll: (imageData: ImageData, simd: boolean, config: string, cb: any) => Promise<{
|
|
2
|
-
result: number;
|
|
3
|
-
imageData: Uint8ClampedArray;
|
|
4
|
-
height: number;
|
|
5
|
-
width: number;
|
|
6
|
-
}>, ultraPredict: (originalImages: ImageData[], simd: boolean, config: string, cb: any) => Promise<{
|
|
7
|
-
result: number;
|
|
8
|
-
href: ImageData[];
|
|
9
|
-
}>, compareEmbeddings: () => Promise<{
|
|
10
|
-
result: number;
|
|
11
|
-
imageData: Uint8ClampedArray;
|
|
12
|
-
height: number;
|
|
13
|
-
width: number;
|
|
14
|
-
}>, pkiEncrypt: (payload: string) => Promise<{
|
|
15
|
-
call_status: {
|
|
16
|
-
return_status: number;
|
|
17
|
-
operation_tag: string;
|
|
18
|
-
return_message: string;
|
|
19
|
-
mf_token: string;
|
|
20
|
-
operation_id: number;
|
|
21
|
-
operation_type_id: number;
|
|
22
|
-
};
|
|
23
|
-
uber_operation_result: {
|
|
24
|
-
request: string[];
|
|
25
|
-
};
|
|
26
|
-
}>, checkIfModelsLoaded: (isEnroll: boolean) => Promise<number>, ultraScanBackDocument: (inputImage: ImageData, simd: boolean, config: string, cb: any) => Promise<{
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
}>, ultraScanFrontDocument: (inputImage: ImageData, simd: boolean, config: string, cb: any) => Promise<{
|
|
29
|
-
[x: string]: any;
|
|
30
|
-
}>, ultraCompareEmbeddings: (encryptedEmbeddingsA: string, encryptedEmbeddingsB: string, config: any, cb: any) => Promise<{
|
|
31
|
-
result: number;
|
|
32
|
-
imageData: Uint8ClampedArray;
|
|
33
|
-
height: number;
|
|
34
|
-
width: number;
|
|
35
|
-
}>, ultraAgeEstimate: (imageData: ImageData[], simd: boolean, config: string, cb: any) => Promise<{
|
|
36
|
-
result: number;
|
|
37
|
-
imageData: Uint8ClampedArray;
|
|
38
|
-
height: number;
|
|
39
|
-
width: number;
|
|
40
|
-
}>, ultraDocumentOcr: (inputImage: string, config: string, cb: any) => Promise<{
|
|
41
|
-
[x: string]: any;
|
|
42
|
-
}>, freeMemory: () => Promise<boolean>;
|
|
1
|
+
export declare const isLoad: (simd: boolean, url: any, session_token: string, public_key: string, debug_type: string, cacheConfig: boolean, timeout: number, useCdn: boolean, shouldRegenerateSession?: boolean, wasmFailureCallback?: any, usageScenario?: string, cacheContent?: string) => Promise<string>, ultraEnroll: (imageData: ImageData, simd: boolean, config: string, cb: any) => Promise<{
|
|
2
|
+
result: number;
|
|
3
|
+
imageData: Uint8ClampedArray;
|
|
4
|
+
height: number;
|
|
5
|
+
width: number;
|
|
6
|
+
}>, ultraPredict: (originalImages: ImageData[], simd: boolean, config: string, cb: any) => Promise<{
|
|
7
|
+
result: number;
|
|
8
|
+
href: ImageData[];
|
|
9
|
+
}>, compareEmbeddings: () => Promise<{
|
|
10
|
+
result: number;
|
|
11
|
+
imageData: Uint8ClampedArray;
|
|
12
|
+
height: number;
|
|
13
|
+
width: number;
|
|
14
|
+
}>, pkiEncrypt: (payload: string) => Promise<{
|
|
15
|
+
call_status: {
|
|
16
|
+
return_status: number;
|
|
17
|
+
operation_tag: string;
|
|
18
|
+
return_message: string;
|
|
19
|
+
mf_token: string;
|
|
20
|
+
operation_id: number;
|
|
21
|
+
operation_type_id: number;
|
|
22
|
+
};
|
|
23
|
+
uber_operation_result: {
|
|
24
|
+
request: string[];
|
|
25
|
+
};
|
|
26
|
+
}>, checkIfModelsLoaded: (isEnroll: boolean) => Promise<number>, ultraScanBackDocument: (inputImage: ImageData, simd: boolean, config: string, cb: any) => Promise<{
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
}>, ultraScanFrontDocument: (inputImage: ImageData, simd: boolean, config: string, cb: any) => Promise<{
|
|
29
|
+
[x: string]: any;
|
|
30
|
+
}>, ultraCompareEmbeddings: (encryptedEmbeddingsA: string, encryptedEmbeddingsB: string, config: any, cb: any) => Promise<{
|
|
31
|
+
result: number;
|
|
32
|
+
imageData: Uint8ClampedArray;
|
|
33
|
+
height: number;
|
|
34
|
+
width: number;
|
|
35
|
+
}>, ultraAgeEstimate: (imageData: ImageData[], simd: boolean, config: string, cb: any) => Promise<{
|
|
36
|
+
result: number;
|
|
37
|
+
imageData: Uint8ClampedArray;
|
|
38
|
+
height: number;
|
|
39
|
+
width: number;
|
|
40
|
+
}>, ultraDocumentOcr: (inputImage: string, config: string, cb: any) => Promise<{
|
|
41
|
+
[x: string]: any;
|
|
42
|
+
}>, freeMemory: () => Promise<boolean>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import { wrap } from 'comlink';
|
|
3
|
-
import { printLogs } from '../modules/global/shared.utils';
|
|
4
|
-
const windowOrigin = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin;
|
|
5
|
-
const workerUrl = `${windowOrigin}/workers/wasm.worker.js`;
|
|
6
|
-
printLogs('WorkerUrl', workerUrl);
|
|
7
|
-
const functions = wrap(new Worker(workerUrl));
|
|
8
|
-
export const { isLoad, ultraEnroll, ultraPredict, compareEmbeddings, pkiEncrypt, checkIfModelsLoaded, ultraScanBackDocument, ultraScanFrontDocument, ultraCompareEmbeddings, ultraAgeEstimate, ultraDocumentOcr, freeMemory, } = functions;
|
|
1
|
+
var _a;
|
|
2
|
+
import { wrap } from 'comlink';
|
|
3
|
+
import { printLogs } from '../modules/global/shared.utils';
|
|
4
|
+
const windowOrigin = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin;
|
|
5
|
+
const workerUrl = `${windowOrigin}/workers/wasm.worker.js`;
|
|
6
|
+
printLogs('WorkerUrl', workerUrl);
|
|
7
|
+
const functions = wrap(new Worker(workerUrl));
|
|
8
|
+
export const { isLoad, ultraEnroll, ultraPredict, compareEmbeddings, pkiEncrypt, checkIfModelsLoaded, ultraScanBackDocument, ultraScanFrontDocument, ultraCompareEmbeddings, ultraAgeEstimate, ultraDocumentOcr, freeMemory, } = functions;
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { WasmPrividModules, WasmWorker } from './wasm-worker.domain';
|
|
2
|
+
import { LoadParams, EnrollParams, PredictParams, AgeEstimateParams, CompareEmbeddingsParams, PkiEncryptParams, ScanBackDocumentParams, ScanFrontDocumentParams, DocumentOcrParams, ProxiedCallback, RegularCallback } from './wasm-worker.types';
|
|
3
|
+
declare global {
|
|
4
|
+
function createTFLiteModule(config: {
|
|
5
|
+
wasmBinary: ArrayBuffer;
|
|
6
|
+
}): Promise<WasmPrividModules>;
|
|
7
|
+
function privid_wasm_result(operation: string, id: string, response_str: string): void;
|
|
8
|
+
function privid_wasm_error(operation: string, id: string, error_str: string): void;
|
|
9
|
+
function privid_wasm_progress(progress_type: number, message: string, progress_value: number): void;
|
|
10
|
+
function privid_wasm_cropping(base64Image: string): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class WasmWorkerService implements WasmWorker {
|
|
13
|
+
private wasmPrividModules;
|
|
14
|
+
private apiUrl;
|
|
15
|
+
private sessionToken;
|
|
16
|
+
private publicKey;
|
|
17
|
+
private debugType;
|
|
18
|
+
private inputPtr;
|
|
19
|
+
private imageInputSize;
|
|
20
|
+
private barCodePtr;
|
|
21
|
+
private proxiedResultCallback;
|
|
22
|
+
private proxiedErrorCallback;
|
|
23
|
+
private proxiedProgressCallback;
|
|
24
|
+
private wasmSession;
|
|
25
|
+
private setCache;
|
|
26
|
+
private checkWasmLoaded;
|
|
27
|
+
private antispoofVersion;
|
|
28
|
+
private readonly cdnUrl;
|
|
29
|
+
private useCdnLink;
|
|
30
|
+
private isSimd;
|
|
31
|
+
loadModules(params: LoadParams, errorCallback: ProxiedCallback, progressCallback?: ProxiedCallback): Promise<string>;
|
|
32
|
+
private loadFromPackage;
|
|
33
|
+
private loadWasmModule;
|
|
34
|
+
private initializeWasmSession;
|
|
35
|
+
ultraEnroll(params: EnrollParams, resultCallback: RegularCallback): Promise<boolean>;
|
|
36
|
+
ultraPredict(params: PredictParams, resultCallback: RegularCallback, onAntiSpoofProgress?: RegularCallback): Promise<boolean>;
|
|
37
|
+
ultraAgeEstimate(params: AgeEstimateParams, resultCallback: (...args: unknown[]) => void, onAntiSpoofProgress?: (...args: unknown[]) => void, onWasmCroppingCallback?: (base64Image: string) => void): Promise<boolean>;
|
|
38
|
+
ultraCompareEmbeddings(params: CompareEmbeddingsParams, resultCallback: RegularCallback): Promise<boolean>;
|
|
39
|
+
pkiEncrypt(params: PkiEncryptParams): string | {
|
|
40
|
+
error: boolean;
|
|
41
|
+
};
|
|
42
|
+
ultraScanBackDocument(params: ScanBackDocumentParams, resultCallback: RegularCallback): Promise<boolean>;
|
|
43
|
+
ultraScanFrontDocument(params: ScanFrontDocumentParams, resultCallback: RegularCallback): Promise<boolean>;
|
|
44
|
+
ultraDocumentOcr(params: DocumentOcrParams, resultCallback: RegularCallback): Promise<boolean>;
|
|
45
|
+
checkModelsAreLoaded(): Promise<boolean>;
|
|
46
|
+
freeMemory(): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Creates pointers for WASM function results.
|
|
49
|
+
* This helper manages outer and inner pointers for functions that return results via pointer arguments.
|
|
50
|
+
*
|
|
51
|
+
* @returns Object with methods to get outer and inner pointers
|
|
52
|
+
*/
|
|
53
|
+
private createWasmResultPointers;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a managed string buffer for WASM function calls.
|
|
56
|
+
* This helper allocates WASM memory for string arguments and provides automatic cleanup.
|
|
57
|
+
* It converts JavaScript strings to UTF-8 encoded bytes that can be passed to WASM functions.
|
|
58
|
+
*
|
|
59
|
+
* @param text - The string value to encode (null/undefined will result in [0, 0] args)
|
|
60
|
+
* @returns Object with methods to get pointer arguments and free memory
|
|
61
|
+
|
|
62
|
+
*/
|
|
63
|
+
private createStringBuffer;
|
|
64
|
+
private releasePointers;
|
|
65
|
+
private allocatePointer;
|
|
66
|
+
}
|