santoid-sdk 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +113 -29
  2. package/browser/liveness/index.js +1 -0
  3. package/liveness/index.d.ts +9 -0
  4. package/liveness/index.js +29 -0
  5. package/liveness/methods/livenessDetection.d.ts +6 -0
  6. package/{dist/esm/liveness/index.js → liveness/methods/livenessDetection.js} +2 -22
  7. package/liveness/methods/uploadIdentificationDocument.d.ts +91 -0
  8. package/liveness/methods/uploadIdentificationDocument.js +236 -0
  9. package/liveness/utils/index.d.ts +2 -0
  10. package/{dist/esm/liveness → liveness}/utils/index.js +10 -1
  11. package/{dist/esm/liveness → liveness}/utils/types.d.ts +2 -2
  12. package/{dist/node/liveness → liveness}/utils/types.js +1 -1
  13. package/{dist/esm/liveness → liveness}/utils/websocket.js +1 -1
  14. package/{dist/node → node}/auth/index.js +3 -6
  15. package/node/liveness/index.d.ts +9 -0
  16. package/node/liveness/index.js +29 -0
  17. package/node/liveness/methods/livenessDetection.d.ts +6 -0
  18. package/{dist/node/liveness/index.js → node/liveness/methods/livenessDetection.js} +2 -3
  19. package/node/liveness/methods/uploadIdentificationDocument.d.ts +91 -0
  20. package/node/liveness/methods/uploadIdentificationDocument.js +237 -0
  21. package/node/liveness/utils/index.d.ts +2 -0
  22. package/{dist/node → node}/liveness/utils/index.js +10 -1
  23. package/package.json +12 -29
  24. package/tsconfig.json +6 -2
  25. package/tsconfig.prod.json +26 -0
  26. package/{dist/utils → utils}/constants.d.ts +1 -1
  27. package/{dist/utils → utils}/constants.js +1 -1
  28. package/{dist/utils → utils}/types.d.ts +11 -8
  29. package/webpack.config.cjs +12 -2
  30. package/dist/browser/liveness/index.js +0 -1
  31. package/dist/esm/liveness/index.d.ts +0 -9
  32. package/dist/esm/liveness/utils/index.d.ts +0 -1
  33. package/dist/node/liveness/index.d.ts +0 -4
  34. package/dist/node/liveness/utils/index.d.ts +0 -1
  35. package/jest.config.cjs +0 -17
  36. package/src/esm/liveness/index.ts +0 -156
  37. package/src/esm/liveness/utils/getNextFrame.ts +0 -76
  38. package/src/esm/liveness/utils/index.ts +0 -16
  39. package/src/esm/liveness/utils/types.ts +0 -7
  40. package/src/esm/liveness/utils/websocket.ts +0 -33
  41. package/src/index.ts +0 -0
  42. package/src/node/auth/index.ts +0 -43
  43. package/src/node/liveness/index.ts +0 -135
  44. package/src/node/liveness/utils/index.ts +0 -3
  45. package/src/node/liveness/utils/types.ts +0 -8
  46. package/src/node/liveness/utils/websocket.ts +0 -35
  47. package/src/utils/constants.ts +0 -3
  48. package/src/utils/types.ts +0 -46
  49. /package/{dist/index.d.ts → index.d.ts} +0 -0
  50. /package/{dist/index.js → index.js} +0 -0
  51. /package/{dist/esm/liveness → liveness}/utils/getNextFrame.d.ts +0 -0
  52. /package/{dist/esm/liveness → liveness}/utils/getNextFrame.js +0 -0
  53. /package/{dist/esm/liveness → liveness}/utils/websocket.d.ts +0 -0
  54. /package/{dist/node → node}/auth/index.d.ts +0 -0
  55. /package/{dist/node → node}/liveness/utils/types.d.ts +0 -0
  56. /package/{dist/esm → node}/liveness/utils/types.js +0 -0
  57. /package/{dist/node → node}/liveness/utils/websocket.d.ts +0 -0
  58. /package/{dist/node → node}/liveness/utils/websocket.js +0 -0
  59. /package/{dist/utils → utils}/types.js +0 -0
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.uploadIdentificationDocument = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const constants_1 = require("../../utils/constants");
9
+ const utils_1 = require("../utils");
10
+ const livenessDetection_1 = require("./livenessDetection");
11
+ async function typificationPredict(options, file) {
12
+ var _a, _b, _c;
13
+ const formData = new FormData();
14
+ formData.append('track', options.track);
15
+ formData.append('imageFile', file);
16
+ const decodedToken = (0, utils_1.tryDecodeJwt)(options.token);
17
+ const domain = (_a = options.domain) !== null && _a !== void 0 ? _a : (_b = decodedToken === null || decodedToken === void 0 ? void 0 : decodedToken.claims) === null || _b === void 0 ? void 0 : _b.domain;
18
+ const axiosConfig = {
19
+ headers: {
20
+ 'Content-Type': 'multipart/form-data',
21
+ Authorization: `Bearer ${options.token}`,
22
+ },
23
+ };
24
+ if (axiosConfig.headers && domain) {
25
+ axiosConfig.headers.Domain = domain;
26
+ }
27
+ const response = await axios_1.default.post(`${(_c = options === null || options === void 0 ? void 0 : options.customApiUrl) !== null && _c !== void 0 ? _c : constants_1.API_GATEWAY_URL}/api/v3/typification/predict`, formData, axiosConfig);
28
+ return response.data;
29
+ }
30
+ async function faceMatch(options, firstImage, secondImage) {
31
+ var _a, _b, _c;
32
+ const formData = new FormData();
33
+ formData.append('track', options.track);
34
+ formData.append('firstImage', firstImage);
35
+ formData.append('secondImage', secondImage);
36
+ const decodedToken = (0, utils_1.tryDecodeJwt)(options.token);
37
+ const domain = (_a = options.domain) !== null && _a !== void 0 ? _a : (_b = decodedToken === null || decodedToken === void 0 ? void 0 : decodedToken.claims) === null || _b === void 0 ? void 0 : _b.domain;
38
+ const axiosConfig = {
39
+ params: {
40
+ sensitive_data_compliance: true,
41
+ },
42
+ headers: {
43
+ 'Content-Type': 'multipart/form-data',
44
+ Authorization: `Bearer ${options.token}`,
45
+ },
46
+ };
47
+ if (axiosConfig.headers && domain) {
48
+ axiosConfig.headers.Domain = domain;
49
+ }
50
+ const response = await axios_1.default.post(`${(_c = options === null || options === void 0 ? void 0 : options.customApiUrl) !== null && _c !== void 0 ? _c : constants_1.API_GATEWAY_URL}/api/v1/facematch/pair`, formData, axiosConfig);
51
+ return response.data;
52
+ }
53
+ function uploadIdentificationDocument(options) {
54
+ let results = {
55
+ uploadedDocument: null,
56
+ typification: {
57
+ status: null,
58
+ results: null,
59
+ loading: false,
60
+ error: null,
61
+ },
62
+ liveness: {
63
+ status: null,
64
+ results: null,
65
+ loading: false,
66
+ error: null,
67
+ },
68
+ faceMatch: {
69
+ status: null,
70
+ results: null,
71
+ loading: false,
72
+ error: null,
73
+ },
74
+ };
75
+ async function startFaceMatch(firstImage, secondImage) {
76
+ var _a, _b, _c;
77
+ try {
78
+ updateResults({
79
+ faceMatch: {
80
+ status: null,
81
+ results: null,
82
+ loading: true,
83
+ error: null,
84
+ },
85
+ });
86
+ const faceMatchResults = await faceMatch(options, firstImage, secondImage);
87
+ updateResults({
88
+ faceMatch: {
89
+ results: faceMatchResults,
90
+ status: 'success',
91
+ loading: false,
92
+ error: null,
93
+ },
94
+ });
95
+ }
96
+ catch (err) {
97
+ await ((_a = options.errorCallback) === null || _a === void 0 ? void 0 : _a.call(options, { code: 'face-match-error', details: (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data }));
98
+ updateResults({
99
+ faceMatch: {
100
+ results: null,
101
+ status: 'error',
102
+ loading: false,
103
+ error: (_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.data,
104
+ },
105
+ });
106
+ }
107
+ }
108
+ function tryStartFaceMatch() {
109
+ var _a;
110
+ if (results.uploadedDocument &&
111
+ ((_a = results.liveness.results) === null || _a === void 0 ? void 0 : _a.successFrames.front) &&
112
+ !results.faceMatch.results &&
113
+ !results.faceMatch.loading) {
114
+ void startFaceMatch(results.uploadedDocument, results.liveness.results.successFrames.front);
115
+ }
116
+ }
117
+ function updateUploadedDocument(file) {
118
+ results.uploadedDocument = file;
119
+ tryStartFaceMatch();
120
+ }
121
+ function updateResults(updatedResults) {
122
+ var _a, _b, _c;
123
+ results = Object.assign(Object.assign({}, results), updatedResults);
124
+ void ((_a = options.resultChangeCallback) === null || _a === void 0 ? void 0 : _a.call(options, results));
125
+ if (Object.entries(results).every(([key, value]) => key === 'uploadedDocument' || !!value.results)) {
126
+ void ((_b = options.successCallback) === null || _b === void 0 ? void 0 : _b.call(options, results));
127
+ void ((_c = options.endCallback) === null || _c === void 0 ? void 0 : _c.call(options));
128
+ return;
129
+ }
130
+ tryStartFaceMatch();
131
+ }
132
+ async function startDocumentUpload(file) {
133
+ var _a, _b, _c;
134
+ try {
135
+ updateResults({
136
+ typification: {
137
+ status: null,
138
+ results: null,
139
+ loading: true,
140
+ error: null,
141
+ },
142
+ });
143
+ updateUploadedDocument(file);
144
+ const typificationResults = await typificationPredict(options, file);
145
+ updateResults({
146
+ typification: {
147
+ status: 'success',
148
+ results: typificationResults,
149
+ loading: false,
150
+ error: null,
151
+ },
152
+ });
153
+ }
154
+ catch (err) {
155
+ await ((_a = options.errorCallback) === null || _a === void 0 ? void 0 : _a.call(options, { code: 'typification-error', details: (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data }));
156
+ updateResults({
157
+ typification: {
158
+ status: 'error',
159
+ results: null,
160
+ loading: false,
161
+ error: (_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.data,
162
+ },
163
+ });
164
+ }
165
+ }
166
+ async function startLivenessDetection(startLivenessDetectionOptions) {
167
+ var _a, _b, _c, _d, _e;
168
+ const adaptedLivenessOptions = Object.assign({}, startLivenessDetectionOptions);
169
+ delete adaptedLivenessOptions.successCallback;
170
+ delete adaptedLivenessOptions.errorCallback;
171
+ updateResults({
172
+ liveness: {
173
+ results: null,
174
+ status: null,
175
+ loading: true,
176
+ error: null,
177
+ },
178
+ });
179
+ try {
180
+ return await (0, livenessDetection_1.livenessDetection)(Object.assign(Object.assign({ domain: options.domain, customId: options.customId, customWebSocketUrl: options.customWebSocketUrl, successCallback: (livenessResults) => {
181
+ var _a;
182
+ void ((_a = startLivenessDetectionOptions === null || startLivenessDetectionOptions === void 0 ? void 0 : startLivenessDetectionOptions.successCallback) === null || _a === void 0 ? void 0 : _a.call(startLivenessDetectionOptions, livenessResults));
183
+ updateResults({
184
+ liveness: {
185
+ status: 'success',
186
+ results: (livenessResults),
187
+ loading: false,
188
+ error: null,
189
+ },
190
+ });
191
+ }, errorCallback: async (livenessErrorDetails) => {
192
+ var _a, _b;
193
+ if ((livenessErrorDetails === null || livenessErrorDetails === void 0 ? void 0 : livenessErrorDetails.code) === 'wrong-position') {
194
+ void ((_a = startLivenessDetectionOptions === null || startLivenessDetectionOptions === void 0 ? void 0 : startLivenessDetectionOptions.errorCallback) === null || _a === void 0 ? void 0 : _a.call(startLivenessDetectionOptions, livenessErrorDetails));
195
+ }
196
+ else {
197
+ void ((_b = options.errorCallback) === null || _b === void 0 ? void 0 : _b.call(options, livenessErrorDetails));
198
+ }
199
+ updateResults({
200
+ liveness: {
201
+ status: 'error',
202
+ results: null,
203
+ loading: (livenessErrorDetails === null || livenessErrorDetails === void 0 ? void 0 : livenessErrorDetails.code) === 'wrong-position',
204
+ error: livenessErrorDetails,
205
+ },
206
+ });
207
+ } }, adaptedLivenessOptions), { token: (_a = adaptedLivenessOptions.token) !== null && _a !== void 0 ? _a : options.token, track: (_b = adaptedLivenessOptions.track) !== null && _b !== void 0 ? _b : options.track }));
208
+ }
209
+ catch (err) {
210
+ await ((_c = options.errorCallback) === null || _c === void 0 ? void 0 : _c.call(options, { code: 'liveness-error', details: (_d = err === null || err === void 0 ? void 0 : err.response) === null || _d === void 0 ? void 0 : _d.data }));
211
+ updateResults({
212
+ liveness: {
213
+ status: 'error',
214
+ results: null,
215
+ loading: false,
216
+ error: (_e = err === null || err === void 0 ? void 0 : err.response) === null || _e === void 0 ? void 0 : _e.data,
217
+ },
218
+ });
219
+ }
220
+ }
221
+ function startAll(file, startLivenessDetectionOptions) {
222
+ void startDocumentUpload(file);
223
+ void startLivenessDetection(startLivenessDetectionOptions);
224
+ }
225
+ function getResults() {
226
+ return results;
227
+ }
228
+ return {
229
+ getResults,
230
+ startDocumentUpload,
231
+ startLivenessDetection,
232
+ startFaceComparison: tryStartFaceMatch,
233
+ startAll,
234
+ };
235
+ }
236
+ exports.uploadIdentificationDocument = uploadIdentificationDocument;
@@ -0,0 +1,2 @@
1
+ export declare function decodeJwt(token: string): any;
2
+ export declare function tryDecodeJwt(token: string): any;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeJwt = void 0;
3
+ exports.tryDecodeJwt = exports.decodeJwt = void 0;
4
4
  function decodeJwt(token) {
5
5
  const base64Url = token.split('.')[1];
6
6
  const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
@@ -14,3 +14,12 @@ function decodeJwt(token) {
14
14
  return JSON.parse(jsonPayload);
15
15
  }
16
16
  exports.decodeJwt = decodeJwt;
17
+ function tryDecodeJwt(token) {
18
+ try {
19
+ return decodeJwt(token);
20
+ }
21
+ catch (_a) {
22
+ return null;
23
+ }
24
+ }
25
+ exports.tryDecodeJwt = tryDecodeJwt;
@@ -1,5 +1,5 @@
1
- import { type ISDKOptions } from '../../../utils/types';
1
+ import { type ISDKOptions } from '../../utils/types';
2
2
  export type TWebSDKOptions = ISDKOptions & {
3
3
  getNextFrame?: () => Promise<Blob | null>;
4
4
  };
5
- export * from '../../../utils/types';
5
+ export * from '../../utils/types';
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("../../../utils/types"), exports);
17
+ __exportStar(require("../../utils/types"), exports);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.disconnectFromWebSocket = exports.connectToWebSocket = void 0;
4
4
  const _1 = require(".");
5
- const constants_1 = require("../../../utils/constants");
5
+ const constants_1 = require("../../utils/constants");
6
6
  async function waitForWebSocketConnection(websocket) {
7
7
  await new Promise((resolve) => {
8
8
  const intervalKey = setInterval(() => {
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.initialize = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
+ const axios_1 = __importDefault(require("axios"));
8
9
  const constants_1 = require("../../utils/constants");
9
10
  async function initialize(options) {
10
11
  var _a;
@@ -29,12 +30,8 @@ async function initialize(options) {
29
30
  }
30
31
  }
31
32
  if (credentialsBase64) {
32
- const response = await fetch((_a = options === null || options === void 0 ? void 0 : options.customApiUrl) !== null && _a !== void 0 ? _a : constants_1.API_GATEWAY_URL, {
33
- method: 'POST',
34
- body: JSON.stringify({ service_account_base64: credentialsBase64 }),
35
- headers: { 'Content-Type': 'application/json' },
36
- });
37
- const token = await response.json();
33
+ const response = await axios_1.default.post(`${(_a = options === null || options === void 0 ? void 0 : options.customApiUrl) !== null && _a !== void 0 ? _a : constants_1.API_GATEWAY_URL}/api/v1/service-account/refresh-token`, { service_account_base64: credentialsBase64 }, { headers: { 'Content-Type': 'application/json' } });
34
+ const token = await response.data;
38
35
  if (typeof token !== 'string') {
39
36
  throw new Error('Cannot generate token');
40
37
  }
@@ -0,0 +1,9 @@
1
+ import { livenessDetection } from './methods/livenessDetection';
2
+ import { uploadIdentificationDocument } from './methods/uploadIdentificationDocument';
3
+ export { livenessDetection } from './methods/livenessDetection';
4
+ export { uploadIdentificationDocument } from './methods/uploadIdentificationDocument';
5
+ export * from './utils/types';
6
+ export default class SantoiDSDK {
7
+ static livenessDetection: typeof livenessDetection;
8
+ static uploadIdentificationDocument: typeof uploadIdentificationDocument;
9
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.uploadIdentificationDocument = exports.livenessDetection = void 0;
18
+ const livenessDetection_1 = require("./methods/livenessDetection");
19
+ const uploadIdentificationDocument_1 = require("./methods/uploadIdentificationDocument");
20
+ var livenessDetection_2 = require("./methods/livenessDetection");
21
+ Object.defineProperty(exports, "livenessDetection", { enumerable: true, get: function () { return livenessDetection_2.livenessDetection; } });
22
+ var uploadIdentificationDocument_2 = require("./methods/uploadIdentificationDocument");
23
+ Object.defineProperty(exports, "uploadIdentificationDocument", { enumerable: true, get: function () { return uploadIdentificationDocument_2.uploadIdentificationDocument; } });
24
+ __exportStar(require("./utils/types"), exports);
25
+ class SantoiDSDK {
26
+ }
27
+ SantoiDSDK.livenessDetection = livenessDetection_1.livenessDetection;
28
+ SantoiDSDK.uploadIdentificationDocument = uploadIdentificationDocument_1.uploadIdentificationDocument;
29
+ exports.default = SantoiDSDK;
@@ -0,0 +1,6 @@
1
+ import { type Data } from 'ws';
2
+ import { type TNodeSDKOptions } from '../utils/types';
3
+ export type FrameType = Data | null | undefined;
4
+ export declare function livenessDetection(options: TNodeSDKOptions): Promise<{
5
+ stopLivenessDetection: () => Promise<void>;
6
+ }>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.livenessDetection = void 0;
4
- const constants_1 = require("../../utils/constants");
5
- const websocket_1 = require("./utils/websocket");
4
+ const constants_1 = require("../../../utils/constants");
5
+ const websocket_1 = require("../utils/websocket");
6
6
  async function onWebSocketMessage(options, event) {
7
7
  var _a, _b, _c;
8
8
  const message = event.data;
@@ -106,7 +106,6 @@ async function livenessDetection(options) {
106
106
  };
107
107
  }
108
108
  catch (err) {
109
- console.error('catch error', err);
110
109
  !validationSuccess && ((_c = options.errorCallback) === null || _c === void 0 ? void 0 : _c.call(options, { code: 'internal-error' }));
111
110
  await stopLivenessDetection(options, websocket, sendFramesIntervalKey);
112
111
  throw err;
@@ -0,0 +1,91 @@
1
+ import { type Data } from 'ws';
2
+ import { type ILivenessResults, type TNodeSDKOptions, type IBaseSDKOptions, type TCallbackFunction, type TErrorCode } from '../utils/types';
3
+ type TResultStatuses = 'success' | 'error' | null;
4
+ type FileType = Data;
5
+ interface ITypificationResult {
6
+ n_documents: number;
7
+ predictOCR: Array<{
8
+ typification: {
9
+ document_type: string;
10
+ ocr_success: boolean;
11
+ typification_score: number;
12
+ };
13
+ ocr_error?: boolean | null;
14
+ ocr_message?: {
15
+ template: string;
16
+ labels: any;
17
+ } | null;
18
+ ocr_extraction: {
19
+ template: string;
20
+ labels: Array<{
21
+ x: number;
22
+ y: number;
23
+ w: number;
24
+ h: number;
25
+ bottomRight: number[];
26
+ topLeft: number[];
27
+ dataField?: string;
28
+ dataFieldValue?: boolean;
29
+ ocr?: string | null;
30
+ ocr_score?: number;
31
+ cropBase64?: string | null;
32
+ serpro_query?: {
33
+ serpro_data: any;
34
+ search_logs: {
35
+ document: string;
36
+ type: string;
37
+ search_time: string;
38
+ status_code: number;
39
+ message: string;
40
+ };
41
+ };
42
+ validation?: Record<string, number | boolean>;
43
+ }> | null;
44
+ } | boolean;
45
+ }>;
46
+ }
47
+ interface IFaceMatchResult {
48
+ comparison_score: number;
49
+ similarity_score: number;
50
+ match: boolean;
51
+ }
52
+ interface IUploadIdentificationDocumentResults {
53
+ uploadedDocument: FileType | null;
54
+ typification: {
55
+ status: TResultStatuses;
56
+ results: ITypificationResult | null;
57
+ loading: boolean;
58
+ error: any;
59
+ };
60
+ liveness: {
61
+ status: TResultStatuses;
62
+ results: ILivenessResults<FileType | null | undefined> | null;
63
+ loading: boolean;
64
+ error: any;
65
+ };
66
+ faceMatch: {
67
+ status: TResultStatuses;
68
+ results: IFaceMatchResult | null;
69
+ loading: boolean;
70
+ error: any;
71
+ };
72
+ }
73
+ interface IUploadIdentificationDocumentOptions extends IBaseSDKOptions {
74
+ resultChangeCallback: (results?: IUploadIdentificationDocumentResults) => void | Promise<void>;
75
+ successCallback: <FrameType, ResultsType = ILivenessResults<FrameType>>(results?: ResultsType) => void | Promise<void>;
76
+ errorCallback?: (error?: {
77
+ code: TErrorCode;
78
+ details?: any;
79
+ }) => void | Promise<void>;
80
+ endCallback?: TCallbackFunction;
81
+ }
82
+ export declare function uploadIdentificationDocument(options: IUploadIdentificationDocumentOptions): {
83
+ getResults: () => IUploadIdentificationDocumentResults;
84
+ startDocumentUpload: (file: FileType) => Promise<void>;
85
+ startLivenessDetection: (startLivenessDetectionOptions: TNodeSDKOptions) => Promise<{
86
+ stopLivenessDetection: () => Promise<void>;
87
+ } | undefined>;
88
+ startFaceComparison: () => void;
89
+ startAll: (file: FileType, startLivenessDetectionOptions: TNodeSDKOptions) => void;
90
+ };
91
+ export {};