@authme/engine 2.3.1-rc.1 → 2.4.2

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.
Binary file
Binary file
@@ -1 +1 @@
1
- 5.4.1
1
+ 8.2.0
package/index.cjs CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('core-js/modules/es.array.iterator.js');
6
6
  require('core-js/modules/es.object.from-entries.js');
7
+ require('core-js/modules/es.regexp.exec.js');
7
8
  require('core-js/modules/es.array-buffer.slice.js');
8
9
  require('core-js/modules/es.typed-array.uint8-array.js');
9
10
  require('core-js/modules/es.typed-array.fill.js');
@@ -53,9 +54,10 @@ exports.EngineModule = void 0;
53
54
  EngineModule["Fas"] = "Fas";
54
55
  EngineModule["IdCardAntiFraud"] = "IdCardAntiFraud";
55
56
  EngineModule["CardOCR"] = "CardOCR";
56
- EngineModule["PassportService"] = "PassportService";
57
57
  EngineModule["DEBUG"] = "DEBUG";
58
58
  EngineModule["Core"] = "Core";
59
+ EngineModule["MRZPassportService"] = "MRZPassportService";
60
+ EngineModule["MRZResidentCardService"] = "MRZResidentCardService";
59
61
  })(exports.EngineModule || (exports.EngineModule = {}));
60
62
 
61
63
  exports.EAuthMeEngineReturnCode = void 0;
@@ -123,15 +125,16 @@ exports.EAuthMeMRZRecogStatus = void 0;
123
125
  EAuthMeMRZRecogStatus["Success"] = "EAuthMeMRZRecogStatus_Success";
124
126
  EAuthMeMRZRecogStatus["WrongFormat"] = "EAuthMeMRZRecogStatus_WrongFormat";
125
127
  })(exports.EAuthMeMRZRecogStatus || (exports.EAuthMeMRZRecogStatus = {}));
126
- exports.EAuthMePassportServiceStatus = void 0;
127
- (function (EAuthMePassportServiceStatus) {
128
- EAuthMePassportServiceStatus["Success"] = "EAuthMePassportServiceStatus_Success";
129
- EAuthMePassportServiceStatus["NotFound"] = "EAuthMePassportServiceStatus_NotFound";
130
- EAuthMePassportServiceStatus["RecogFailed"] = "EAuthMePassportServiceStatus_RecogFailed";
131
- EAuthMePassportServiceStatus["Error"] = "EAuthMePassportServiceStatus_Error";
132
- EAuthMePassportServiceStatus["NotAligned"] = "EAuthMePassportServiceStatus_NotAligned";
133
- EAuthMePassportServiceStatus["Reflective"] = "EAuthMePassportServiceStatus_Reflective";
134
- })(exports.EAuthMePassportServiceStatus || (exports.EAuthMePassportServiceStatus = {}));
128
+ exports.EAuthMeMRZServiceStatus = void 0;
129
+ (function (EAuthMeMRZServiceStatus) {
130
+ EAuthMeMRZServiceStatus["Success"] = "EAuthMeMRZServiceStatus_Success";
131
+ EAuthMeMRZServiceStatus["NotFound"] = "EAuthMeMRZServiceStatus_NotFound";
132
+ EAuthMeMRZServiceStatus["RecogFailed"] = "EAuthMeMRZServiceStatus_RecogFailed";
133
+ EAuthMeMRZServiceStatus["WrongCardType"] = "EAuthMeMRZServiceStatus_WrongCardType";
134
+ EAuthMeMRZServiceStatus["Error"] = "EAuthMeMRZServiceStatus_Error";
135
+ EAuthMeMRZServiceStatus["NotAligned"] = "EAuthMeMRZServiceStatus_NotAligned";
136
+ EAuthMeMRZServiceStatus["Reflective"] = "EAuthMeMRZServiceStatus_Reflective";
137
+ })(exports.EAuthMeMRZServiceStatus || (exports.EAuthMeMRZServiceStatus = {}));
135
138
  exports.EAuthMeIDCardAntiFraudStage = void 0;
136
139
  (function (EAuthMeIDCardAntiFraudStage) {
137
140
  EAuthMeIDCardAntiFraudStage["Frontal"] = "EAuthMeIDCardAntiFraudStage_Frontal";
@@ -151,7 +154,7 @@ var idRecognitionEnumModule = /*#__PURE__*/Object.freeze({
151
154
  get EAuthMeCardOCRStatus () { return exports.EAuthMeCardOCRStatus; },
152
155
  get EAuthMeIDCardAntiFraudStatus () { return exports.EAuthMeIDCardAntiFraudStatus; },
153
156
  get EAuthMeMRZRecogStatus () { return exports.EAuthMeMRZRecogStatus; },
154
- get EAuthMePassportServiceStatus () { return exports.EAuthMePassportServiceStatus; },
157
+ get EAuthMeMRZServiceStatus () { return exports.EAuthMeMRZServiceStatus; },
155
158
  get EAuthMeIDCardAntiFraudStage () { return exports.EAuthMeIDCardAntiFraudStage; }
156
159
  });
157
160
 
@@ -223,11 +226,13 @@ const defaultMlEngineConfig = {
223
226
  token: '',
224
227
  scriptPath: '/assets/',
225
228
  apiBaseUrl: '/',
226
- dataTransferMethod: 'binary'
229
+ dataTransferMethod: 'binary',
230
+ enableEventTracking: false,
231
+ eventTrackUrl: '/'
227
232
  };
228
233
 
229
234
  var name = "@authme/engine";
230
- var version$1 = "2.3.1-rc.1";
235
+ var version$1 = "2.4.2";
231
236
  var peerDependencies = {
232
237
  "core-js": "^3.6.0",
233
238
  rxjs: "^7.4.0"
@@ -259,6 +264,10 @@ const getDownloadOrder = function () {
259
264
  }();
260
265
  function isSimdSupported() {
261
266
  try {
267
+ const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
268
+ if (isiOS) {
269
+ return false;
270
+ }
262
271
  // Test for WebAssembly SIMD capability (for both browsers and Node.js)
263
272
  // This typed array is a WebAssembly program containing SIMD instructions.
264
273
  return WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 15, 26, 11]));
@@ -611,6 +620,31 @@ class AuthmeEngineModuleBase {
611
620
  positions
612
621
  });
613
622
  }
623
+ encryptString(str, key) {
624
+ return __awaiter(this, void 0, void 0, function* () {
625
+ return yield this._engineRunAsync('encryptString', {
626
+ string: str,
627
+ key
628
+ });
629
+ });
630
+ }
631
+ encryptBlob(uint8Array, key) {
632
+ return __awaiter(this, void 0, void 0, function* () {
633
+ return yield this._engineRunAsync('encryptBlob', {
634
+ uint8Array: uint8Array,
635
+ key
636
+ });
637
+ });
638
+ }
639
+ // 測試圖片上傳加密用,未來實作後請刪除。
640
+ _decryptString(str, key) {
641
+ return __awaiter(this, void 0, void 0, function* () {
642
+ return yield this._engineRunAsync('_decryptString', {
643
+ string: str,
644
+ key
645
+ });
646
+ });
647
+ }
614
648
  destroy() {
615
649
  return __awaiter(this, void 0, void 0, function* () {
616
650
  yield this._engineRunAsync('destroy');
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import 'core-js/modules/es.array.iterator.js';
2
2
  import 'core-js/modules/es.object.from-entries.js';
3
+ import 'core-js/modules/es.regexp.exec.js';
3
4
  import 'core-js/modules/es.array-buffer.slice.js';
4
5
  import 'core-js/modules/es.typed-array.uint8-array.js';
5
6
  import 'core-js/modules/es.typed-array.fill.js';
@@ -49,9 +50,10 @@ var EngineModule;
49
50
  EngineModule["Fas"] = "Fas";
50
51
  EngineModule["IdCardAntiFraud"] = "IdCardAntiFraud";
51
52
  EngineModule["CardOCR"] = "CardOCR";
52
- EngineModule["PassportService"] = "PassportService";
53
53
  EngineModule["DEBUG"] = "DEBUG";
54
54
  EngineModule["Core"] = "Core";
55
+ EngineModule["MRZPassportService"] = "MRZPassportService";
56
+ EngineModule["MRZResidentCardService"] = "MRZResidentCardService";
55
57
  })(EngineModule || (EngineModule = {}));
56
58
 
57
59
  var EAuthMeEngineReturnCode;
@@ -119,15 +121,16 @@ var EAuthMeMRZRecogStatus;
119
121
  EAuthMeMRZRecogStatus["Success"] = "EAuthMeMRZRecogStatus_Success";
120
122
  EAuthMeMRZRecogStatus["WrongFormat"] = "EAuthMeMRZRecogStatus_WrongFormat";
121
123
  })(EAuthMeMRZRecogStatus || (EAuthMeMRZRecogStatus = {}));
122
- var EAuthMePassportServiceStatus;
123
- (function (EAuthMePassportServiceStatus) {
124
- EAuthMePassportServiceStatus["Success"] = "EAuthMePassportServiceStatus_Success";
125
- EAuthMePassportServiceStatus["NotFound"] = "EAuthMePassportServiceStatus_NotFound";
126
- EAuthMePassportServiceStatus["RecogFailed"] = "EAuthMePassportServiceStatus_RecogFailed";
127
- EAuthMePassportServiceStatus["Error"] = "EAuthMePassportServiceStatus_Error";
128
- EAuthMePassportServiceStatus["NotAligned"] = "EAuthMePassportServiceStatus_NotAligned";
129
- EAuthMePassportServiceStatus["Reflective"] = "EAuthMePassportServiceStatus_Reflective";
130
- })(EAuthMePassportServiceStatus || (EAuthMePassportServiceStatus = {}));
124
+ var EAuthMeMRZServiceStatus;
125
+ (function (EAuthMeMRZServiceStatus) {
126
+ EAuthMeMRZServiceStatus["Success"] = "EAuthMeMRZServiceStatus_Success";
127
+ EAuthMeMRZServiceStatus["NotFound"] = "EAuthMeMRZServiceStatus_NotFound";
128
+ EAuthMeMRZServiceStatus["RecogFailed"] = "EAuthMeMRZServiceStatus_RecogFailed";
129
+ EAuthMeMRZServiceStatus["WrongCardType"] = "EAuthMeMRZServiceStatus_WrongCardType";
130
+ EAuthMeMRZServiceStatus["Error"] = "EAuthMeMRZServiceStatus_Error";
131
+ EAuthMeMRZServiceStatus["NotAligned"] = "EAuthMeMRZServiceStatus_NotAligned";
132
+ EAuthMeMRZServiceStatus["Reflective"] = "EAuthMeMRZServiceStatus_Reflective";
133
+ })(EAuthMeMRZServiceStatus || (EAuthMeMRZServiceStatus = {}));
131
134
  var EAuthMeIDCardAntiFraudStage;
132
135
  (function (EAuthMeIDCardAntiFraudStage) {
133
136
  EAuthMeIDCardAntiFraudStage["Frontal"] = "EAuthMeIDCardAntiFraudStage_Frontal";
@@ -147,7 +150,7 @@ var idRecognitionEnumModule = /*#__PURE__*/Object.freeze({
147
150
  get EAuthMeCardOCRStatus () { return EAuthMeCardOCRStatus; },
148
151
  get EAuthMeIDCardAntiFraudStatus () { return EAuthMeIDCardAntiFraudStatus; },
149
152
  get EAuthMeMRZRecogStatus () { return EAuthMeMRZRecogStatus; },
150
- get EAuthMePassportServiceStatus () { return EAuthMePassportServiceStatus; },
153
+ get EAuthMeMRZServiceStatus () { return EAuthMeMRZServiceStatus; },
151
154
  get EAuthMeIDCardAntiFraudStage () { return EAuthMeIDCardAntiFraudStage; }
152
155
  });
153
156
 
@@ -219,11 +222,13 @@ const defaultMlEngineConfig = {
219
222
  token: '',
220
223
  scriptPath: '/assets/',
221
224
  apiBaseUrl: '/',
222
- dataTransferMethod: 'binary'
225
+ dataTransferMethod: 'binary',
226
+ enableEventTracking: false,
227
+ eventTrackUrl: '/'
223
228
  };
224
229
 
225
230
  var name = "@authme/engine";
226
- var version$1 = "2.3.1-rc.1";
231
+ var version$1 = "2.4.2";
227
232
  var peerDependencies = {
228
233
  "core-js": "^3.6.0",
229
234
  rxjs: "^7.4.0"
@@ -255,6 +260,10 @@ const getDownloadOrder = function () {
255
260
  }();
256
261
  function isSimdSupported() {
257
262
  try {
263
+ const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
264
+ if (isiOS) {
265
+ return false;
266
+ }
258
267
  // Test for WebAssembly SIMD capability (for both browsers and Node.js)
259
268
  // This typed array is a WebAssembly program containing SIMD instructions.
260
269
  return WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 15, 26, 11]));
@@ -607,6 +616,31 @@ class AuthmeEngineModuleBase {
607
616
  positions
608
617
  });
609
618
  }
619
+ encryptString(str, key) {
620
+ return __awaiter(this, void 0, void 0, function* () {
621
+ return yield this._engineRunAsync('encryptString', {
622
+ string: str,
623
+ key
624
+ });
625
+ });
626
+ }
627
+ encryptBlob(uint8Array, key) {
628
+ return __awaiter(this, void 0, void 0, function* () {
629
+ return yield this._engineRunAsync('encryptBlob', {
630
+ uint8Array: uint8Array,
631
+ key
632
+ });
633
+ });
634
+ }
635
+ // 測試圖片上傳加密用,未來實作後請刪除。
636
+ _decryptString(str, key) {
637
+ return __awaiter(this, void 0, void 0, function* () {
638
+ return yield this._engineRunAsync('_decryptString', {
639
+ string: str,
640
+ key
641
+ });
642
+ });
643
+ }
610
644
  destroy() {
611
645
  return __awaiter(this, void 0, void 0, function* () {
612
646
  yield this._engineRunAsync('destroy');
@@ -621,4 +655,4 @@ class AuthmeEngineModuleBase {
621
655
  }
622
656
  AuthmeEngineModuleBase._MODEL_CACHE = {};
623
657
 
624
- export { AuthmeEngineModuleBase, AuthmeFunctionModule, EAuthMeCardClass, EAuthMeCardMatchStatus, EAuthMeCardOCRStatus, EAuthMeEngineReturnCode, EAuthMeEyeStatus, EAuthMeFASServiceStage, EAuthMeFASServiceStatus, EAuthMeFaceAntiSpoofingStatus, EAuthMeFacePose, EAuthMeIDCardAntiFraudStage, EAuthMeIDCardAntiFraudStatus, EAuthMeIDCardMetalTagStatus, EAuthMeMRZRecogStatus, EAuthMeMouthStatus, EAuthMePassportServiceStatus, EngineModule, MlEngine, defaultMlEngineConfig, version };
658
+ export { AuthmeEngineModuleBase, AuthmeFunctionModule, EAuthMeCardClass, EAuthMeCardMatchStatus, EAuthMeCardOCRStatus, EAuthMeEngineReturnCode, EAuthMeEyeStatus, EAuthMeFASServiceStage, EAuthMeFASServiceStatus, EAuthMeFaceAntiSpoofingStatus, EAuthMeFacePose, EAuthMeIDCardAntiFraudStage, EAuthMeIDCardAntiFraudStatus, EAuthMeIDCardMetalTagStatus, EAuthMeMRZRecogStatus, EAuthMeMRZServiceStatus, EAuthMeMouthStatus, EngineModule, MlEngine, defaultMlEngineConfig, version };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@authme/engine",
3
- "version": "2.3.1-rc.1",
3
+ "version": "2.4.2",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
6
  "rxjs": "^7.4.0",
7
- "@authme/core": "2.3.1-rc.1",
8
- "@authme/util": "2.3.1-rc.1"
7
+ "@authme/core": "2.4.2",
8
+ "@authme/util": "2.4.2"
9
9
  },
10
10
  "module": "./index.js",
11
11
  "main": "./index.cjs",
@@ -45,6 +45,9 @@ export declare abstract class AuthmeEngineModuleBase<T = any> {
45
45
  getParams(): Promise<EngineParams>;
46
46
  setParams(params: any): Promise<unknown>;
47
47
  setMaskPosition(positions: number[][]): Promise<unknown>;
48
+ encryptString(str: string, key: string): Promise<string>;
49
+ encryptBlob(uint8Array: ArrayBuffer, key: string): Promise<string>;
50
+ _decryptString(str: string, key: string): Promise<string>;
48
51
  destroy(): Promise<boolean>;
49
52
  static reset_MODEL_CACHE(): void;
50
53
  }
@@ -47,13 +47,14 @@ export declare enum EAuthMeMRZRecogStatus {
47
47
  Success = "EAuthMeMRZRecogStatus_Success",
48
48
  WrongFormat = "EAuthMeMRZRecogStatus_WrongFormat"
49
49
  }
50
- export declare enum EAuthMePassportServiceStatus {
51
- Success = "EAuthMePassportServiceStatus_Success",
52
- NotFound = "EAuthMePassportServiceStatus_NotFound",
53
- RecogFailed = "EAuthMePassportServiceStatus_RecogFailed",
54
- Error = "EAuthMePassportServiceStatus_Error",
55
- NotAligned = "EAuthMePassportServiceStatus_NotAligned",
56
- Reflective = "EAuthMePassportServiceStatus_Reflective"
50
+ export declare enum EAuthMeMRZServiceStatus {
51
+ Success = "EAuthMeMRZServiceStatus_Success",
52
+ NotFound = "EAuthMeMRZServiceStatus_NotFound",
53
+ RecogFailed = "EAuthMeMRZServiceStatus_RecogFailed",
54
+ WrongCardType = "EAuthMeMRZServiceStatus_WrongCardType",
55
+ Error = "EAuthMeMRZServiceStatus_Error",
56
+ NotAligned = "EAuthMeMRZServiceStatus_NotAligned",
57
+ Reflective = "EAuthMeMRZServiceStatus_Reflective"
57
58
  }
58
59
  export declare enum EAuthMeIDCardAntiFraudStage {
59
60
  Frontal = "EAuthMeIDCardAntiFraudStage_Frontal",
@@ -2,7 +2,8 @@ export declare enum EngineModule {
2
2
  Fas = "Fas",
3
3
  IdCardAntiFraud = "IdCardAntiFraud",
4
4
  CardOCR = "CardOCR",
5
- PassportService = "PassportService",
6
5
  DEBUG = "DEBUG",
7
- Core = "Core"
6
+ Core = "Core",
7
+ MRZPassportService = "MRZPassportService",
8
+ MRZResidentCardService = "MRZResidentCardService"
8
9
  }
@@ -3,5 +3,7 @@ export interface MlEngineConfig {
3
3
  scriptPath?: string;
4
4
  apiBaseUrl?: string;
5
5
  dataTransferMethod?: 'binary' | 'base64';
6
+ enableEventTracking?: boolean;
7
+ eventTrackUrl?: string;
6
8
  }
7
9
  export declare const defaultMlEngineConfig: MlEngineConfig;