@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
package/dist/apiUtils.js
CHANGED
|
@@ -1,923 +1,923 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// import { Base64, DLType, HCType, LOGTYPE, VerifyType } from './types';
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
import { convertPngBase64ToJpegBase64 } from './utils';
|
|
13
|
-
// const rand = () => Math.random().toString(36).substr(2);
|
|
14
|
-
// export const postImages = (image: Base64) =>
|
|
15
|
-
// fetch(`${apiUrl}/upload-img`, {
|
|
16
|
-
// method: 'POST',
|
|
17
|
-
// headers: {
|
|
18
|
-
// Accept: 'application/json',
|
|
19
|
-
// 'Content-Type': 'application/json',
|
|
20
|
-
// },
|
|
21
|
-
// body: JSON.stringify({ image }),
|
|
22
|
-
// });
|
|
23
|
-
// /**
|
|
24
|
-
// * @category Api
|
|
25
|
-
// * @param pramUuid UUID to delete
|
|
26
|
-
// * @param callback Callback called once the delete is completed
|
|
27
|
-
// */
|
|
28
|
-
// export async function deleteUuid(guid: string, callback: () => void) {
|
|
29
|
-
// const myHeaders = new Headers();
|
|
30
|
-
// myHeaders.append('Accept', 'application/json, text/plain, */*');
|
|
31
|
-
// myHeaders.append('Accept-Encoding', 'gzip, deflate, br');
|
|
32
|
-
// myHeaders.append('x-api-key', apiKey);
|
|
33
|
-
// const formdata = new FormData();
|
|
34
|
-
// formdata.append('guid', guid);
|
|
35
|
-
// formdata.append('api_key', apiKey);
|
|
36
|
-
// const requestOptions: RequestInit = {
|
|
37
|
-
// method: 'POST',
|
|
38
|
-
// headers: myHeaders,
|
|
39
|
-
// body: formdata,
|
|
40
|
-
// mode: 'no-cors',
|
|
41
|
-
// };
|
|
42
|
-
// try {
|
|
43
|
-
// await fetch(`${apiUrl}/deleteUser`, requestOptions);
|
|
44
|
-
// callback();
|
|
45
|
-
// } catch (e) {
|
|
46
|
-
// printLogs('', e, getDebugType(), LOGTYPE.ERROR);
|
|
47
|
-
// }
|
|
48
|
-
// }
|
|
49
|
-
// export async function getPhrases(): Promise<Array<string>> {
|
|
50
|
-
// const requestOptions: RequestInit = {
|
|
51
|
-
// method: 'POST',
|
|
52
|
-
// };
|
|
53
|
-
// const res = await fetch(`${apiUrl}/getLivenessPhrases`, requestOptions);
|
|
54
|
-
// return res.json();
|
|
55
|
-
// }
|
|
56
|
-
// export async function sendOTP(phone_number: string): Promise<string> {
|
|
57
|
-
// if (!phone_number) return '';
|
|
58
|
-
// const token = rand() + rand();
|
|
59
|
-
// const requestOptions: RequestInit = {
|
|
60
|
-
// method: 'POST',
|
|
61
|
-
// body: JSON.stringify({
|
|
62
|
-
// phone_number,
|
|
63
|
-
// token,
|
|
64
|
-
// api_key: apiKey,
|
|
65
|
-
// hostURL: window.location.href,
|
|
66
|
-
// customerName: 'betmgm',
|
|
67
|
-
// }),
|
|
68
|
-
// };
|
|
69
|
-
// const res = await fetch(`${apiUrl}/sendOTP`, requestOptions);
|
|
70
|
-
// return res.json();
|
|
71
|
-
// }
|
|
72
|
-
// export async function verifyOTP(otp: string, token: string): Promise<string> {
|
|
73
|
-
// const requestOptions: RequestInit = {
|
|
74
|
-
// method: 'POST',
|
|
75
|
-
// body: JSON.stringify({
|
|
76
|
-
// token,
|
|
77
|
-
// otp,
|
|
78
|
-
// }),
|
|
79
|
-
// };
|
|
80
|
-
// const res = await fetch(`${apiUrl}/verifyOTP`, requestOptions);
|
|
81
|
-
// return res.json();
|
|
82
|
-
// }
|
|
83
|
-
// type createUserProps = {
|
|
84
|
-
// id?: string;
|
|
85
|
-
// guid?: string;
|
|
86
|
-
// phone?: string;
|
|
87
|
-
// phoneVerified?: boolean;
|
|
88
|
-
// email?: string;
|
|
89
|
-
// emailVerified?: boolean;
|
|
90
|
-
// ssn4?: string;
|
|
91
|
-
// ssn9?: string;
|
|
92
|
-
// userConsent: boolean;
|
|
93
|
-
// userConsentDate: string;
|
|
94
|
-
// userFaceEnrollConsent?: boolean;
|
|
95
|
-
// consentVersion?: string;
|
|
96
|
-
// consentContent?: string;
|
|
97
|
-
// portrait?: string;
|
|
98
|
-
// };
|
|
99
|
-
// export async function createUser(payload: createUserProps): Promise<string> {
|
|
100
|
-
// const userInfo = {
|
|
101
|
-
// token: payload.id,
|
|
102
|
-
// phone: payload.phone,
|
|
103
|
-
// phoneVerified: payload.phoneVerified,
|
|
104
|
-
// email: payload.email,
|
|
105
|
-
// emailVerified: payload.emailVerified,
|
|
106
|
-
// ssn: payload.ssn4,
|
|
107
|
-
// ssn4: payload.ssn4,
|
|
108
|
-
// ssn9: payload.ssn9,
|
|
109
|
-
// userConsent: payload.userConsent,
|
|
110
|
-
// userConsentDate: payload.userConsentDate,
|
|
111
|
-
// userFaceEnrollConsent: payload.userFaceEnrollConsent,
|
|
112
|
-
// consentVersion: payload.consentVersion,
|
|
113
|
-
// consentContent: payload.consentContent,
|
|
114
|
-
// };
|
|
115
|
-
// const requestOptions: RequestInit = {
|
|
116
|
-
// method: 'POST',
|
|
117
|
-
// body: JSON.stringify(userInfo),
|
|
118
|
-
// headers: {
|
|
119
|
-
// 'x-api-key': apiKey,
|
|
120
|
-
// 'Content-Type': 'application/json',
|
|
121
|
-
// },
|
|
122
|
-
// };
|
|
123
|
-
// const res = await fetch(`${apiUrl}/user/create`, requestOptions);
|
|
124
|
-
// return res.json();
|
|
125
|
-
// }
|
|
126
|
-
// export async function sendEmail(email: string, uuid: string, skin: string, customerName: string): Promise<string> {
|
|
127
|
-
// const token = rand() + rand();
|
|
128
|
-
// const requestOptions: RequestInit = {
|
|
129
|
-
// method: 'POST',
|
|
130
|
-
// body: JSON.stringify({
|
|
131
|
-
// skin,
|
|
132
|
-
// customerName,
|
|
133
|
-
// alias: uuid,
|
|
134
|
-
// hostUrl: window.location.href,
|
|
135
|
-
// version: '1.0',
|
|
136
|
-
// api_key: apiKey,
|
|
137
|
-
// email_address: email,
|
|
138
|
-
// token,
|
|
139
|
-
// action: 'exact_url',
|
|
140
|
-
// }),
|
|
141
|
-
// headers: {
|
|
142
|
-
// 'Content-Type': 'application/json',
|
|
143
|
-
// 'x-api-key': apiKey,
|
|
144
|
-
// },
|
|
145
|
-
// };
|
|
146
|
-
// const res = await fetch(`${apiUrl}/requestAuthLink`, requestOptions);
|
|
147
|
-
// return res.json();
|
|
148
|
-
// }
|
|
149
|
-
// export async function expandUri(shortUrl: string): Promise<string> {
|
|
150
|
-
// const requestOptions: RequestInit = {
|
|
151
|
-
// method: 'POST',
|
|
152
|
-
// body: JSON.stringify({
|
|
153
|
-
// shortUrl,
|
|
154
|
-
// api_key: apiKey,
|
|
155
|
-
// }),
|
|
156
|
-
// headers: {
|
|
157
|
-
// 'Content-Type': 'application/json',
|
|
158
|
-
// 'x-api-key': apiKey,
|
|
159
|
-
// },
|
|
160
|
-
// };
|
|
161
|
-
// const res = await fetch(`${apiUrl}/expandUri`, requestOptions);
|
|
162
|
-
// return res.json();
|
|
163
|
-
// }
|
|
164
|
-
// type VerifyTokenProps = {
|
|
165
|
-
// code: string;
|
|
166
|
-
// type: VerifyType;
|
|
167
|
-
// };
|
|
168
|
-
// export async function verifyToken({ code, type }: VerifyTokenProps): Promise<string> {
|
|
169
|
-
// const requestOptions: RequestInit = {
|
|
170
|
-
// method: 'POST',
|
|
171
|
-
// body: JSON.stringify({ code, type }),
|
|
172
|
-
// headers: {
|
|
173
|
-
// 'Content-Type': 'application/json',
|
|
174
|
-
// 'x-api-key': apiKey,
|
|
175
|
-
// },
|
|
176
|
-
// };
|
|
177
|
-
// const res = await fetch(`${apiUrl}/user/verif_code`, requestOptions);
|
|
178
|
-
// return res.json();
|
|
179
|
-
// }
|
|
180
|
-
// export async function sendSmsCode({ id, phone }: { id: string; phone: string }): Promise<string> {
|
|
181
|
-
// const requestOptions: RequestInit = {
|
|
182
|
-
// method: 'POST',
|
|
183
|
-
// body: JSON.stringify({ token: id, phone }),
|
|
184
|
-
// headers: {
|
|
185
|
-
// 'Content-Type': 'application/json',
|
|
186
|
-
// 'x-api-key': apiKey,
|
|
187
|
-
// },
|
|
188
|
-
// };
|
|
189
|
-
// const res = await fetch(`${apiUrl}/user/send_code`, requestOptions);
|
|
190
|
-
// return res.json();
|
|
191
|
-
// }
|
|
192
|
-
// export async function sendEnrollSms({ id }: { id: string }): Promise<string> {
|
|
193
|
-
// const requestOptions: RequestInit = {
|
|
194
|
-
// method: 'POST',
|
|
195
|
-
// body: JSON.stringify({ token: id }),
|
|
196
|
-
// headers: {
|
|
197
|
-
// 'Content-Type': 'application/json',
|
|
198
|
-
// 'x-api-key': apiKey,
|
|
199
|
-
// },
|
|
200
|
-
// };
|
|
201
|
-
// const res = await fetch(`${apiUrl}/user/send_redirectSms`, requestOptions);
|
|
202
|
-
// return res.json();
|
|
203
|
-
// }
|
|
204
|
-
// export async function sendMessage({
|
|
205
|
-
// id,
|
|
206
|
-
// type,
|
|
207
|
-
// endpoint,
|
|
208
|
-
// message,
|
|
209
|
-
// email,
|
|
210
|
-
// subject,
|
|
211
|
-
// phone,
|
|
212
|
-
// }: {
|
|
213
|
-
// id: string;
|
|
214
|
-
// type: 'email' | 'phone';
|
|
215
|
-
// endpoint: string;
|
|
216
|
-
// message: string;
|
|
217
|
-
// email?: string;
|
|
218
|
-
// subject?: string;
|
|
219
|
-
// phone?: string;
|
|
220
|
-
// }): Promise<string> {
|
|
221
|
-
// const requestOptions: RequestInit = {
|
|
222
|
-
// method: 'POST',
|
|
223
|
-
// body: JSON.stringify({ token: id, type, email, subject, phone, endpoint, message }),
|
|
224
|
-
// headers: {
|
|
225
|
-
// 'Content-Type': 'application/json',
|
|
226
|
-
// 'x-api-key': apiKey,
|
|
227
|
-
// },
|
|
228
|
-
// };
|
|
229
|
-
// const res = await fetch(`${apiUrl}/user/sendMessage`, requestOptions);
|
|
230
|
-
// return res.json();
|
|
231
|
-
// }
|
|
232
|
-
// export async function uploadPortrait({ id, portrait }: { id: string; portrait: string }): Promise<string> {
|
|
233
|
-
// const requestOptions: RequestInit = {
|
|
234
|
-
// method: 'POST',
|
|
235
|
-
// body: JSON.stringify({ token: id, portrait }),
|
|
236
|
-
// headers: {
|
|
237
|
-
// 'Content-Type': 'application/json',
|
|
238
|
-
// 'x-api-key': apiKey,
|
|
239
|
-
// },
|
|
240
|
-
// };
|
|
241
|
-
// const res = await fetch(`${apiUrl}/user/upload/portrait`, requestOptions);
|
|
242
|
-
// return res.json();
|
|
243
|
-
// }
|
|
244
|
-
// type UploadDlProps = {
|
|
245
|
-
// id: string;
|
|
246
|
-
// type: DLType;
|
|
247
|
-
// image?: string;
|
|
248
|
-
// barcode?: string;
|
|
249
|
-
// process_ocr?: boolean;
|
|
250
|
-
// };
|
|
251
|
-
// export async function uploadDL({ id, type, image, barcode, process_ocr }: UploadDlProps): Promise<string> {
|
|
252
|
-
// let payload;
|
|
253
|
-
// if (type === DLType.BARCODEJSON) {
|
|
254
|
-
// payload = {
|
|
255
|
-
// token: id,
|
|
256
|
-
// type,
|
|
257
|
-
// barcode,
|
|
258
|
-
// };
|
|
259
|
-
// } else {
|
|
260
|
-
// payload = {
|
|
261
|
-
// token: id,
|
|
262
|
-
// type,
|
|
263
|
-
// image,
|
|
264
|
-
// process_ocr,
|
|
265
|
-
// };
|
|
266
|
-
// }
|
|
267
|
-
// if (type === DLType.BARCODEJSON && !barcode) throw new Error("Barcode data is required for 'barcodeJson' type.");
|
|
268
|
-
// else if (type !== DLType.BARCODEJSON && !image) throw new Error('Image is required.');
|
|
269
|
-
// const requestOptions: RequestInit = {
|
|
270
|
-
// method: 'POST',
|
|
271
|
-
// body: JSON.stringify(payload),
|
|
272
|
-
// headers: {
|
|
273
|
-
// 'Content-Type': 'application/json',
|
|
274
|
-
// 'x-api-key': apiKey,
|
|
275
|
-
// },
|
|
276
|
-
// };
|
|
277
|
-
// const res = await fetch(`${apiUrl}/user/upload/dl`, requestOptions);
|
|
278
|
-
// return res.json();
|
|
279
|
-
// }
|
|
280
|
-
// type UploadHcProps = {
|
|
281
|
-
// id: string;
|
|
282
|
-
// type: HCType;
|
|
283
|
-
// image?: string;
|
|
284
|
-
// processOcr?: boolean;
|
|
285
|
-
// };
|
|
286
|
-
// export async function uploadHC({ id, type, image, processOcr }: UploadHcProps): Promise<string> {
|
|
287
|
-
// const payload = {
|
|
288
|
-
// token: id,
|
|
289
|
-
// type,
|
|
290
|
-
// image,
|
|
291
|
-
// process_ocr: processOcr,
|
|
292
|
-
// };
|
|
293
|
-
// const requestOptions: RequestInit = {
|
|
294
|
-
// method: 'POST',
|
|
295
|
-
// body: JSON.stringify(payload),
|
|
296
|
-
// headers: {
|
|
297
|
-
// 'Content-Type': 'application/json',
|
|
298
|
-
// 'x-api-key': apiKey,
|
|
299
|
-
// },
|
|
300
|
-
// };
|
|
301
|
-
// const res = await fetch(`${apiUrl}/user/upload/hc`, requestOptions);
|
|
302
|
-
// return res.json();
|
|
303
|
-
// }
|
|
304
|
-
// export async function getUserStatus({ id }: { id: string }): Promise<{
|
|
305
|
-
// complianceReview: boolean;
|
|
306
|
-
// expiredDate: string;
|
|
307
|
-
// expiredID: boolean;
|
|
308
|
-
// manualPIIEntry: boolean;
|
|
309
|
-
// orchestrationStatus: string;
|
|
310
|
-
// requestResAddress: boolean;
|
|
311
|
-
// requestSSN4: boolean;
|
|
312
|
-
// requestSSN9: boolean;
|
|
313
|
-
// requestScanID: boolean;
|
|
314
|
-
// toBeEncrypted: boolean;
|
|
315
|
-
// underAge: boolean;
|
|
316
|
-
// userApproved: boolean;
|
|
317
|
-
// userBiometric: string;
|
|
318
|
-
// userRegistered: boolean;
|
|
319
|
-
// userScanId: boolean;
|
|
320
|
-
// }> {
|
|
321
|
-
// const payload = { token: id };
|
|
322
|
-
// const requestOptions: RequestInit = {
|
|
323
|
-
// method: 'POST',
|
|
324
|
-
// body: JSON.stringify(payload),
|
|
325
|
-
// headers: {
|
|
326
|
-
// 'Content-Type': 'application/json',
|
|
327
|
-
// 'x-api-key': apiKey,
|
|
328
|
-
// },
|
|
329
|
-
// };
|
|
330
|
-
// const res = await fetch(`${apiUrl}/user/status`, requestOptions);
|
|
331
|
-
// return res.json();
|
|
332
|
-
// }
|
|
333
|
-
// type Attributes = {
|
|
334
|
-
// uuid?: string;
|
|
335
|
-
// guid?: string;
|
|
336
|
-
// ssn?: string;
|
|
337
|
-
// ssn4?: string;
|
|
338
|
-
// govId?: {
|
|
339
|
-
// firstName?: string;
|
|
340
|
-
// lastName?: string;
|
|
341
|
-
// portraitConfScore?: number;
|
|
342
|
-
// address?: {
|
|
343
|
-
// addressLine1?: string;
|
|
344
|
-
// addressLine2?: string;
|
|
345
|
-
// city?: string;
|
|
346
|
-
// state?: string;
|
|
347
|
-
// zipCode?: string;
|
|
348
|
-
// country?: string;
|
|
349
|
-
// };
|
|
350
|
-
// idDocumentNumber?: string;
|
|
351
|
-
// };
|
|
352
|
-
// preferred?: {
|
|
353
|
-
// firstName?: string;
|
|
354
|
-
// lastName?: string;
|
|
355
|
-
// dob?: string;
|
|
356
|
-
// address?: {
|
|
357
|
-
// addressLine1?: string;
|
|
358
|
-
// addressLine2?: string;
|
|
359
|
-
// city?: string;
|
|
360
|
-
// state?: string;
|
|
361
|
-
// zipCode?: string;
|
|
362
|
-
// country?: string;
|
|
363
|
-
// };
|
|
364
|
-
// idDocumentNumber?: string;
|
|
365
|
-
// };
|
|
366
|
-
// };
|
|
367
|
-
// export async function updateUser({ id, attributes }: { id: string; attributes: Attributes }): Promise<string> {
|
|
368
|
-
// const payload = { token: id, attributes };
|
|
369
|
-
// const requestOptions: RequestInit = {
|
|
370
|
-
// method: 'POST',
|
|
371
|
-
// body: JSON.stringify(payload),
|
|
372
|
-
// headers: {
|
|
373
|
-
// 'Content-Type': 'application/json',
|
|
374
|
-
// 'x-api-key': apiKey,
|
|
375
|
-
// },
|
|
376
|
-
// };
|
|
377
|
-
// const res = await fetch(`${apiUrl}/user/update`, requestOptions);
|
|
378
|
-
// return res.json();
|
|
379
|
-
// }
|
|
380
|
-
// export async function verifyUser({
|
|
381
|
-
// id,
|
|
382
|
-
// apiValue,
|
|
383
|
-
// organizationApiKey,
|
|
384
|
-
// }: {
|
|
385
|
-
// id: string;
|
|
386
|
-
// apiValue: string;
|
|
387
|
-
// organizationApiKey: string;
|
|
388
|
-
// }): Promise<any> {
|
|
389
|
-
// const payload = { token: id };
|
|
390
|
-
// const requestOptions: RequestInit = {
|
|
391
|
-
// method: 'POST',
|
|
392
|
-
// body: JSON.stringify(payload),
|
|
393
|
-
// headers: {
|
|
394
|
-
// 'Content-Type': 'application/json',
|
|
395
|
-
// x_api_key: organizationApiKey,
|
|
396
|
-
// },
|
|
397
|
-
// };
|
|
398
|
-
// const res = await fetch(`${orchestrationAPIUrl}/verify/${apiValue}`, requestOptions);
|
|
399
|
-
// return res.json();
|
|
400
|
-
// }
|
|
401
|
-
// export async function getProductGroups(): Promise<any> {
|
|
402
|
-
// const requestOptions: RequestInit = {
|
|
403
|
-
// method: 'GET',
|
|
404
|
-
// headers: {
|
|
405
|
-
// 'Content-Type': 'application/json',
|
|
406
|
-
// 'x-api-key': apiKey,
|
|
407
|
-
// },
|
|
408
|
-
// };
|
|
409
|
-
// const res = await fetch(`${orchestrationAPIUrl}/product-group/list/prod`, requestOptions);
|
|
410
|
-
// return res.json();
|
|
411
|
-
// }
|
|
412
|
-
// export async function transmit({
|
|
413
|
-
// id,
|
|
414
|
-
// url,
|
|
415
|
-
// sessionToken,
|
|
416
|
-
// final,
|
|
417
|
-
// apiToken,
|
|
418
|
-
// }: {
|
|
419
|
-
// id: string;
|
|
420
|
-
// url: string;
|
|
421
|
-
// sessionToken: string;
|
|
422
|
-
// apiToken?: string;
|
|
423
|
-
// final: boolean;
|
|
424
|
-
// }) {
|
|
425
|
-
// const payload = { token: id, url, sessionToken, apiToken, final };
|
|
426
|
-
// const requestOptions: RequestInit = {
|
|
427
|
-
// method: 'POST',
|
|
428
|
-
// body: JSON.stringify(payload),
|
|
429
|
-
// headers: {
|
|
430
|
-
// 'Content-Type': 'application/json',
|
|
431
|
-
// 'x-api-key': apiKey,
|
|
432
|
-
// },
|
|
433
|
-
// };
|
|
434
|
-
// return fetch(`${orchestrationAPIUrl}/transmit`, requestOptions);
|
|
435
|
-
// }
|
|
436
|
-
// export async function validateSecurityToken({ token, uuid }: { token: string; uuid: string }) {
|
|
437
|
-
// const payload = { api_key: apiKey, uuid, securityToken: token, IAL: '1' };
|
|
438
|
-
// const requestOptions: RequestInit = {
|
|
439
|
-
// method: 'POST',
|
|
440
|
-
// body: JSON.stringify(payload),
|
|
441
|
-
// headers: {
|
|
442
|
-
// 'Content-Type': 'application/json',
|
|
443
|
-
// 'x-api-key': apiKey,
|
|
444
|
-
// },
|
|
445
|
-
// };
|
|
446
|
-
// const result = await (await fetch(`${apiUrl}/isSecurityTokenValid`, requestOptions)).json();
|
|
447
|
-
// return result;
|
|
448
|
-
// }
|
|
449
|
-
// export enum VerificationType {
|
|
450
|
-
// IDENTITY = 'IDENTITY',
|
|
451
|
-
// AGE = 'AGE',
|
|
452
|
-
// }
|
|
453
|
-
// export async function createVerificationSession({
|
|
454
|
-
// successUrl,
|
|
455
|
-
// failureUrl,
|
|
456
|
-
// type,
|
|
457
|
-
// productGroupId,
|
|
458
|
-
// }: {
|
|
459
|
-
// successUrl: string;
|
|
460
|
-
// failureUrl: string;
|
|
461
|
-
// type: VerificationType;
|
|
462
|
-
// productGroupId: string;
|
|
463
|
-
// }): Promise<any> {
|
|
464
|
-
// const payload = { successUrl, failureUrl, type, productGroupId };
|
|
465
|
-
// const requestOptions: RequestInit = {
|
|
466
|
-
// method: 'POST',
|
|
467
|
-
// body: JSON.stringify(payload),
|
|
468
|
-
// headers: {
|
|
469
|
-
// 'Content-Type': 'application/json',
|
|
470
|
-
// 'x-api-key': apiKey,
|
|
471
|
-
// },
|
|
472
|
-
// };
|
|
473
|
-
// const result = await (await fetch(`${orchestrationAPIUrl}/verification-session’`, requestOptions)).json();
|
|
474
|
-
// return result;
|
|
475
|
-
// }
|
|
476
|
-
// // api v2
|
|
477
|
-
// enum SessionType {
|
|
478
|
-
// Identity = 'IDENTITY',
|
|
479
|
-
// Age = 'AGE',
|
|
480
|
-
// }
|
|
481
|
-
// export interface VerificationSessionPayload {
|
|
482
|
-
// successUrl: string;
|
|
483
|
-
// failureUrl: string;
|
|
484
|
-
// type: SessionType; // identity or age
|
|
485
|
-
// productGroupId: string;
|
|
486
|
-
// customerIn?: boolean; // customer information v1 only
|
|
487
|
-
// }
|
|
488
|
-
// export const createVerificationSessionV2 = async ({
|
|
489
|
-
// successUrl,
|
|
490
|
-
// failureUrl,
|
|
491
|
-
// type,
|
|
492
|
-
// productGroupId,
|
|
493
|
-
// customerIn,
|
|
494
|
-
// }: VerificationSessionPayload) => {
|
|
495
|
-
// try {
|
|
496
|
-
// const payload = {
|
|
497
|
-
// successUrl,
|
|
498
|
-
// failureUrl,
|
|
499
|
-
// type,
|
|
500
|
-
// productGroupId,
|
|
501
|
-
// customerIn,
|
|
502
|
-
// };
|
|
503
|
-
// const requestOptions: RequestInit = {
|
|
504
|
-
// method: 'POST',
|
|
505
|
-
// body: JSON.stringify(payload),
|
|
506
|
-
// headers: {
|
|
507
|
-
// 'Content-Type': 'application/json',
|
|
508
|
-
// x_api_key: apiKey,
|
|
509
|
-
// },
|
|
510
|
-
// };
|
|
511
|
-
// const result = await (await fetch(`${orchestrationAPIUrl}/v2/verification-session`, requestOptions)).json();
|
|
512
|
-
// return result;
|
|
513
|
-
// } catch (err) {
|
|
514
|
-
// return err;
|
|
515
|
-
// }
|
|
516
|
-
// };
|
|
517
|
-
// export type createUserWithSessionProp = {
|
|
518
|
-
// sessionToken: string;
|
|
519
|
-
// ssn?: string;
|
|
520
|
-
// phone?: string;
|
|
521
|
-
// email?: string;
|
|
522
|
-
// };
|
|
523
|
-
// export const createUserWithSession = async ({ sessionToken, ssn, email, phone }: createUserWithSessionProp) => {
|
|
524
|
-
// const payload = { ssn, email, phone };
|
|
525
|
-
// const requestOptions: RequestInit = {
|
|
526
|
-
// method: 'POST',
|
|
527
|
-
// body: JSON.stringify(payload),
|
|
528
|
-
// headers: {
|
|
529
|
-
// 'Content-Type': 'application/json',
|
|
530
|
-
// x_api_key: apiKey,
|
|
531
|
-
// },
|
|
532
|
-
// };
|
|
533
|
-
// const result = await (
|
|
534
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user`, requestOptions)
|
|
535
|
-
// ).json();
|
|
536
|
-
// return result;
|
|
537
|
-
// };
|
|
538
|
-
// export type updateUserManualInputWithSessionProps = {
|
|
539
|
-
// sessionToken: string;
|
|
540
|
-
// firstName?: string;
|
|
541
|
-
// lastName?: string;
|
|
542
|
-
// dob?: string;
|
|
543
|
-
// address?: {
|
|
544
|
-
// addressLine1?: string;
|
|
545
|
-
// addressLine2?: string;
|
|
546
|
-
// city?: string;
|
|
547
|
-
// state?: string;
|
|
548
|
-
// zipCode?: string;
|
|
549
|
-
// country?: string;
|
|
550
|
-
// };
|
|
551
|
-
// ssn?: string;
|
|
552
|
-
// };
|
|
553
|
-
// export const updateUserManualInputWithSession = async ({
|
|
554
|
-
// sessionToken,
|
|
555
|
-
// firstName,
|
|
556
|
-
// lastName,
|
|
557
|
-
// dob,
|
|
558
|
-
// address,
|
|
559
|
-
// }: updateUserManualInputWithSessionProps) => {
|
|
560
|
-
// const payload = { firstName, lastName, dob, ...address };
|
|
561
|
-
// const requestOptions: RequestInit = {
|
|
562
|
-
// method: 'POST',
|
|
563
|
-
// body: JSON.stringify(payload),
|
|
564
|
-
// headers: {
|
|
565
|
-
// 'Content-Type': 'application/json',
|
|
566
|
-
// x_api_key: apiKey,
|
|
567
|
-
// },
|
|
568
|
-
// };
|
|
569
|
-
// const result = await (
|
|
570
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/manual-input`, requestOptions)
|
|
571
|
-
// ).json();
|
|
572
|
-
// return result;
|
|
573
|
-
// };
|
|
574
|
-
// export enum createDocumentUploadIdTypeEnum {
|
|
575
|
-
// health_card = 'health_card',
|
|
576
|
-
// passport = 'passport',
|
|
577
|
-
// drivers_license = 'drivers_license',
|
|
578
|
-
// }
|
|
579
|
-
// export type createDocumentUploadIdType = {
|
|
580
|
-
// sessionToken: string;
|
|
581
|
-
// documentType: createDocumentUploadIdTypeEnum;
|
|
582
|
-
// content?: any;
|
|
583
|
-
// };
|
|
584
|
-
// export const createDocumentUploadIdWithSession = async ({
|
|
585
|
-
// sessionToken,
|
|
586
|
-
// documentType,
|
|
587
|
-
// content,
|
|
588
|
-
// }: createDocumentUploadIdType) => {
|
|
589
|
-
// const payload = { content };
|
|
590
|
-
// const requestOptions: RequestInit = {
|
|
591
|
-
// method: 'POST',
|
|
592
|
-
// body: JSON.stringify(payload),
|
|
593
|
-
// headers: {
|
|
594
|
-
// 'Content-Type': 'application/json',
|
|
595
|
-
// x_api_key: apiKey,
|
|
596
|
-
// },
|
|
597
|
-
// };
|
|
598
|
-
// const result = await (
|
|
599
|
-
// await fetch(
|
|
600
|
-
// `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentType}
|
|
601
|
-
// `,
|
|
602
|
-
// requestOptions,
|
|
603
|
-
// )
|
|
604
|
-
// ).json();
|
|
605
|
-
// return result;
|
|
606
|
-
// };
|
|
607
|
-
// export enum documentImageTypeEnum {
|
|
608
|
-
// FRONT = 'front',
|
|
609
|
-
// BACK = 'back',
|
|
610
|
-
// FRONT_CROPPED_DOCUMENT = 'front_cropped_document',
|
|
611
|
-
// BACK_CROPPED_DOCUMENT = 'back_cropped_document',
|
|
612
|
-
// FRONT_MUGSHOT = 'front_mugshot',
|
|
613
|
-
// BACK_BARCODE = 'back_barcode',
|
|
614
|
-
// }
|
|
615
|
-
// export type uploadDocumentImageWithSessionProps = {
|
|
616
|
-
// sessionToken: string;
|
|
617
|
-
// documentId: string;
|
|
618
|
-
// documentImageType: documentImageTypeEnum;
|
|
619
|
-
// imageString: string;
|
|
620
|
-
// };
|
|
621
|
-
// export const uploadDocumentImageWithSession = async ({
|
|
622
|
-
// sessionToken,
|
|
623
|
-
// documentId,
|
|
624
|
-
// documentImageType,
|
|
625
|
-
// imageString,
|
|
626
|
-
// }: uploadDocumentImageWithSessionProps) => {
|
|
627
|
-
// const payload = { type: documentImageType, data: imageString };
|
|
628
|
-
// const requestOptions: RequestInit = {
|
|
629
|
-
// method: 'POST',
|
|
630
|
-
// body: JSON.stringify(payload),
|
|
631
|
-
// headers: {
|
|
632
|
-
// 'Content-Type': 'application/json',
|
|
633
|
-
// x_api_key: apiKey,
|
|
634
|
-
// },
|
|
635
|
-
// };
|
|
636
|
-
// const result = await (
|
|
637
|
-
// await fetch(
|
|
638
|
-
// `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/${documentId}/img
|
|
639
|
-
// `,
|
|
640
|
-
// requestOptions,
|
|
641
|
-
// )
|
|
642
|
-
// ).json();
|
|
643
|
-
// return result;
|
|
644
|
-
// };
|
|
645
|
-
// interface updateDocumentContentInterface {
|
|
646
|
-
// sessionToken: string;
|
|
647
|
-
// documentId: string;
|
|
648
|
-
// content: any;
|
|
649
|
-
// }
|
|
650
|
-
// export const updateDocumentContent = async ({ sessionToken, documentId, content }: updateDocumentContentInterface) => {
|
|
651
|
-
// const payload = { content };
|
|
652
|
-
// const requestOptions: RequestInit = {
|
|
653
|
-
// method: 'PUT',
|
|
654
|
-
// body: JSON.stringify(payload),
|
|
655
|
-
// headers: {
|
|
656
|
-
// 'Content-Type': 'application/json',
|
|
657
|
-
// x_api_key: apiKey,
|
|
658
|
-
// },
|
|
659
|
-
// };
|
|
660
|
-
// const result = await (
|
|
661
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentId}`, requestOptions)
|
|
662
|
-
// ).json();
|
|
663
|
-
// return result;
|
|
664
|
-
// };
|
|
665
|
-
// export type uploadEnrollImageWithSessionProps = {
|
|
666
|
-
// sessionToken: string;
|
|
667
|
-
// imageString: string;
|
|
668
|
-
// };
|
|
669
|
-
// export const uploadEnrollImageWithSession = async ({
|
|
670
|
-
// sessionToken,
|
|
671
|
-
// imageString,
|
|
672
|
-
// }: uploadEnrollImageWithSessionProps) => {
|
|
673
|
-
// const payload = { data: imageString };
|
|
674
|
-
// const requestOptions: RequestInit = {
|
|
675
|
-
// method: 'POST',
|
|
676
|
-
// body: JSON.stringify(payload),
|
|
677
|
-
// headers: {
|
|
678
|
-
// 'Content-Type': 'application/json',
|
|
679
|
-
// x_api_key: apiKey,
|
|
680
|
-
// },
|
|
681
|
-
// };
|
|
682
|
-
// const result = await (
|
|
683
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/img`, requestOptions)
|
|
684
|
-
// ).json();
|
|
685
|
-
// return result;
|
|
686
|
-
// };
|
|
687
|
-
// export enum updateTypeEnum {
|
|
688
|
-
// enroll = 'enroll',
|
|
689
|
-
// compare = 'compare',
|
|
690
|
-
// personalDetails = 'personalDetails',
|
|
691
|
-
// }
|
|
692
|
-
// export type updateUserWithSessionProps = {
|
|
693
|
-
// sessionToken: string;
|
|
694
|
-
// guid?: string;
|
|
695
|
-
// uuid?: string;
|
|
696
|
-
// ssn?: string;
|
|
697
|
-
// email?: string;
|
|
698
|
-
// phone?: string;
|
|
699
|
-
// portrait_conf_score?: string;
|
|
700
|
-
// updateType: updateTypeEnum;
|
|
701
|
-
// };
|
|
702
|
-
// export const updateUserWithSession = async ({
|
|
703
|
-
// sessionToken,
|
|
704
|
-
// guid,
|
|
705
|
-
// uuid,
|
|
706
|
-
// email,
|
|
707
|
-
// phone,
|
|
708
|
-
// ssn,
|
|
709
|
-
// portrait_conf_score,
|
|
710
|
-
// updateType,
|
|
711
|
-
// }: updateUserWithSessionProps) => {
|
|
712
|
-
// let payload;
|
|
713
|
-
// if (updateType === updateTypeEnum.enroll) {
|
|
714
|
-
// payload = {
|
|
715
|
-
// guid,
|
|
716
|
-
// uuid,
|
|
717
|
-
// };
|
|
718
|
-
// } else if (updateType === updateTypeEnum.compare) {
|
|
719
|
-
// payload = {
|
|
720
|
-
// portrait_conf_score,
|
|
721
|
-
// };
|
|
722
|
-
// } else if (updateType === updateTypeEnum.personalDetails) {
|
|
723
|
-
// payload = {
|
|
724
|
-
// email,
|
|
725
|
-
// phone,
|
|
726
|
-
// ssn,
|
|
727
|
-
// };
|
|
728
|
-
// } else {
|
|
729
|
-
// return;
|
|
730
|
-
// }
|
|
731
|
-
// const requestOptions: RequestInit = {
|
|
732
|
-
// method: 'POST',
|
|
733
|
-
// body: JSON.stringify(payload),
|
|
734
|
-
// headers: {
|
|
735
|
-
// 'Content-Type': 'application/json',
|
|
736
|
-
// x_api_key: apiKey,
|
|
737
|
-
// },
|
|
738
|
-
// };
|
|
739
|
-
// const result = await (
|
|
740
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/update`, requestOptions)
|
|
741
|
-
// ).json();
|
|
742
|
-
// return result;
|
|
743
|
-
// };
|
|
744
|
-
// export const verifyIdWithSession = async ({ sessionToken }: { sessionToken: string }) => {
|
|
745
|
-
// const requestOptions: RequestInit = {
|
|
746
|
-
// method: 'POST',
|
|
747
|
-
// headers: {
|
|
748
|
-
// 'Content-Type': 'application/json',
|
|
749
|
-
// x_api_key: apiKey,
|
|
750
|
-
// },
|
|
751
|
-
// };
|
|
752
|
-
// const result = await (await fetch(`${orchestrationAPIUrl}/v3/verify-id/${sessionToken}`, requestOptions)).json();
|
|
753
|
-
// return result;
|
|
754
|
-
// };
|
|
755
|
-
// export const verifySessionTokenV2 = async ({ sessionToken }: { sessionToken: string }) => {
|
|
756
|
-
// const requestOptions: RequestInit = {
|
|
757
|
-
// method: 'GET',
|
|
758
|
-
// headers: {
|
|
759
|
-
// 'Content-Type': 'application/json',
|
|
760
|
-
// x_api_key: apiKey,
|
|
761
|
-
// },
|
|
762
|
-
// };
|
|
763
|
-
// const result = await (
|
|
764
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}`, requestOptions)
|
|
765
|
-
// ).json();
|
|
766
|
-
// return result;
|
|
767
|
-
// };
|
|
768
|
-
// export const createFederationHash = async ({ sesstionToken }: { sesstionToken: string }) => {
|
|
769
|
-
// const requestOptions: RequestInit = {
|
|
770
|
-
// method: 'POST',
|
|
771
|
-
// headers: {
|
|
772
|
-
// 'Content-Type': 'application/json',
|
|
773
|
-
// x_api_key: apiKey,
|
|
774
|
-
// },
|
|
775
|
-
// };
|
|
776
|
-
// const result = await (
|
|
777
|
-
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sesstionToken}/federation-hash`, requestOptions)
|
|
778
|
-
// ).json();
|
|
779
|
-
// return result;
|
|
780
|
-
// };
|
|
781
|
-
// export const deletePasskey = async (uuid: any) => {
|
|
782
|
-
// try {
|
|
783
|
-
// const response = await fetch(`${orchestrationAPIUrl}/v2/passkey/delete-authentication`, {
|
|
784
|
-
// method: 'DELETE',
|
|
785
|
-
// headers: {
|
|
786
|
-
// 'Content-Type': 'application/json',
|
|
787
|
-
// x_api_key: apiKey,
|
|
788
|
-
// },
|
|
789
|
-
// // credentials: 'include',
|
|
790
|
-
// body: JSON.stringify({ uuid }),
|
|
791
|
-
// });
|
|
792
|
-
// const result = await response.json();
|
|
793
|
-
// return result;
|
|
794
|
-
// } catch (error) {
|
|
795
|
-
// return error;
|
|
796
|
-
// }
|
|
797
|
-
// };
|
|
798
|
-
// // Auth with session API
|
|
799
|
-
// interface createAuthSessionInterface {
|
|
800
|
-
// requiredAAL: number;
|
|
801
|
-
// productGroupId: string;
|
|
802
|
-
// actionFlow: string;
|
|
803
|
-
// requiredIAL: number;
|
|
804
|
-
// requiredFAL: number;
|
|
805
|
-
// interactionUID?: string;
|
|
806
|
-
// }
|
|
807
|
-
// export const createAuthSession = async ({
|
|
808
|
-
// requiredAAL,
|
|
809
|
-
// productGroupId,
|
|
810
|
-
// requiredFAL,
|
|
811
|
-
// requiredIAL,
|
|
812
|
-
// actionFlow,
|
|
813
|
-
// interactionUID,
|
|
814
|
-
// }: createAuthSessionInterface) => {
|
|
815
|
-
// const payload = { requiredAAL, productGroupId, requiredFAL, requiredIAL, interactionUID, actionFlow };
|
|
816
|
-
// const requestOptions: RequestInit = {
|
|
817
|
-
// method: 'POST',
|
|
818
|
-
// body: JSON.stringify(payload),
|
|
819
|
-
// headers: {
|
|
820
|
-
// 'Content-Type': 'application/json',
|
|
821
|
-
// x_api_key: apiKey,
|
|
822
|
-
// },
|
|
823
|
-
// };
|
|
824
|
-
// const result = await (await fetch(`${orchestrationAPIUrl}/v2/auth-session`, requestOptions)).json();
|
|
825
|
-
// return result;
|
|
826
|
-
// };
|
|
827
|
-
// export const generateAuthPasskeyOptions = async ({ uuid, sessionToken }: { uuid: string; sessionToken: string }) => {
|
|
828
|
-
// const payload = { uuid };
|
|
829
|
-
// const requestOptions: RequestInit = {
|
|
830
|
-
// method: 'POST',
|
|
831
|
-
// body: JSON.stringify(payload),
|
|
832
|
-
// headers: {
|
|
833
|
-
// 'Content-Type': 'application/json',
|
|
834
|
-
// x_api_key: apiKey,
|
|
835
|
-
// },
|
|
836
|
-
// };
|
|
837
|
-
// const result = await (
|
|
838
|
-
// await fetch(
|
|
839
|
-
// `${orchestrationAPIUrl}/v2/auth/${sessionToken}/passkey/generate-authentication-options`,
|
|
840
|
-
// requestOptions,
|
|
841
|
-
// )
|
|
842
|
-
// ).json();
|
|
843
|
-
// return result;
|
|
844
|
-
// };
|
|
845
|
-
// export const verifyAuthPasskey = async ({
|
|
846
|
-
// uuid,
|
|
847
|
-
// sessionToken,
|
|
848
|
-
// data, // Generate passkey options
|
|
849
|
-
// }: {
|
|
850
|
-
// uuid: string;
|
|
851
|
-
// sessionToken: string;
|
|
852
|
-
// data: any;
|
|
853
|
-
// }) => {
|
|
854
|
-
// const payload = { uuid, data };
|
|
855
|
-
// const requestOptions: RequestInit = {
|
|
856
|
-
// method: 'POST',
|
|
857
|
-
// body: JSON.stringify(payload),
|
|
858
|
-
// headers: {
|
|
859
|
-
// 'Content-Type': 'application/json',
|
|
860
|
-
// x_api_key: apiKey,
|
|
861
|
-
// },
|
|
862
|
-
// };
|
|
863
|
-
// const result = await (
|
|
864
|
-
// await fetch(`${orchestrationAPIUrl}/v2/auth-session/${sessionToken}/passkey/verify-authentication`, requestOptions)
|
|
865
|
-
// ).json();
|
|
866
|
-
// return result;
|
|
867
|
-
// };
|
|
868
|
-
export const createDocumentDL = ({ baseUrl, token }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
869
|
-
const requestOptions = {
|
|
870
|
-
method: 'POST',
|
|
871
|
-
headers: {
|
|
872
|
-
'Content-Type': 'application/json',
|
|
873
|
-
},
|
|
874
|
-
};
|
|
875
|
-
const result = yield (yield fetch(`${baseUrl}/${token}/document/drivers_license`, requestOptions)).json();
|
|
876
|
-
return result;
|
|
877
|
-
});
|
|
878
|
-
export const updateDocumentDetails = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
879
|
-
const requestOptions = {
|
|
880
|
-
method: 'PUT',
|
|
881
|
-
headers: {
|
|
882
|
-
'Content-Type': 'application/json',
|
|
883
|
-
},
|
|
884
|
-
body: JSON.stringify(params),
|
|
885
|
-
};
|
|
886
|
-
const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/document/${documentId}`, requestOptions)).json();
|
|
887
|
-
return result;
|
|
888
|
-
});
|
|
889
|
-
export var documentImageTypeEnum;
|
|
890
|
-
(function (documentImageTypeEnum) {
|
|
891
|
-
documentImageTypeEnum["FRONTDLORIGINAL"] = "front";
|
|
892
|
-
documentImageTypeEnum["FRONTDLHEADSHOT"] = "front_mugshot";
|
|
893
|
-
documentImageTypeEnum["FRONTDLCROPPED"] = "front_cropped_document";
|
|
894
|
-
documentImageTypeEnum["BACKDLORIGINAL"] = "back";
|
|
895
|
-
documentImageTypeEnum["BACKDLCROPPED"] = "back_cropped_document";
|
|
896
|
-
documentImageTypeEnum["BACKDLBARCODE"] = "back_barcode";
|
|
897
|
-
})(documentImageTypeEnum || (documentImageTypeEnum = {}));
|
|
898
|
-
export const uploadDocumentImage = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
899
|
-
const pngBase64 = params.data;
|
|
900
|
-
const jpegBase64 = yield convertPngBase64ToJpegBase64(pngBase64);
|
|
901
|
-
const requestOptions = {
|
|
902
|
-
method: 'POST',
|
|
903
|
-
headers: {
|
|
904
|
-
'Content-Type': 'application/json',
|
|
905
|
-
},
|
|
906
|
-
body: JSON.stringify(Object.assign(Object.assign({}, params), { data: jpegBase64 })),
|
|
907
|
-
};
|
|
908
|
-
const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/${documentId}/img`, requestOptions)).json();
|
|
909
|
-
return result;
|
|
910
|
-
});
|
|
911
|
-
// Update User Details
|
|
912
|
-
export const updateUserDetails = ({ baseUrl, token, params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
913
|
-
const requestOptions = {
|
|
914
|
-
method: 'POST',
|
|
915
|
-
headers: {
|
|
916
|
-
'Content-Type': 'application/json',
|
|
917
|
-
},
|
|
918
|
-
body: JSON.stringify(params),
|
|
919
|
-
};
|
|
920
|
-
const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/user/update`, requestOptions)).json();
|
|
921
|
-
return result;
|
|
922
|
-
});
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// import { Base64, DLType, HCType, LOGTYPE, VerifyType } from './types';
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
import { convertPngBase64ToJpegBase64 } from './utils';
|
|
13
|
+
// const rand = () => Math.random().toString(36).substr(2);
|
|
14
|
+
// export const postImages = (image: Base64) =>
|
|
15
|
+
// fetch(`${apiUrl}/upload-img`, {
|
|
16
|
+
// method: 'POST',
|
|
17
|
+
// headers: {
|
|
18
|
+
// Accept: 'application/json',
|
|
19
|
+
// 'Content-Type': 'application/json',
|
|
20
|
+
// },
|
|
21
|
+
// body: JSON.stringify({ image }),
|
|
22
|
+
// });
|
|
23
|
+
// /**
|
|
24
|
+
// * @category Api
|
|
25
|
+
// * @param pramUuid UUID to delete
|
|
26
|
+
// * @param callback Callback called once the delete is completed
|
|
27
|
+
// */
|
|
28
|
+
// export async function deleteUuid(guid: string, callback: () => void) {
|
|
29
|
+
// const myHeaders = new Headers();
|
|
30
|
+
// myHeaders.append('Accept', 'application/json, text/plain, */*');
|
|
31
|
+
// myHeaders.append('Accept-Encoding', 'gzip, deflate, br');
|
|
32
|
+
// myHeaders.append('x-api-key', apiKey);
|
|
33
|
+
// const formdata = new FormData();
|
|
34
|
+
// formdata.append('guid', guid);
|
|
35
|
+
// formdata.append('api_key', apiKey);
|
|
36
|
+
// const requestOptions: RequestInit = {
|
|
37
|
+
// method: 'POST',
|
|
38
|
+
// headers: myHeaders,
|
|
39
|
+
// body: formdata,
|
|
40
|
+
// mode: 'no-cors',
|
|
41
|
+
// };
|
|
42
|
+
// try {
|
|
43
|
+
// await fetch(`${apiUrl}/deleteUser`, requestOptions);
|
|
44
|
+
// callback();
|
|
45
|
+
// } catch (e) {
|
|
46
|
+
// printLogs('', e, getDebugType(), LOGTYPE.ERROR);
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// export async function getPhrases(): Promise<Array<string>> {
|
|
50
|
+
// const requestOptions: RequestInit = {
|
|
51
|
+
// method: 'POST',
|
|
52
|
+
// };
|
|
53
|
+
// const res = await fetch(`${apiUrl}/getLivenessPhrases`, requestOptions);
|
|
54
|
+
// return res.json();
|
|
55
|
+
// }
|
|
56
|
+
// export async function sendOTP(phone_number: string): Promise<string> {
|
|
57
|
+
// if (!phone_number) return '';
|
|
58
|
+
// const token = rand() + rand();
|
|
59
|
+
// const requestOptions: RequestInit = {
|
|
60
|
+
// method: 'POST',
|
|
61
|
+
// body: JSON.stringify({
|
|
62
|
+
// phone_number,
|
|
63
|
+
// token,
|
|
64
|
+
// api_key: apiKey,
|
|
65
|
+
// hostURL: window.location.href,
|
|
66
|
+
// customerName: 'betmgm',
|
|
67
|
+
// }),
|
|
68
|
+
// };
|
|
69
|
+
// const res = await fetch(`${apiUrl}/sendOTP`, requestOptions);
|
|
70
|
+
// return res.json();
|
|
71
|
+
// }
|
|
72
|
+
// export async function verifyOTP(otp: string, token: string): Promise<string> {
|
|
73
|
+
// const requestOptions: RequestInit = {
|
|
74
|
+
// method: 'POST',
|
|
75
|
+
// body: JSON.stringify({
|
|
76
|
+
// token,
|
|
77
|
+
// otp,
|
|
78
|
+
// }),
|
|
79
|
+
// };
|
|
80
|
+
// const res = await fetch(`${apiUrl}/verifyOTP`, requestOptions);
|
|
81
|
+
// return res.json();
|
|
82
|
+
// }
|
|
83
|
+
// type createUserProps = {
|
|
84
|
+
// id?: string;
|
|
85
|
+
// guid?: string;
|
|
86
|
+
// phone?: string;
|
|
87
|
+
// phoneVerified?: boolean;
|
|
88
|
+
// email?: string;
|
|
89
|
+
// emailVerified?: boolean;
|
|
90
|
+
// ssn4?: string;
|
|
91
|
+
// ssn9?: string;
|
|
92
|
+
// userConsent: boolean;
|
|
93
|
+
// userConsentDate: string;
|
|
94
|
+
// userFaceEnrollConsent?: boolean;
|
|
95
|
+
// consentVersion?: string;
|
|
96
|
+
// consentContent?: string;
|
|
97
|
+
// portrait?: string;
|
|
98
|
+
// };
|
|
99
|
+
// export async function createUser(payload: createUserProps): Promise<string> {
|
|
100
|
+
// const userInfo = {
|
|
101
|
+
// token: payload.id,
|
|
102
|
+
// phone: payload.phone,
|
|
103
|
+
// phoneVerified: payload.phoneVerified,
|
|
104
|
+
// email: payload.email,
|
|
105
|
+
// emailVerified: payload.emailVerified,
|
|
106
|
+
// ssn: payload.ssn4,
|
|
107
|
+
// ssn4: payload.ssn4,
|
|
108
|
+
// ssn9: payload.ssn9,
|
|
109
|
+
// userConsent: payload.userConsent,
|
|
110
|
+
// userConsentDate: payload.userConsentDate,
|
|
111
|
+
// userFaceEnrollConsent: payload.userFaceEnrollConsent,
|
|
112
|
+
// consentVersion: payload.consentVersion,
|
|
113
|
+
// consentContent: payload.consentContent,
|
|
114
|
+
// };
|
|
115
|
+
// const requestOptions: RequestInit = {
|
|
116
|
+
// method: 'POST',
|
|
117
|
+
// body: JSON.stringify(userInfo),
|
|
118
|
+
// headers: {
|
|
119
|
+
// 'x-api-key': apiKey,
|
|
120
|
+
// 'Content-Type': 'application/json',
|
|
121
|
+
// },
|
|
122
|
+
// };
|
|
123
|
+
// const res = await fetch(`${apiUrl}/user/create`, requestOptions);
|
|
124
|
+
// return res.json();
|
|
125
|
+
// }
|
|
126
|
+
// export async function sendEmail(email: string, uuid: string, skin: string, customerName: string): Promise<string> {
|
|
127
|
+
// const token = rand() + rand();
|
|
128
|
+
// const requestOptions: RequestInit = {
|
|
129
|
+
// method: 'POST',
|
|
130
|
+
// body: JSON.stringify({
|
|
131
|
+
// skin,
|
|
132
|
+
// customerName,
|
|
133
|
+
// alias: uuid,
|
|
134
|
+
// hostUrl: window.location.href,
|
|
135
|
+
// version: '1.0',
|
|
136
|
+
// api_key: apiKey,
|
|
137
|
+
// email_address: email,
|
|
138
|
+
// token,
|
|
139
|
+
// action: 'exact_url',
|
|
140
|
+
// }),
|
|
141
|
+
// headers: {
|
|
142
|
+
// 'Content-Type': 'application/json',
|
|
143
|
+
// 'x-api-key': apiKey,
|
|
144
|
+
// },
|
|
145
|
+
// };
|
|
146
|
+
// const res = await fetch(`${apiUrl}/requestAuthLink`, requestOptions);
|
|
147
|
+
// return res.json();
|
|
148
|
+
// }
|
|
149
|
+
// export async function expandUri(shortUrl: string): Promise<string> {
|
|
150
|
+
// const requestOptions: RequestInit = {
|
|
151
|
+
// method: 'POST',
|
|
152
|
+
// body: JSON.stringify({
|
|
153
|
+
// shortUrl,
|
|
154
|
+
// api_key: apiKey,
|
|
155
|
+
// }),
|
|
156
|
+
// headers: {
|
|
157
|
+
// 'Content-Type': 'application/json',
|
|
158
|
+
// 'x-api-key': apiKey,
|
|
159
|
+
// },
|
|
160
|
+
// };
|
|
161
|
+
// const res = await fetch(`${apiUrl}/expandUri`, requestOptions);
|
|
162
|
+
// return res.json();
|
|
163
|
+
// }
|
|
164
|
+
// type VerifyTokenProps = {
|
|
165
|
+
// code: string;
|
|
166
|
+
// type: VerifyType;
|
|
167
|
+
// };
|
|
168
|
+
// export async function verifyToken({ code, type }: VerifyTokenProps): Promise<string> {
|
|
169
|
+
// const requestOptions: RequestInit = {
|
|
170
|
+
// method: 'POST',
|
|
171
|
+
// body: JSON.stringify({ code, type }),
|
|
172
|
+
// headers: {
|
|
173
|
+
// 'Content-Type': 'application/json',
|
|
174
|
+
// 'x-api-key': apiKey,
|
|
175
|
+
// },
|
|
176
|
+
// };
|
|
177
|
+
// const res = await fetch(`${apiUrl}/user/verif_code`, requestOptions);
|
|
178
|
+
// return res.json();
|
|
179
|
+
// }
|
|
180
|
+
// export async function sendSmsCode({ id, phone }: { id: string; phone: string }): Promise<string> {
|
|
181
|
+
// const requestOptions: RequestInit = {
|
|
182
|
+
// method: 'POST',
|
|
183
|
+
// body: JSON.stringify({ token: id, phone }),
|
|
184
|
+
// headers: {
|
|
185
|
+
// 'Content-Type': 'application/json',
|
|
186
|
+
// 'x-api-key': apiKey,
|
|
187
|
+
// },
|
|
188
|
+
// };
|
|
189
|
+
// const res = await fetch(`${apiUrl}/user/send_code`, requestOptions);
|
|
190
|
+
// return res.json();
|
|
191
|
+
// }
|
|
192
|
+
// export async function sendEnrollSms({ id }: { id: string }): Promise<string> {
|
|
193
|
+
// const requestOptions: RequestInit = {
|
|
194
|
+
// method: 'POST',
|
|
195
|
+
// body: JSON.stringify({ token: id }),
|
|
196
|
+
// headers: {
|
|
197
|
+
// 'Content-Type': 'application/json',
|
|
198
|
+
// 'x-api-key': apiKey,
|
|
199
|
+
// },
|
|
200
|
+
// };
|
|
201
|
+
// const res = await fetch(`${apiUrl}/user/send_redirectSms`, requestOptions);
|
|
202
|
+
// return res.json();
|
|
203
|
+
// }
|
|
204
|
+
// export async function sendMessage({
|
|
205
|
+
// id,
|
|
206
|
+
// type,
|
|
207
|
+
// endpoint,
|
|
208
|
+
// message,
|
|
209
|
+
// email,
|
|
210
|
+
// subject,
|
|
211
|
+
// phone,
|
|
212
|
+
// }: {
|
|
213
|
+
// id: string;
|
|
214
|
+
// type: 'email' | 'phone';
|
|
215
|
+
// endpoint: string;
|
|
216
|
+
// message: string;
|
|
217
|
+
// email?: string;
|
|
218
|
+
// subject?: string;
|
|
219
|
+
// phone?: string;
|
|
220
|
+
// }): Promise<string> {
|
|
221
|
+
// const requestOptions: RequestInit = {
|
|
222
|
+
// method: 'POST',
|
|
223
|
+
// body: JSON.stringify({ token: id, type, email, subject, phone, endpoint, message }),
|
|
224
|
+
// headers: {
|
|
225
|
+
// 'Content-Type': 'application/json',
|
|
226
|
+
// 'x-api-key': apiKey,
|
|
227
|
+
// },
|
|
228
|
+
// };
|
|
229
|
+
// const res = await fetch(`${apiUrl}/user/sendMessage`, requestOptions);
|
|
230
|
+
// return res.json();
|
|
231
|
+
// }
|
|
232
|
+
// export async function uploadPortrait({ id, portrait }: { id: string; portrait: string }): Promise<string> {
|
|
233
|
+
// const requestOptions: RequestInit = {
|
|
234
|
+
// method: 'POST',
|
|
235
|
+
// body: JSON.stringify({ token: id, portrait }),
|
|
236
|
+
// headers: {
|
|
237
|
+
// 'Content-Type': 'application/json',
|
|
238
|
+
// 'x-api-key': apiKey,
|
|
239
|
+
// },
|
|
240
|
+
// };
|
|
241
|
+
// const res = await fetch(`${apiUrl}/user/upload/portrait`, requestOptions);
|
|
242
|
+
// return res.json();
|
|
243
|
+
// }
|
|
244
|
+
// type UploadDlProps = {
|
|
245
|
+
// id: string;
|
|
246
|
+
// type: DLType;
|
|
247
|
+
// image?: string;
|
|
248
|
+
// barcode?: string;
|
|
249
|
+
// process_ocr?: boolean;
|
|
250
|
+
// };
|
|
251
|
+
// export async function uploadDL({ id, type, image, barcode, process_ocr }: UploadDlProps): Promise<string> {
|
|
252
|
+
// let payload;
|
|
253
|
+
// if (type === DLType.BARCODEJSON) {
|
|
254
|
+
// payload = {
|
|
255
|
+
// token: id,
|
|
256
|
+
// type,
|
|
257
|
+
// barcode,
|
|
258
|
+
// };
|
|
259
|
+
// } else {
|
|
260
|
+
// payload = {
|
|
261
|
+
// token: id,
|
|
262
|
+
// type,
|
|
263
|
+
// image,
|
|
264
|
+
// process_ocr,
|
|
265
|
+
// };
|
|
266
|
+
// }
|
|
267
|
+
// if (type === DLType.BARCODEJSON && !barcode) throw new Error("Barcode data is required for 'barcodeJson' type.");
|
|
268
|
+
// else if (type !== DLType.BARCODEJSON && !image) throw new Error('Image is required.');
|
|
269
|
+
// const requestOptions: RequestInit = {
|
|
270
|
+
// method: 'POST',
|
|
271
|
+
// body: JSON.stringify(payload),
|
|
272
|
+
// headers: {
|
|
273
|
+
// 'Content-Type': 'application/json',
|
|
274
|
+
// 'x-api-key': apiKey,
|
|
275
|
+
// },
|
|
276
|
+
// };
|
|
277
|
+
// const res = await fetch(`${apiUrl}/user/upload/dl`, requestOptions);
|
|
278
|
+
// return res.json();
|
|
279
|
+
// }
|
|
280
|
+
// type UploadHcProps = {
|
|
281
|
+
// id: string;
|
|
282
|
+
// type: HCType;
|
|
283
|
+
// image?: string;
|
|
284
|
+
// processOcr?: boolean;
|
|
285
|
+
// };
|
|
286
|
+
// export async function uploadHC({ id, type, image, processOcr }: UploadHcProps): Promise<string> {
|
|
287
|
+
// const payload = {
|
|
288
|
+
// token: id,
|
|
289
|
+
// type,
|
|
290
|
+
// image,
|
|
291
|
+
// process_ocr: processOcr,
|
|
292
|
+
// };
|
|
293
|
+
// const requestOptions: RequestInit = {
|
|
294
|
+
// method: 'POST',
|
|
295
|
+
// body: JSON.stringify(payload),
|
|
296
|
+
// headers: {
|
|
297
|
+
// 'Content-Type': 'application/json',
|
|
298
|
+
// 'x-api-key': apiKey,
|
|
299
|
+
// },
|
|
300
|
+
// };
|
|
301
|
+
// const res = await fetch(`${apiUrl}/user/upload/hc`, requestOptions);
|
|
302
|
+
// return res.json();
|
|
303
|
+
// }
|
|
304
|
+
// export async function getUserStatus({ id }: { id: string }): Promise<{
|
|
305
|
+
// complianceReview: boolean;
|
|
306
|
+
// expiredDate: string;
|
|
307
|
+
// expiredID: boolean;
|
|
308
|
+
// manualPIIEntry: boolean;
|
|
309
|
+
// orchestrationStatus: string;
|
|
310
|
+
// requestResAddress: boolean;
|
|
311
|
+
// requestSSN4: boolean;
|
|
312
|
+
// requestSSN9: boolean;
|
|
313
|
+
// requestScanID: boolean;
|
|
314
|
+
// toBeEncrypted: boolean;
|
|
315
|
+
// underAge: boolean;
|
|
316
|
+
// userApproved: boolean;
|
|
317
|
+
// userBiometric: string;
|
|
318
|
+
// userRegistered: boolean;
|
|
319
|
+
// userScanId: boolean;
|
|
320
|
+
// }> {
|
|
321
|
+
// const payload = { token: id };
|
|
322
|
+
// const requestOptions: RequestInit = {
|
|
323
|
+
// method: 'POST',
|
|
324
|
+
// body: JSON.stringify(payload),
|
|
325
|
+
// headers: {
|
|
326
|
+
// 'Content-Type': 'application/json',
|
|
327
|
+
// 'x-api-key': apiKey,
|
|
328
|
+
// },
|
|
329
|
+
// };
|
|
330
|
+
// const res = await fetch(`${apiUrl}/user/status`, requestOptions);
|
|
331
|
+
// return res.json();
|
|
332
|
+
// }
|
|
333
|
+
// type Attributes = {
|
|
334
|
+
// uuid?: string;
|
|
335
|
+
// guid?: string;
|
|
336
|
+
// ssn?: string;
|
|
337
|
+
// ssn4?: string;
|
|
338
|
+
// govId?: {
|
|
339
|
+
// firstName?: string;
|
|
340
|
+
// lastName?: string;
|
|
341
|
+
// portraitConfScore?: number;
|
|
342
|
+
// address?: {
|
|
343
|
+
// addressLine1?: string;
|
|
344
|
+
// addressLine2?: string;
|
|
345
|
+
// city?: string;
|
|
346
|
+
// state?: string;
|
|
347
|
+
// zipCode?: string;
|
|
348
|
+
// country?: string;
|
|
349
|
+
// };
|
|
350
|
+
// idDocumentNumber?: string;
|
|
351
|
+
// };
|
|
352
|
+
// preferred?: {
|
|
353
|
+
// firstName?: string;
|
|
354
|
+
// lastName?: string;
|
|
355
|
+
// dob?: string;
|
|
356
|
+
// address?: {
|
|
357
|
+
// addressLine1?: string;
|
|
358
|
+
// addressLine2?: string;
|
|
359
|
+
// city?: string;
|
|
360
|
+
// state?: string;
|
|
361
|
+
// zipCode?: string;
|
|
362
|
+
// country?: string;
|
|
363
|
+
// };
|
|
364
|
+
// idDocumentNumber?: string;
|
|
365
|
+
// };
|
|
366
|
+
// };
|
|
367
|
+
// export async function updateUser({ id, attributes }: { id: string; attributes: Attributes }): Promise<string> {
|
|
368
|
+
// const payload = { token: id, attributes };
|
|
369
|
+
// const requestOptions: RequestInit = {
|
|
370
|
+
// method: 'POST',
|
|
371
|
+
// body: JSON.stringify(payload),
|
|
372
|
+
// headers: {
|
|
373
|
+
// 'Content-Type': 'application/json',
|
|
374
|
+
// 'x-api-key': apiKey,
|
|
375
|
+
// },
|
|
376
|
+
// };
|
|
377
|
+
// const res = await fetch(`${apiUrl}/user/update`, requestOptions);
|
|
378
|
+
// return res.json();
|
|
379
|
+
// }
|
|
380
|
+
// export async function verifyUser({
|
|
381
|
+
// id,
|
|
382
|
+
// apiValue,
|
|
383
|
+
// organizationApiKey,
|
|
384
|
+
// }: {
|
|
385
|
+
// id: string;
|
|
386
|
+
// apiValue: string;
|
|
387
|
+
// organizationApiKey: string;
|
|
388
|
+
// }): Promise<any> {
|
|
389
|
+
// const payload = { token: id };
|
|
390
|
+
// const requestOptions: RequestInit = {
|
|
391
|
+
// method: 'POST',
|
|
392
|
+
// body: JSON.stringify(payload),
|
|
393
|
+
// headers: {
|
|
394
|
+
// 'Content-Type': 'application/json',
|
|
395
|
+
// x_api_key: organizationApiKey,
|
|
396
|
+
// },
|
|
397
|
+
// };
|
|
398
|
+
// const res = await fetch(`${orchestrationAPIUrl}/verify/${apiValue}`, requestOptions);
|
|
399
|
+
// return res.json();
|
|
400
|
+
// }
|
|
401
|
+
// export async function getProductGroups(): Promise<any> {
|
|
402
|
+
// const requestOptions: RequestInit = {
|
|
403
|
+
// method: 'GET',
|
|
404
|
+
// headers: {
|
|
405
|
+
// 'Content-Type': 'application/json',
|
|
406
|
+
// 'x-api-key': apiKey,
|
|
407
|
+
// },
|
|
408
|
+
// };
|
|
409
|
+
// const res = await fetch(`${orchestrationAPIUrl}/product-group/list/prod`, requestOptions);
|
|
410
|
+
// return res.json();
|
|
411
|
+
// }
|
|
412
|
+
// export async function transmit({
|
|
413
|
+
// id,
|
|
414
|
+
// url,
|
|
415
|
+
// sessionToken,
|
|
416
|
+
// final,
|
|
417
|
+
// apiToken,
|
|
418
|
+
// }: {
|
|
419
|
+
// id: string;
|
|
420
|
+
// url: string;
|
|
421
|
+
// sessionToken: string;
|
|
422
|
+
// apiToken?: string;
|
|
423
|
+
// final: boolean;
|
|
424
|
+
// }) {
|
|
425
|
+
// const payload = { token: id, url, sessionToken, apiToken, final };
|
|
426
|
+
// const requestOptions: RequestInit = {
|
|
427
|
+
// method: 'POST',
|
|
428
|
+
// body: JSON.stringify(payload),
|
|
429
|
+
// headers: {
|
|
430
|
+
// 'Content-Type': 'application/json',
|
|
431
|
+
// 'x-api-key': apiKey,
|
|
432
|
+
// },
|
|
433
|
+
// };
|
|
434
|
+
// return fetch(`${orchestrationAPIUrl}/transmit`, requestOptions);
|
|
435
|
+
// }
|
|
436
|
+
// export async function validateSecurityToken({ token, uuid }: { token: string; uuid: string }) {
|
|
437
|
+
// const payload = { api_key: apiKey, uuid, securityToken: token, IAL: '1' };
|
|
438
|
+
// const requestOptions: RequestInit = {
|
|
439
|
+
// method: 'POST',
|
|
440
|
+
// body: JSON.stringify(payload),
|
|
441
|
+
// headers: {
|
|
442
|
+
// 'Content-Type': 'application/json',
|
|
443
|
+
// 'x-api-key': apiKey,
|
|
444
|
+
// },
|
|
445
|
+
// };
|
|
446
|
+
// const result = await (await fetch(`${apiUrl}/isSecurityTokenValid`, requestOptions)).json();
|
|
447
|
+
// return result;
|
|
448
|
+
// }
|
|
449
|
+
// export enum VerificationType {
|
|
450
|
+
// IDENTITY = 'IDENTITY',
|
|
451
|
+
// AGE = 'AGE',
|
|
452
|
+
// }
|
|
453
|
+
// export async function createVerificationSession({
|
|
454
|
+
// successUrl,
|
|
455
|
+
// failureUrl,
|
|
456
|
+
// type,
|
|
457
|
+
// productGroupId,
|
|
458
|
+
// }: {
|
|
459
|
+
// successUrl: string;
|
|
460
|
+
// failureUrl: string;
|
|
461
|
+
// type: VerificationType;
|
|
462
|
+
// productGroupId: string;
|
|
463
|
+
// }): Promise<any> {
|
|
464
|
+
// const payload = { successUrl, failureUrl, type, productGroupId };
|
|
465
|
+
// const requestOptions: RequestInit = {
|
|
466
|
+
// method: 'POST',
|
|
467
|
+
// body: JSON.stringify(payload),
|
|
468
|
+
// headers: {
|
|
469
|
+
// 'Content-Type': 'application/json',
|
|
470
|
+
// 'x-api-key': apiKey,
|
|
471
|
+
// },
|
|
472
|
+
// };
|
|
473
|
+
// const result = await (await fetch(`${orchestrationAPIUrl}/verification-session’`, requestOptions)).json();
|
|
474
|
+
// return result;
|
|
475
|
+
// }
|
|
476
|
+
// // api v2
|
|
477
|
+
// enum SessionType {
|
|
478
|
+
// Identity = 'IDENTITY',
|
|
479
|
+
// Age = 'AGE',
|
|
480
|
+
// }
|
|
481
|
+
// export interface VerificationSessionPayload {
|
|
482
|
+
// successUrl: string;
|
|
483
|
+
// failureUrl: string;
|
|
484
|
+
// type: SessionType; // identity or age
|
|
485
|
+
// productGroupId: string;
|
|
486
|
+
// customerIn?: boolean; // customer information v1 only
|
|
487
|
+
// }
|
|
488
|
+
// export const createVerificationSessionV2 = async ({
|
|
489
|
+
// successUrl,
|
|
490
|
+
// failureUrl,
|
|
491
|
+
// type,
|
|
492
|
+
// productGroupId,
|
|
493
|
+
// customerIn,
|
|
494
|
+
// }: VerificationSessionPayload) => {
|
|
495
|
+
// try {
|
|
496
|
+
// const payload = {
|
|
497
|
+
// successUrl,
|
|
498
|
+
// failureUrl,
|
|
499
|
+
// type,
|
|
500
|
+
// productGroupId,
|
|
501
|
+
// customerIn,
|
|
502
|
+
// };
|
|
503
|
+
// const requestOptions: RequestInit = {
|
|
504
|
+
// method: 'POST',
|
|
505
|
+
// body: JSON.stringify(payload),
|
|
506
|
+
// headers: {
|
|
507
|
+
// 'Content-Type': 'application/json',
|
|
508
|
+
// x_api_key: apiKey,
|
|
509
|
+
// },
|
|
510
|
+
// };
|
|
511
|
+
// const result = await (await fetch(`${orchestrationAPIUrl}/v2/verification-session`, requestOptions)).json();
|
|
512
|
+
// return result;
|
|
513
|
+
// } catch (err) {
|
|
514
|
+
// return err;
|
|
515
|
+
// }
|
|
516
|
+
// };
|
|
517
|
+
// export type createUserWithSessionProp = {
|
|
518
|
+
// sessionToken: string;
|
|
519
|
+
// ssn?: string;
|
|
520
|
+
// phone?: string;
|
|
521
|
+
// email?: string;
|
|
522
|
+
// };
|
|
523
|
+
// export const createUserWithSession = async ({ sessionToken, ssn, email, phone }: createUserWithSessionProp) => {
|
|
524
|
+
// const payload = { ssn, email, phone };
|
|
525
|
+
// const requestOptions: RequestInit = {
|
|
526
|
+
// method: 'POST',
|
|
527
|
+
// body: JSON.stringify(payload),
|
|
528
|
+
// headers: {
|
|
529
|
+
// 'Content-Type': 'application/json',
|
|
530
|
+
// x_api_key: apiKey,
|
|
531
|
+
// },
|
|
532
|
+
// };
|
|
533
|
+
// const result = await (
|
|
534
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user`, requestOptions)
|
|
535
|
+
// ).json();
|
|
536
|
+
// return result;
|
|
537
|
+
// };
|
|
538
|
+
// export type updateUserManualInputWithSessionProps = {
|
|
539
|
+
// sessionToken: string;
|
|
540
|
+
// firstName?: string;
|
|
541
|
+
// lastName?: string;
|
|
542
|
+
// dob?: string;
|
|
543
|
+
// address?: {
|
|
544
|
+
// addressLine1?: string;
|
|
545
|
+
// addressLine2?: string;
|
|
546
|
+
// city?: string;
|
|
547
|
+
// state?: string;
|
|
548
|
+
// zipCode?: string;
|
|
549
|
+
// country?: string;
|
|
550
|
+
// };
|
|
551
|
+
// ssn?: string;
|
|
552
|
+
// };
|
|
553
|
+
// export const updateUserManualInputWithSession = async ({
|
|
554
|
+
// sessionToken,
|
|
555
|
+
// firstName,
|
|
556
|
+
// lastName,
|
|
557
|
+
// dob,
|
|
558
|
+
// address,
|
|
559
|
+
// }: updateUserManualInputWithSessionProps) => {
|
|
560
|
+
// const payload = { firstName, lastName, dob, ...address };
|
|
561
|
+
// const requestOptions: RequestInit = {
|
|
562
|
+
// method: 'POST',
|
|
563
|
+
// body: JSON.stringify(payload),
|
|
564
|
+
// headers: {
|
|
565
|
+
// 'Content-Type': 'application/json',
|
|
566
|
+
// x_api_key: apiKey,
|
|
567
|
+
// },
|
|
568
|
+
// };
|
|
569
|
+
// const result = await (
|
|
570
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/manual-input`, requestOptions)
|
|
571
|
+
// ).json();
|
|
572
|
+
// return result;
|
|
573
|
+
// };
|
|
574
|
+
// export enum createDocumentUploadIdTypeEnum {
|
|
575
|
+
// health_card = 'health_card',
|
|
576
|
+
// passport = 'passport',
|
|
577
|
+
// drivers_license = 'drivers_license',
|
|
578
|
+
// }
|
|
579
|
+
// export type createDocumentUploadIdType = {
|
|
580
|
+
// sessionToken: string;
|
|
581
|
+
// documentType: createDocumentUploadIdTypeEnum;
|
|
582
|
+
// content?: any;
|
|
583
|
+
// };
|
|
584
|
+
// export const createDocumentUploadIdWithSession = async ({
|
|
585
|
+
// sessionToken,
|
|
586
|
+
// documentType,
|
|
587
|
+
// content,
|
|
588
|
+
// }: createDocumentUploadIdType) => {
|
|
589
|
+
// const payload = { content };
|
|
590
|
+
// const requestOptions: RequestInit = {
|
|
591
|
+
// method: 'POST',
|
|
592
|
+
// body: JSON.stringify(payload),
|
|
593
|
+
// headers: {
|
|
594
|
+
// 'Content-Type': 'application/json',
|
|
595
|
+
// x_api_key: apiKey,
|
|
596
|
+
// },
|
|
597
|
+
// };
|
|
598
|
+
// const result = await (
|
|
599
|
+
// await fetch(
|
|
600
|
+
// `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentType}
|
|
601
|
+
// `,
|
|
602
|
+
// requestOptions,
|
|
603
|
+
// )
|
|
604
|
+
// ).json();
|
|
605
|
+
// return result;
|
|
606
|
+
// };
|
|
607
|
+
// export enum documentImageTypeEnum {
|
|
608
|
+
// FRONT = 'front',
|
|
609
|
+
// BACK = 'back',
|
|
610
|
+
// FRONT_CROPPED_DOCUMENT = 'front_cropped_document',
|
|
611
|
+
// BACK_CROPPED_DOCUMENT = 'back_cropped_document',
|
|
612
|
+
// FRONT_MUGSHOT = 'front_mugshot',
|
|
613
|
+
// BACK_BARCODE = 'back_barcode',
|
|
614
|
+
// }
|
|
615
|
+
// export type uploadDocumentImageWithSessionProps = {
|
|
616
|
+
// sessionToken: string;
|
|
617
|
+
// documentId: string;
|
|
618
|
+
// documentImageType: documentImageTypeEnum;
|
|
619
|
+
// imageString: string;
|
|
620
|
+
// };
|
|
621
|
+
// export const uploadDocumentImageWithSession = async ({
|
|
622
|
+
// sessionToken,
|
|
623
|
+
// documentId,
|
|
624
|
+
// documentImageType,
|
|
625
|
+
// imageString,
|
|
626
|
+
// }: uploadDocumentImageWithSessionProps) => {
|
|
627
|
+
// const payload = { type: documentImageType, data: imageString };
|
|
628
|
+
// const requestOptions: RequestInit = {
|
|
629
|
+
// method: 'POST',
|
|
630
|
+
// body: JSON.stringify(payload),
|
|
631
|
+
// headers: {
|
|
632
|
+
// 'Content-Type': 'application/json',
|
|
633
|
+
// x_api_key: apiKey,
|
|
634
|
+
// },
|
|
635
|
+
// };
|
|
636
|
+
// const result = await (
|
|
637
|
+
// await fetch(
|
|
638
|
+
// `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/${documentId}/img
|
|
639
|
+
// `,
|
|
640
|
+
// requestOptions,
|
|
641
|
+
// )
|
|
642
|
+
// ).json();
|
|
643
|
+
// return result;
|
|
644
|
+
// };
|
|
645
|
+
// interface updateDocumentContentInterface {
|
|
646
|
+
// sessionToken: string;
|
|
647
|
+
// documentId: string;
|
|
648
|
+
// content: any;
|
|
649
|
+
// }
|
|
650
|
+
// export const updateDocumentContent = async ({ sessionToken, documentId, content }: updateDocumentContentInterface) => {
|
|
651
|
+
// const payload = { content };
|
|
652
|
+
// const requestOptions: RequestInit = {
|
|
653
|
+
// method: 'PUT',
|
|
654
|
+
// body: JSON.stringify(payload),
|
|
655
|
+
// headers: {
|
|
656
|
+
// 'Content-Type': 'application/json',
|
|
657
|
+
// x_api_key: apiKey,
|
|
658
|
+
// },
|
|
659
|
+
// };
|
|
660
|
+
// const result = await (
|
|
661
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentId}`, requestOptions)
|
|
662
|
+
// ).json();
|
|
663
|
+
// return result;
|
|
664
|
+
// };
|
|
665
|
+
// export type uploadEnrollImageWithSessionProps = {
|
|
666
|
+
// sessionToken: string;
|
|
667
|
+
// imageString: string;
|
|
668
|
+
// };
|
|
669
|
+
// export const uploadEnrollImageWithSession = async ({
|
|
670
|
+
// sessionToken,
|
|
671
|
+
// imageString,
|
|
672
|
+
// }: uploadEnrollImageWithSessionProps) => {
|
|
673
|
+
// const payload = { data: imageString };
|
|
674
|
+
// const requestOptions: RequestInit = {
|
|
675
|
+
// method: 'POST',
|
|
676
|
+
// body: JSON.stringify(payload),
|
|
677
|
+
// headers: {
|
|
678
|
+
// 'Content-Type': 'application/json',
|
|
679
|
+
// x_api_key: apiKey,
|
|
680
|
+
// },
|
|
681
|
+
// };
|
|
682
|
+
// const result = await (
|
|
683
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/img`, requestOptions)
|
|
684
|
+
// ).json();
|
|
685
|
+
// return result;
|
|
686
|
+
// };
|
|
687
|
+
// export enum updateTypeEnum {
|
|
688
|
+
// enroll = 'enroll',
|
|
689
|
+
// compare = 'compare',
|
|
690
|
+
// personalDetails = 'personalDetails',
|
|
691
|
+
// }
|
|
692
|
+
// export type updateUserWithSessionProps = {
|
|
693
|
+
// sessionToken: string;
|
|
694
|
+
// guid?: string;
|
|
695
|
+
// uuid?: string;
|
|
696
|
+
// ssn?: string;
|
|
697
|
+
// email?: string;
|
|
698
|
+
// phone?: string;
|
|
699
|
+
// portrait_conf_score?: string;
|
|
700
|
+
// updateType: updateTypeEnum;
|
|
701
|
+
// };
|
|
702
|
+
// export const updateUserWithSession = async ({
|
|
703
|
+
// sessionToken,
|
|
704
|
+
// guid,
|
|
705
|
+
// uuid,
|
|
706
|
+
// email,
|
|
707
|
+
// phone,
|
|
708
|
+
// ssn,
|
|
709
|
+
// portrait_conf_score,
|
|
710
|
+
// updateType,
|
|
711
|
+
// }: updateUserWithSessionProps) => {
|
|
712
|
+
// let payload;
|
|
713
|
+
// if (updateType === updateTypeEnum.enroll) {
|
|
714
|
+
// payload = {
|
|
715
|
+
// guid,
|
|
716
|
+
// uuid,
|
|
717
|
+
// };
|
|
718
|
+
// } else if (updateType === updateTypeEnum.compare) {
|
|
719
|
+
// payload = {
|
|
720
|
+
// portrait_conf_score,
|
|
721
|
+
// };
|
|
722
|
+
// } else if (updateType === updateTypeEnum.personalDetails) {
|
|
723
|
+
// payload = {
|
|
724
|
+
// email,
|
|
725
|
+
// phone,
|
|
726
|
+
// ssn,
|
|
727
|
+
// };
|
|
728
|
+
// } else {
|
|
729
|
+
// return;
|
|
730
|
+
// }
|
|
731
|
+
// const requestOptions: RequestInit = {
|
|
732
|
+
// method: 'POST',
|
|
733
|
+
// body: JSON.stringify(payload),
|
|
734
|
+
// headers: {
|
|
735
|
+
// 'Content-Type': 'application/json',
|
|
736
|
+
// x_api_key: apiKey,
|
|
737
|
+
// },
|
|
738
|
+
// };
|
|
739
|
+
// const result = await (
|
|
740
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/update`, requestOptions)
|
|
741
|
+
// ).json();
|
|
742
|
+
// return result;
|
|
743
|
+
// };
|
|
744
|
+
// export const verifyIdWithSession = async ({ sessionToken }: { sessionToken: string }) => {
|
|
745
|
+
// const requestOptions: RequestInit = {
|
|
746
|
+
// method: 'POST',
|
|
747
|
+
// headers: {
|
|
748
|
+
// 'Content-Type': 'application/json',
|
|
749
|
+
// x_api_key: apiKey,
|
|
750
|
+
// },
|
|
751
|
+
// };
|
|
752
|
+
// const result = await (await fetch(`${orchestrationAPIUrl}/v3/verify-id/${sessionToken}`, requestOptions)).json();
|
|
753
|
+
// return result;
|
|
754
|
+
// };
|
|
755
|
+
// export const verifySessionTokenV2 = async ({ sessionToken }: { sessionToken: string }) => {
|
|
756
|
+
// const requestOptions: RequestInit = {
|
|
757
|
+
// method: 'GET',
|
|
758
|
+
// headers: {
|
|
759
|
+
// 'Content-Type': 'application/json',
|
|
760
|
+
// x_api_key: apiKey,
|
|
761
|
+
// },
|
|
762
|
+
// };
|
|
763
|
+
// const result = await (
|
|
764
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}`, requestOptions)
|
|
765
|
+
// ).json();
|
|
766
|
+
// return result;
|
|
767
|
+
// };
|
|
768
|
+
// export const createFederationHash = async ({ sesstionToken }: { sesstionToken: string }) => {
|
|
769
|
+
// const requestOptions: RequestInit = {
|
|
770
|
+
// method: 'POST',
|
|
771
|
+
// headers: {
|
|
772
|
+
// 'Content-Type': 'application/json',
|
|
773
|
+
// x_api_key: apiKey,
|
|
774
|
+
// },
|
|
775
|
+
// };
|
|
776
|
+
// const result = await (
|
|
777
|
+
// await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sesstionToken}/federation-hash`, requestOptions)
|
|
778
|
+
// ).json();
|
|
779
|
+
// return result;
|
|
780
|
+
// };
|
|
781
|
+
// export const deletePasskey = async (uuid: any) => {
|
|
782
|
+
// try {
|
|
783
|
+
// const response = await fetch(`${orchestrationAPIUrl}/v2/passkey/delete-authentication`, {
|
|
784
|
+
// method: 'DELETE',
|
|
785
|
+
// headers: {
|
|
786
|
+
// 'Content-Type': 'application/json',
|
|
787
|
+
// x_api_key: apiKey,
|
|
788
|
+
// },
|
|
789
|
+
// // credentials: 'include',
|
|
790
|
+
// body: JSON.stringify({ uuid }),
|
|
791
|
+
// });
|
|
792
|
+
// const result = await response.json();
|
|
793
|
+
// return result;
|
|
794
|
+
// } catch (error) {
|
|
795
|
+
// return error;
|
|
796
|
+
// }
|
|
797
|
+
// };
|
|
798
|
+
// // Auth with session API
|
|
799
|
+
// interface createAuthSessionInterface {
|
|
800
|
+
// requiredAAL: number;
|
|
801
|
+
// productGroupId: string;
|
|
802
|
+
// actionFlow: string;
|
|
803
|
+
// requiredIAL: number;
|
|
804
|
+
// requiredFAL: number;
|
|
805
|
+
// interactionUID?: string;
|
|
806
|
+
// }
|
|
807
|
+
// export const createAuthSession = async ({
|
|
808
|
+
// requiredAAL,
|
|
809
|
+
// productGroupId,
|
|
810
|
+
// requiredFAL,
|
|
811
|
+
// requiredIAL,
|
|
812
|
+
// actionFlow,
|
|
813
|
+
// interactionUID,
|
|
814
|
+
// }: createAuthSessionInterface) => {
|
|
815
|
+
// const payload = { requiredAAL, productGroupId, requiredFAL, requiredIAL, interactionUID, actionFlow };
|
|
816
|
+
// const requestOptions: RequestInit = {
|
|
817
|
+
// method: 'POST',
|
|
818
|
+
// body: JSON.stringify(payload),
|
|
819
|
+
// headers: {
|
|
820
|
+
// 'Content-Type': 'application/json',
|
|
821
|
+
// x_api_key: apiKey,
|
|
822
|
+
// },
|
|
823
|
+
// };
|
|
824
|
+
// const result = await (await fetch(`${orchestrationAPIUrl}/v2/auth-session`, requestOptions)).json();
|
|
825
|
+
// return result;
|
|
826
|
+
// };
|
|
827
|
+
// export const generateAuthPasskeyOptions = async ({ uuid, sessionToken }: { uuid: string; sessionToken: string }) => {
|
|
828
|
+
// const payload = { uuid };
|
|
829
|
+
// const requestOptions: RequestInit = {
|
|
830
|
+
// method: 'POST',
|
|
831
|
+
// body: JSON.stringify(payload),
|
|
832
|
+
// headers: {
|
|
833
|
+
// 'Content-Type': 'application/json',
|
|
834
|
+
// x_api_key: apiKey,
|
|
835
|
+
// },
|
|
836
|
+
// };
|
|
837
|
+
// const result = await (
|
|
838
|
+
// await fetch(
|
|
839
|
+
// `${orchestrationAPIUrl}/v2/auth/${sessionToken}/passkey/generate-authentication-options`,
|
|
840
|
+
// requestOptions,
|
|
841
|
+
// )
|
|
842
|
+
// ).json();
|
|
843
|
+
// return result;
|
|
844
|
+
// };
|
|
845
|
+
// export const verifyAuthPasskey = async ({
|
|
846
|
+
// uuid,
|
|
847
|
+
// sessionToken,
|
|
848
|
+
// data, // Generate passkey options
|
|
849
|
+
// }: {
|
|
850
|
+
// uuid: string;
|
|
851
|
+
// sessionToken: string;
|
|
852
|
+
// data: any;
|
|
853
|
+
// }) => {
|
|
854
|
+
// const payload = { uuid, data };
|
|
855
|
+
// const requestOptions: RequestInit = {
|
|
856
|
+
// method: 'POST',
|
|
857
|
+
// body: JSON.stringify(payload),
|
|
858
|
+
// headers: {
|
|
859
|
+
// 'Content-Type': 'application/json',
|
|
860
|
+
// x_api_key: apiKey,
|
|
861
|
+
// },
|
|
862
|
+
// };
|
|
863
|
+
// const result = await (
|
|
864
|
+
// await fetch(`${orchestrationAPIUrl}/v2/auth-session/${sessionToken}/passkey/verify-authentication`, requestOptions)
|
|
865
|
+
// ).json();
|
|
866
|
+
// return result;
|
|
867
|
+
// };
|
|
868
|
+
export const createDocumentDL = ({ baseUrl, token }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
869
|
+
const requestOptions = {
|
|
870
|
+
method: 'POST',
|
|
871
|
+
headers: {
|
|
872
|
+
'Content-Type': 'application/json',
|
|
873
|
+
},
|
|
874
|
+
};
|
|
875
|
+
const result = yield (yield fetch(`${baseUrl}/${token}/document/drivers_license`, requestOptions)).json();
|
|
876
|
+
return result;
|
|
877
|
+
});
|
|
878
|
+
export const updateDocumentDetails = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
879
|
+
const requestOptions = {
|
|
880
|
+
method: 'PUT',
|
|
881
|
+
headers: {
|
|
882
|
+
'Content-Type': 'application/json',
|
|
883
|
+
},
|
|
884
|
+
body: JSON.stringify(params),
|
|
885
|
+
};
|
|
886
|
+
const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/document/${documentId}`, requestOptions)).json();
|
|
887
|
+
return result;
|
|
888
|
+
});
|
|
889
|
+
export var documentImageTypeEnum;
|
|
890
|
+
(function (documentImageTypeEnum) {
|
|
891
|
+
documentImageTypeEnum["FRONTDLORIGINAL"] = "front";
|
|
892
|
+
documentImageTypeEnum["FRONTDLHEADSHOT"] = "front_mugshot";
|
|
893
|
+
documentImageTypeEnum["FRONTDLCROPPED"] = "front_cropped_document";
|
|
894
|
+
documentImageTypeEnum["BACKDLORIGINAL"] = "back";
|
|
895
|
+
documentImageTypeEnum["BACKDLCROPPED"] = "back_cropped_document";
|
|
896
|
+
documentImageTypeEnum["BACKDLBARCODE"] = "back_barcode";
|
|
897
|
+
})(documentImageTypeEnum || (documentImageTypeEnum = {}));
|
|
898
|
+
export const uploadDocumentImage = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
899
|
+
const pngBase64 = params.data;
|
|
900
|
+
const jpegBase64 = yield convertPngBase64ToJpegBase64(pngBase64);
|
|
901
|
+
const requestOptions = {
|
|
902
|
+
method: 'POST',
|
|
903
|
+
headers: {
|
|
904
|
+
'Content-Type': 'application/json',
|
|
905
|
+
},
|
|
906
|
+
body: JSON.stringify(Object.assign(Object.assign({}, params), { data: jpegBase64 })),
|
|
907
|
+
};
|
|
908
|
+
const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/${documentId}/img`, requestOptions)).json();
|
|
909
|
+
return result;
|
|
910
|
+
});
|
|
911
|
+
// Update User Details
|
|
912
|
+
export const updateUserDetails = ({ baseUrl, token, params, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
913
|
+
const requestOptions = {
|
|
914
|
+
method: 'POST',
|
|
915
|
+
headers: {
|
|
916
|
+
'Content-Type': 'application/json',
|
|
917
|
+
},
|
|
918
|
+
body: JSON.stringify(params),
|
|
919
|
+
};
|
|
920
|
+
const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/user/update`, requestOptions)).json();
|
|
921
|
+
return result;
|
|
922
|
+
});
|
|
923
923
|
//# sourceMappingURL=apiUtils.js.map
|