@authme/engine 2.4.2 → 2.4.7
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/assets/engine-worker.js +1 -1
- package/assets/ml_engine_web.js +12 -7600
- package/assets/ml_engine_web.simd.js +12 -7600
- package/assets/ml_engine_web.simd.wasm +0 -0
- package/assets/ml_engine_web.wasm +0 -0
- package/assets/ml_engine_web_version.txt +1 -1
- package/index.cjs +31 -8
- package/index.js +33 -10
- package/package.json +3 -3
- package/src/lib/engine.d.ts +7 -0
- package/src/lib/enum/id-recognition.enum.d.ts +12 -1
- package/src/lib/interface/config.interface.d.ts +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
8.
|
|
1
|
+
8.6.3
|
package/index.cjs
CHANGED
|
@@ -119,6 +119,17 @@ exports.EAuthMeIDCardAntiFraudStatus = void 0;
|
|
|
119
119
|
EAuthMeIDCardAntiFraudStatus["NeedMoreFrame"] = "EAuthMeIDCardAntiFraudStatus_NeedMoreFrame";
|
|
120
120
|
EAuthMeIDCardAntiFraudStatus["Pass"] = "EAuthMeIDCardAntiFraudStatus_Pass";
|
|
121
121
|
EAuthMeIDCardAntiFraudStatus["Error"] = "EAuthMeIDCardAntiFraudStatus_Error";
|
|
122
|
+
EAuthMeIDCardAntiFraudStatus["Detect"] = "EAuthMeIDCardAntiFraudStatus_AntiFraudFeatureDetect";
|
|
123
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationLeft"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationLeft";
|
|
124
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationRight"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationRight";
|
|
125
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationUp"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationUp";
|
|
126
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationDown"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationDown";
|
|
127
|
+
EAuthMeIDCardAntiFraudStatus["CardCutByCamera"] = "EAuthMeIDCardAntiFraudStatus_CardCutByCamera";
|
|
128
|
+
EAuthMeIDCardAntiFraudStatus["CardNotInROI"] = "EAuthMeIDCardAntiFraudStatus_CardNotInROI";
|
|
129
|
+
EAuthMeIDCardAntiFraudStatus["CardTooSmall"] = "EAuthMeIDCardAntiFraudStatus_CardTooSmall";
|
|
130
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationFrontal"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationFrontal";
|
|
131
|
+
EAuthMeIDCardAntiFraudStatus["NeedHoldCard"] = "EAuthMeIDCardAntiFraudStatus_NeedHoldCard";
|
|
132
|
+
EAuthMeIDCardAntiFraudStatus["StagePass"] = "EAuthMeIDCardAntiFraudStatus_StagePass";
|
|
122
133
|
})(exports.EAuthMeIDCardAntiFraudStatus || (exports.EAuthMeIDCardAntiFraudStatus = {}));
|
|
123
134
|
exports.EAuthMeMRZRecogStatus = void 0;
|
|
124
135
|
(function (EAuthMeMRZRecogStatus) {
|
|
@@ -231,16 +242,13 @@ const defaultMlEngineConfig = {
|
|
|
231
242
|
eventTrackUrl: '/'
|
|
232
243
|
};
|
|
233
244
|
|
|
234
|
-
var name = "
|
|
235
|
-
var version$1 = "2.4.
|
|
236
|
-
var
|
|
237
|
-
"core-js": "^3.6.0",
|
|
238
|
-
rxjs: "^7.4.0"
|
|
239
|
-
};
|
|
245
|
+
var name = "authme/sdk";
|
|
246
|
+
var version$1 = "2.4.7";
|
|
247
|
+
var date = "2023-12-14T08:29:41+0000";
|
|
240
248
|
var packageInfo = {
|
|
241
249
|
name: name,
|
|
242
250
|
version: version$1,
|
|
243
|
-
|
|
251
|
+
date: date
|
|
244
252
|
};
|
|
245
253
|
|
|
246
254
|
var _a;
|
|
@@ -366,19 +374,23 @@ class MlEngine {
|
|
|
366
374
|
constructor(config) {
|
|
367
375
|
this.workerAndStreamPromise = undefined;
|
|
368
376
|
this.preloadPromise = undefined;
|
|
377
|
+
this.debugTools = util.debugTools();
|
|
369
378
|
this.config = Object.assign(Object.assign(Object.assign({}, defaultMlEngineConfig), config), {
|
|
370
379
|
isMobile: util.isMobile()
|
|
371
380
|
});
|
|
372
381
|
}
|
|
373
382
|
_run(worker, workerMessage$, module, command, value = {}) {
|
|
374
383
|
const id = (Math.random() + 1).toString(36).substring(4) + Date.now();
|
|
384
|
+
const durationTimeWorker = this.debugTools.setTimeDuration(`${module}_${command}_${id}`);
|
|
375
385
|
worker.postMessage({
|
|
376
386
|
module,
|
|
377
387
|
command,
|
|
378
388
|
id,
|
|
379
389
|
value
|
|
380
390
|
});
|
|
381
|
-
return rxjs.firstValueFrom(workerMessage$.pipe(rxjs.filter(x => x.id === id), rxjs.map(x => x.value))
|
|
391
|
+
return rxjs.firstValueFrom(workerMessage$.pipe(rxjs.filter(x => x.id === id), rxjs.map(x => x.value), rxjs.tap(() => {
|
|
392
|
+
durationTimeWorker.end();
|
|
393
|
+
})));
|
|
382
394
|
}
|
|
383
395
|
_makeWorkerAndStreamAsync() {
|
|
384
396
|
var _a;
|
|
@@ -463,7 +475,9 @@ class MlEngine {
|
|
|
463
475
|
const simdSupported = isSimdSupported();
|
|
464
476
|
const jsUrl = simdSupported ? `${(_a = this.config.scriptPath) !== null && _a !== void 0 ? _a : ''}ml_engine_web.simd.js` : `${(_b = this.config.scriptPath) !== null && _b !== void 0 ? _b : ''}ml_engine_web.js`;
|
|
465
477
|
const wasmUrl = simdSupported ? `${(_c = this.config.scriptPath) !== null && _c !== void 0 ? _c : ''}ml_engine_web.simd.wasm` : `${(_d = this.config.scriptPath) !== null && _d !== void 0 ? _d : ''}ml_engine_web.wasm`;
|
|
478
|
+
const durationTimeNetworkEngine = this.debugTools.setTimeDuration('loadEngine_network');
|
|
466
479
|
const [engineJsContent, engineWasmContent] = yield (_e = MlEngine._ENGINE_CACHE) !== null && _e !== void 0 ? _e : MlEngine._ENGINE_CACHE = Promise.all([getJsContentAsync(`${jsUrl}?t=${Date.now()}`), getWasmContentAsync(`${wasmUrl}?t=${Date.now()}`)]);
|
|
480
|
+
durationTimeNetworkEngine.end();
|
|
467
481
|
return yield this._run(worker, workerMessage$, exports.EngineModule.Core, 'loadEngine', {
|
|
468
482
|
engineJsContent,
|
|
469
483
|
engineWasmContent
|
|
@@ -550,6 +564,9 @@ class AuthmeEngineModuleBase {
|
|
|
550
564
|
getReport() {
|
|
551
565
|
return this._engineRunAsync('getJsonReport');
|
|
552
566
|
}
|
|
567
|
+
setOption(params) {
|
|
568
|
+
return this._engineRunAsync('setOption', params);
|
|
569
|
+
}
|
|
553
570
|
recognition(data) {
|
|
554
571
|
return __awaiter(this, void 0, void 0, function* () {
|
|
555
572
|
// status control
|
|
@@ -653,6 +670,12 @@ class AuthmeEngineModuleBase {
|
|
|
653
670
|
return true;
|
|
654
671
|
});
|
|
655
672
|
}
|
|
673
|
+
getUIParams() {
|
|
674
|
+
return this.engine.run(this.moduleName, 'getUIParams');
|
|
675
|
+
}
|
|
676
|
+
setUIParams(params) {
|
|
677
|
+
return this.engine.run(this.moduleName, 'setUIParams', params);
|
|
678
|
+
}
|
|
656
679
|
static reset_MODEL_CACHE() {
|
|
657
680
|
this._MODEL_CACHE = {};
|
|
658
681
|
}
|
package/index.js
CHANGED
|
@@ -16,8 +16,8 @@ import 'core-js/modules/es.object.assign.js';
|
|
|
16
16
|
import 'core-js/modules/es.regexp.to-string.js';
|
|
17
17
|
import 'core-js/modules/es.array.sort.js';
|
|
18
18
|
import { AuthmeError, ErrorCode, sendRequest } from '@authme/core';
|
|
19
|
-
import { isMobile, Storage } from '@authme/util';
|
|
20
|
-
import { firstValueFrom, filter, map, fromEvent, shareReplay, from, mergeAll, concatMap, of, reduce, defer, concatAll, mergeMap } from 'rxjs';
|
|
19
|
+
import { debugTools, isMobile, Storage } from '@authme/util';
|
|
20
|
+
import { firstValueFrom, filter, map, tap, fromEvent, shareReplay, from, mergeAll, concatMap, of, reduce, defer, concatAll, mergeMap } from 'rxjs';
|
|
21
21
|
import 'core-js/modules/es.symbol.description.js';
|
|
22
22
|
|
|
23
23
|
/******************************************************************************
|
|
@@ -115,6 +115,17 @@ var EAuthMeIDCardAntiFraudStatus;
|
|
|
115
115
|
EAuthMeIDCardAntiFraudStatus["NeedMoreFrame"] = "EAuthMeIDCardAntiFraudStatus_NeedMoreFrame";
|
|
116
116
|
EAuthMeIDCardAntiFraudStatus["Pass"] = "EAuthMeIDCardAntiFraudStatus_Pass";
|
|
117
117
|
EAuthMeIDCardAntiFraudStatus["Error"] = "EAuthMeIDCardAntiFraudStatus_Error";
|
|
118
|
+
EAuthMeIDCardAntiFraudStatus["Detect"] = "EAuthMeIDCardAntiFraudStatus_AntiFraudFeatureDetect";
|
|
119
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationLeft"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationLeft";
|
|
120
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationRight"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationRight";
|
|
121
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationUp"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationUp";
|
|
122
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationDown"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationDown";
|
|
123
|
+
EAuthMeIDCardAntiFraudStatus["CardCutByCamera"] = "EAuthMeIDCardAntiFraudStatus_CardCutByCamera";
|
|
124
|
+
EAuthMeIDCardAntiFraudStatus["CardNotInROI"] = "EAuthMeIDCardAntiFraudStatus_CardNotInROI";
|
|
125
|
+
EAuthMeIDCardAntiFraudStatus["CardTooSmall"] = "EAuthMeIDCardAntiFraudStatus_CardTooSmall";
|
|
126
|
+
EAuthMeIDCardAntiFraudStatus["NeedDeformationFrontal"] = "EAuthMeIDCardAntiFraudStatus_NeedDeformationFrontal";
|
|
127
|
+
EAuthMeIDCardAntiFraudStatus["NeedHoldCard"] = "EAuthMeIDCardAntiFraudStatus_NeedHoldCard";
|
|
128
|
+
EAuthMeIDCardAntiFraudStatus["StagePass"] = "EAuthMeIDCardAntiFraudStatus_StagePass";
|
|
118
129
|
})(EAuthMeIDCardAntiFraudStatus || (EAuthMeIDCardAntiFraudStatus = {}));
|
|
119
130
|
var EAuthMeMRZRecogStatus;
|
|
120
131
|
(function (EAuthMeMRZRecogStatus) {
|
|
@@ -227,16 +238,13 @@ const defaultMlEngineConfig = {
|
|
|
227
238
|
eventTrackUrl: '/'
|
|
228
239
|
};
|
|
229
240
|
|
|
230
|
-
var name = "
|
|
231
|
-
var version$1 = "2.4.
|
|
232
|
-
var
|
|
233
|
-
"core-js": "^3.6.0",
|
|
234
|
-
rxjs: "^7.4.0"
|
|
235
|
-
};
|
|
241
|
+
var name = "authme/sdk";
|
|
242
|
+
var version$1 = "2.4.7";
|
|
243
|
+
var date = "2023-12-14T08:29:41+0000";
|
|
236
244
|
var packageInfo = {
|
|
237
245
|
name: name,
|
|
238
246
|
version: version$1,
|
|
239
|
-
|
|
247
|
+
date: date
|
|
240
248
|
};
|
|
241
249
|
|
|
242
250
|
var _a;
|
|
@@ -362,19 +370,23 @@ class MlEngine {
|
|
|
362
370
|
constructor(config) {
|
|
363
371
|
this.workerAndStreamPromise = undefined;
|
|
364
372
|
this.preloadPromise = undefined;
|
|
373
|
+
this.debugTools = debugTools();
|
|
365
374
|
this.config = Object.assign(Object.assign(Object.assign({}, defaultMlEngineConfig), config), {
|
|
366
375
|
isMobile: isMobile()
|
|
367
376
|
});
|
|
368
377
|
}
|
|
369
378
|
_run(worker, workerMessage$, module, command, value = {}) {
|
|
370
379
|
const id = (Math.random() + 1).toString(36).substring(4) + Date.now();
|
|
380
|
+
const durationTimeWorker = this.debugTools.setTimeDuration(`${module}_${command}_${id}`);
|
|
371
381
|
worker.postMessage({
|
|
372
382
|
module,
|
|
373
383
|
command,
|
|
374
384
|
id,
|
|
375
385
|
value
|
|
376
386
|
});
|
|
377
|
-
return firstValueFrom(workerMessage$.pipe(filter(x => x.id === id), map(x => x.value))
|
|
387
|
+
return firstValueFrom(workerMessage$.pipe(filter(x => x.id === id), map(x => x.value), tap(() => {
|
|
388
|
+
durationTimeWorker.end();
|
|
389
|
+
})));
|
|
378
390
|
}
|
|
379
391
|
_makeWorkerAndStreamAsync() {
|
|
380
392
|
var _a;
|
|
@@ -459,7 +471,9 @@ class MlEngine {
|
|
|
459
471
|
const simdSupported = isSimdSupported();
|
|
460
472
|
const jsUrl = simdSupported ? `${(_a = this.config.scriptPath) !== null && _a !== void 0 ? _a : ''}ml_engine_web.simd.js` : `${(_b = this.config.scriptPath) !== null && _b !== void 0 ? _b : ''}ml_engine_web.js`;
|
|
461
473
|
const wasmUrl = simdSupported ? `${(_c = this.config.scriptPath) !== null && _c !== void 0 ? _c : ''}ml_engine_web.simd.wasm` : `${(_d = this.config.scriptPath) !== null && _d !== void 0 ? _d : ''}ml_engine_web.wasm`;
|
|
474
|
+
const durationTimeNetworkEngine = this.debugTools.setTimeDuration('loadEngine_network');
|
|
462
475
|
const [engineJsContent, engineWasmContent] = yield (_e = MlEngine._ENGINE_CACHE) !== null && _e !== void 0 ? _e : MlEngine._ENGINE_CACHE = Promise.all([getJsContentAsync(`${jsUrl}?t=${Date.now()}`), getWasmContentAsync(`${wasmUrl}?t=${Date.now()}`)]);
|
|
476
|
+
durationTimeNetworkEngine.end();
|
|
463
477
|
return yield this._run(worker, workerMessage$, EngineModule.Core, 'loadEngine', {
|
|
464
478
|
engineJsContent,
|
|
465
479
|
engineWasmContent
|
|
@@ -546,6 +560,9 @@ class AuthmeEngineModuleBase {
|
|
|
546
560
|
getReport() {
|
|
547
561
|
return this._engineRunAsync('getJsonReport');
|
|
548
562
|
}
|
|
563
|
+
setOption(params) {
|
|
564
|
+
return this._engineRunAsync('setOption', params);
|
|
565
|
+
}
|
|
549
566
|
recognition(data) {
|
|
550
567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
551
568
|
// status control
|
|
@@ -649,6 +666,12 @@ class AuthmeEngineModuleBase {
|
|
|
649
666
|
return true;
|
|
650
667
|
});
|
|
651
668
|
}
|
|
669
|
+
getUIParams() {
|
|
670
|
+
return this.engine.run(this.moduleName, 'getUIParams');
|
|
671
|
+
}
|
|
672
|
+
setUIParams(params) {
|
|
673
|
+
return this.engine.run(this.moduleName, 'setUIParams', params);
|
|
674
|
+
}
|
|
652
675
|
static reset_MODEL_CACHE() {
|
|
653
676
|
this._MODEL_CACHE = {};
|
|
654
677
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/engine",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0",
|
|
6
6
|
"rxjs": "^7.4.0",
|
|
7
|
-
"@authme/core": "2.4.
|
|
8
|
-
"@authme/util": "2.4.
|
|
7
|
+
"@authme/core": "2.4.7",
|
|
8
|
+
"@authme/util": "2.4.7"
|
|
9
9
|
},
|
|
10
10
|
"module": "./index.js",
|
|
11
11
|
"main": "./index.cjs",
|
package/src/lib/engine.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class MlEngine {
|
|
|
10
10
|
private workerAndStreamPromise;
|
|
11
11
|
private preloadPromise;
|
|
12
12
|
constructor(config: MlEngineConfig);
|
|
13
|
+
private debugTools;
|
|
13
14
|
private _run;
|
|
14
15
|
private _makeWorkerAndStreamAsync;
|
|
15
16
|
private _backgroundPreloadAsync;
|
|
@@ -39,6 +40,10 @@ export declare abstract class AuthmeEngineModuleBase<T = any> {
|
|
|
39
40
|
startSession(): Promise<void>;
|
|
40
41
|
stop(): Promise<void>;
|
|
41
42
|
getReport(): Promise<string>;
|
|
43
|
+
setOption(params: {
|
|
44
|
+
key: string;
|
|
45
|
+
value: string;
|
|
46
|
+
}): Promise<void>;
|
|
42
47
|
recognition(data: Uint8Array | Uint8ClampedArray): Promise<T & EngineDebugInfo>;
|
|
43
48
|
getDebugImageData(data: Uint8Array | Uint8ClampedArray): Promise<Uint8Array>;
|
|
44
49
|
setFrameSize(width: number, height: number): Promise<boolean>;
|
|
@@ -49,5 +54,7 @@ export declare abstract class AuthmeEngineModuleBase<T = any> {
|
|
|
49
54
|
encryptBlob(uint8Array: ArrayBuffer, key: string): Promise<string>;
|
|
50
55
|
_decryptString(str: string, key: string): Promise<string>;
|
|
51
56
|
destroy(): Promise<boolean>;
|
|
57
|
+
getUIParams(): Promise<unknown>;
|
|
58
|
+
setUIParams(params: unknown): Promise<unknown>;
|
|
52
59
|
static reset_MODEL_CACHE(): void;
|
|
53
60
|
}
|
|
@@ -41,7 +41,18 @@ export declare enum EAuthMeIDCardAntiFraudStatus {
|
|
|
41
41
|
PositionNotMatch = "EAuthMeIDCardAntiFraudStatus_PositionNotMatch",
|
|
42
42
|
NeedMoreFrame = "EAuthMeIDCardAntiFraudStatus_NeedMoreFrame",
|
|
43
43
|
Pass = "EAuthMeIDCardAntiFraudStatus_Pass",
|
|
44
|
-
Error = "EAuthMeIDCardAntiFraudStatus_Error"
|
|
44
|
+
Error = "EAuthMeIDCardAntiFraudStatus_Error",
|
|
45
|
+
Detect = "EAuthMeIDCardAntiFraudStatus_AntiFraudFeatureDetect",
|
|
46
|
+
NeedDeformationLeft = "EAuthMeIDCardAntiFraudStatus_NeedDeformationLeft",
|
|
47
|
+
NeedDeformationRight = "EAuthMeIDCardAntiFraudStatus_NeedDeformationRight",
|
|
48
|
+
NeedDeformationUp = "EAuthMeIDCardAntiFraudStatus_NeedDeformationUp",
|
|
49
|
+
NeedDeformationDown = "EAuthMeIDCardAntiFraudStatus_NeedDeformationDown",
|
|
50
|
+
CardCutByCamera = "EAuthMeIDCardAntiFraudStatus_CardCutByCamera",
|
|
51
|
+
CardNotInROI = "EAuthMeIDCardAntiFraudStatus_CardNotInROI",
|
|
52
|
+
CardTooSmall = "EAuthMeIDCardAntiFraudStatus_CardTooSmall",
|
|
53
|
+
NeedDeformationFrontal = "EAuthMeIDCardAntiFraudStatus_NeedDeformationFrontal",
|
|
54
|
+
NeedHoldCard = "EAuthMeIDCardAntiFraudStatus_NeedHoldCard",
|
|
55
|
+
StagePass = "EAuthMeIDCardAntiFraudStatus_StagePass"
|
|
45
56
|
}
|
|
46
57
|
export declare enum EAuthMeMRZRecogStatus {
|
|
47
58
|
Success = "EAuthMeMRZRecogStatus_Success",
|