@authme/id-recognition 2.4.8 → 2.4.10

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/index.cjs CHANGED
@@ -6,10 +6,8 @@ require('core-js/modules/es.object.assign.js');
6
6
  var engine = require('@authme/engine');
7
7
  require('core-js/modules/es.array.iterator.js');
8
8
  require('core-js/modules/es.object.from-entries.js');
9
- require('core-js/modules/es.regexp.to-string.js');
10
9
  require('core-js/modules/web.dom-collections.iterator.js');
11
10
  var core = require('@authme/core');
12
- var util = require('@authme/util');
13
11
  require('core-js/modules/es.symbol.description.js');
14
12
 
15
13
  exports.ResourceImageType = void 0;
@@ -21,25 +19,7 @@ exports.ResourceImageType = void 0;
21
19
  exports.CountryCode = void 0;
22
20
  (function (CountryCode) {
23
21
  CountryCode["TWN"] = "TWN";
24
- CountryCode["JPN"] = "JPN";
25
- CountryCode["ZAF"] = "ZAF";
26
- CountryCode["USA"] = "USA";
27
- CountryCode["CHN"] = "CHN";
28
- CountryCode["PHL"] = "PHL";
29
- CountryCode["GBR"] = "GBR";
30
- CountryCode["KOR"] = "KOR";
31
- CountryCode["HKG"] = "HKG";
32
- CountryCode["FRA"] = "FRA";
33
- CountryCode["ESP"] = "ESP";
34
- CountryCode["MEX"] = "MEX";
35
- CountryCode["ITA"] = "ITA";
36
- CountryCode["IND"] = "IND";
37
- CountryCode["COL"] = "COL";
38
- CountryCode["RUS"] = "RUS";
39
- CountryCode["DEU"] = "DEU";
40
- CountryCode["TUR"] = "TUR";
41
- CountryCode["CAN"] = "CAN";
42
- CountryCode["AUS"] = "AUS";
22
+ CountryCode["JPW"] = "JP";
43
23
  })(exports.CountryCode || (exports.CountryCode = {}));
44
24
  exports.IdRecognitionCardType = void 0;
45
25
  (function (IdRecognitionCardType) {
@@ -160,67 +140,6 @@ const RECOGNITION_COLUMNS_ORDER = Object.fromEntries(['surname', 'givenName', 'n
160
140
  function getCardSubTypes(type, country) {
161
141
  return CardTypeMapping[type];
162
142
  }
163
- function cardTypeTitle(cardType) {
164
- if (cardType == null) {
165
- return '';
166
- }
167
- const cardTypeLower = cardType.toLowerCase();
168
- let titleKey = null;
169
- if (cardTypeLower.indexOf('idcard') != -1) {
170
- if (cardTypeLower.indexOf('front')) {
171
- titleKey = 'verify.idCardFrontSide';
172
- } else {
173
- titleKey = 'verify.idCardBackSide';
174
- }
175
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
176
- if (cardTypeLower.indexOf('front')) {
177
- titleKey = 'verify.licenseFrontSide';
178
- } else {
179
- titleKey = 'verify.licenseBackSide';
180
- }
181
- } else if (cardTypeLower.indexOf('resident') != -1) {
182
- if (cardTypeLower.indexOf('front')) {
183
- titleKey = 'verify.residentCardFrontSide';
184
- } else {
185
- titleKey = 'verify.residentCardBackSide';
186
- }
187
- }
188
- return titleKey;
189
- }
190
- function cardTypeConfirmTitle(cardType) {
191
- if (cardType == null) {
192
- return '';
193
- }
194
- const cardTypeLower = cardType.toLowerCase();
195
- let titleKey = null;
196
- if (cardTypeLower.indexOf('idcard') != -1) {
197
- if (cardTypeLower.indexOf('front')) {
198
- titleKey = 'verify.confirmIdCardFront';
199
- } else {
200
- titleKey = 'verify.confirmIdCardBack';
201
- }
202
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
203
- if (cardTypeLower.indexOf('front')) {
204
- titleKey = 'verify.confirmLicenseFront';
205
- } else {
206
- titleKey = 'verify.confirmLicenseBack';
207
- }
208
- } else if (cardTypeLower.indexOf('resident') != -1) {
209
- if (cardTypeLower.indexOf('front')) {
210
- titleKey = 'verify.confirmResidentCardFrontSide';
211
- } else {
212
- titleKey = 'verify.confirmResidentCardBackSide';
213
- }
214
- }
215
- return titleKey;
216
- }
217
- function mapCardtypeToAuthmeClass(type) {
218
- const known_type = Object.keys(engine.EAuthMeCardClass).filter(key => engine.EAuthMeCardClass[key].toString().toLowerCase() == ('EAuthMeCardClass_' + type).toLowerCase())[0];
219
- if (known_type == null) {
220
- return engine.EAuthMeCardClass.Unknown;
221
- }
222
- return engine.EAuthMeCardClass[known_type];
223
- }
224
143
  function getRecognitionColumnOrder(column) {
225
144
  var _a;
226
145
  return (_a = RECOGNITION_COLUMNS_ORDER[column]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
@@ -238,30 +157,12 @@ const twoWayAuthmeCardClassMap = (() => {
238
157
  };
239
158
  })();
240
159
 
241
- var name = "authme/sdk";
242
- var version$1 = "2.4.8";
243
- var date = "2023-12-20T07:24:47+0000";
244
- var packageInfo = {
245
- name: name,
246
- version: version$1,
247
- date: date
248
- };
249
-
250
- function init(type, country, needConfirm, cardTypes, encrypt = true) {
251
- let useCardTypes = getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c));
252
- if (cardTypes.length) {
253
- useCardTypes = cardTypes;
254
- }
160
+ function init(type, country, needConfirm, encrypt = true) {
255
161
  const body = {
256
162
  scanType: type === exports.IdRecognitionCardType.Passport ? type : `${country}_${type}`,
257
- cardTypes: useCardTypes,
163
+ cardTypes: getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c)),
258
164
  needConfirm,
259
- encrypt,
260
- clientInfo: {
261
- os: 'web',
262
- os_ver: util.osVersion(),
263
- client_ver: packageInfo.version
264
- }
165
+ encrypt
265
166
  };
266
167
  return core.sendRequest('/api/identity-verification/id-recognition/v3/init-scan', 'POST', {
267
168
  body: JSON.stringify(body)
@@ -382,6 +283,17 @@ function saveExtraDoc(params) {
382
283
  });
383
284
  }
384
285
 
286
+ var name = "@authme/id-recognition";
287
+ var version$1 = "2.4.10";
288
+ var peerDependencies = {
289
+ "core-js": "^3.6.0"
290
+ };
291
+ var packageInfo = {
292
+ name: name,
293
+ version: version$1,
294
+ peerDependencies: peerDependencies
295
+ };
296
+
385
297
  var _a;
386
298
  var _b, _c;
387
299
  const version = packageInfo.version;
@@ -420,15 +332,12 @@ exports.CardOCR = CardOCR;
420
332
  exports.IdCardAntiFraudService = IdCardAntiFraudService;
421
333
  exports.IdTypeConfig = IdTypeConfig;
422
334
  exports.MRZService = MRZService;
423
- exports.cardTypeConfirmTitle = cardTypeConfirmTitle;
424
- exports.cardTypeTitle = cardTypeTitle;
425
335
  exports.confirmScan = confirmScan;
426
336
  exports.finishScanDocument = finishScanDocument;
427
337
  exports.getCardSubTypes = getCardSubTypes;
428
338
  exports.getRecognitionColumnOrder = getRecognitionColumnOrder;
429
339
  exports.init = init;
430
340
  exports.initScanDocument = initScanDocument;
431
- exports.mapCardtypeToAuthmeClass = mapCardtypeToAuthmeClass;
432
341
  exports.recognition = recognition;
433
342
  exports.recognitionEncrypt = recognitionEncrypt;
434
343
  exports.saveExtraDoc = saveExtraDoc;
package/index.js CHANGED
@@ -3,10 +3,8 @@ import { AuthmeEngineModuleBase, EAuthMeCardClass, EngineModule } from '@authme/
3
3
  export { EAuthMeCardClass, EAuthMeCardMatchStatus, EAuthMeCardOCRStatus, EAuthMeIDCardAntiFraudStage, EAuthMeIDCardAntiFraudStatus, EAuthMeMRZRecogStatus, EAuthMeMRZServiceStatus } from '@authme/engine';
4
4
  import 'core-js/modules/es.array.iterator.js';
5
5
  import 'core-js/modules/es.object.from-entries.js';
6
- import 'core-js/modules/es.regexp.to-string.js';
7
6
  import 'core-js/modules/web.dom-collections.iterator.js';
8
7
  import { sendRequest, AuthmeError } from '@authme/core';
9
- import { osVersion } from '@authme/util';
10
8
  import 'core-js/modules/es.symbol.description.js';
11
9
 
12
10
  var ResourceImageType;
@@ -18,25 +16,7 @@ var ResourceImageType;
18
16
  var CountryCode;
19
17
  (function (CountryCode) {
20
18
  CountryCode["TWN"] = "TWN";
21
- CountryCode["JPN"] = "JPN";
22
- CountryCode["ZAF"] = "ZAF";
23
- CountryCode["USA"] = "USA";
24
- CountryCode["CHN"] = "CHN";
25
- CountryCode["PHL"] = "PHL";
26
- CountryCode["GBR"] = "GBR";
27
- CountryCode["KOR"] = "KOR";
28
- CountryCode["HKG"] = "HKG";
29
- CountryCode["FRA"] = "FRA";
30
- CountryCode["ESP"] = "ESP";
31
- CountryCode["MEX"] = "MEX";
32
- CountryCode["ITA"] = "ITA";
33
- CountryCode["IND"] = "IND";
34
- CountryCode["COL"] = "COL";
35
- CountryCode["RUS"] = "RUS";
36
- CountryCode["DEU"] = "DEU";
37
- CountryCode["TUR"] = "TUR";
38
- CountryCode["CAN"] = "CAN";
39
- CountryCode["AUS"] = "AUS";
19
+ CountryCode["JPW"] = "JP";
40
20
  })(CountryCode || (CountryCode = {}));
41
21
  var IdRecognitionCardType;
42
22
  (function (IdRecognitionCardType) {
@@ -157,67 +137,6 @@ const RECOGNITION_COLUMNS_ORDER = Object.fromEntries(['surname', 'givenName', 'n
157
137
  function getCardSubTypes(type, country) {
158
138
  return CardTypeMapping[type];
159
139
  }
160
- function cardTypeTitle(cardType) {
161
- if (cardType == null) {
162
- return '';
163
- }
164
- const cardTypeLower = cardType.toLowerCase();
165
- let titleKey = null;
166
- if (cardTypeLower.indexOf('idcard') != -1) {
167
- if (cardTypeLower.indexOf('front')) {
168
- titleKey = 'verify.idCardFrontSide';
169
- } else {
170
- titleKey = 'verify.idCardBackSide';
171
- }
172
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
173
- if (cardTypeLower.indexOf('front')) {
174
- titleKey = 'verify.licenseFrontSide';
175
- } else {
176
- titleKey = 'verify.licenseBackSide';
177
- }
178
- } else if (cardTypeLower.indexOf('resident') != -1) {
179
- if (cardTypeLower.indexOf('front')) {
180
- titleKey = 'verify.residentCardFrontSide';
181
- } else {
182
- titleKey = 'verify.residentCardBackSide';
183
- }
184
- }
185
- return titleKey;
186
- }
187
- function cardTypeConfirmTitle(cardType) {
188
- if (cardType == null) {
189
- return '';
190
- }
191
- const cardTypeLower = cardType.toLowerCase();
192
- let titleKey = null;
193
- if (cardTypeLower.indexOf('idcard') != -1) {
194
- if (cardTypeLower.indexOf('front')) {
195
- titleKey = 'verify.confirmIdCardFront';
196
- } else {
197
- titleKey = 'verify.confirmIdCardBack';
198
- }
199
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
200
- if (cardTypeLower.indexOf('front')) {
201
- titleKey = 'verify.confirmLicenseFront';
202
- } else {
203
- titleKey = 'verify.confirmLicenseBack';
204
- }
205
- } else if (cardTypeLower.indexOf('resident') != -1) {
206
- if (cardTypeLower.indexOf('front')) {
207
- titleKey = 'verify.confirmResidentCardFrontSide';
208
- } else {
209
- titleKey = 'verify.confirmResidentCardBackSide';
210
- }
211
- }
212
- return titleKey;
213
- }
214
- function mapCardtypeToAuthmeClass(type) {
215
- const known_type = Object.keys(EAuthMeCardClass).filter(key => EAuthMeCardClass[key].toString().toLowerCase() == ('EAuthMeCardClass_' + type).toLowerCase())[0];
216
- if (known_type == null) {
217
- return EAuthMeCardClass.Unknown;
218
- }
219
- return EAuthMeCardClass[known_type];
220
- }
221
140
  function getRecognitionColumnOrder(column) {
222
141
  var _a;
223
142
  return (_a = RECOGNITION_COLUMNS_ORDER[column]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
@@ -235,30 +154,12 @@ const twoWayAuthmeCardClassMap = (() => {
235
154
  };
236
155
  })();
237
156
 
238
- var name = "authme/sdk";
239
- var version$1 = "2.4.8";
240
- var date = "2023-12-20T07:24:47+0000";
241
- var packageInfo = {
242
- name: name,
243
- version: version$1,
244
- date: date
245
- };
246
-
247
- function init(type, country, needConfirm, cardTypes, encrypt = true) {
248
- let useCardTypes = getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c));
249
- if (cardTypes.length) {
250
- useCardTypes = cardTypes;
251
- }
157
+ function init(type, country, needConfirm, encrypt = true) {
252
158
  const body = {
253
159
  scanType: type === IdRecognitionCardType.Passport ? type : `${country}_${type}`,
254
- cardTypes: useCardTypes,
160
+ cardTypes: getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c)),
255
161
  needConfirm,
256
- encrypt,
257
- clientInfo: {
258
- os: 'web',
259
- os_ver: osVersion(),
260
- client_ver: packageInfo.version
261
- }
162
+ encrypt
262
163
  };
263
164
  return sendRequest('/api/identity-verification/id-recognition/v3/init-scan', 'POST', {
264
165
  body: JSON.stringify(body)
@@ -379,10 +280,21 @@ function saveExtraDoc(params) {
379
280
  });
380
281
  }
381
282
 
283
+ var name = "@authme/id-recognition";
284
+ var version$1 = "2.4.10";
285
+ var peerDependencies = {
286
+ "core-js": "^3.6.0"
287
+ };
288
+ var packageInfo = {
289
+ name: name,
290
+ version: version$1,
291
+ peerDependencies: peerDependencies
292
+ };
293
+
382
294
  var _a;
383
295
  var _b, _c;
384
296
  const version = packageInfo.version;
385
297
  (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
386
298
  window[Symbol.for('authme-sdk')][packageInfo.name] = version;
387
299
 
388
- export { CardOCR, CountryCode, IdCardAntiFraudService, IdRecognitionCardType, IdType, IdTypeConfig, MRZService, RecognitionFileType, ResourceImageType, ServerSideEAuthMeCardClass, cardTypeConfirmTitle, cardTypeTitle, confirmScan, finishScanDocument, getCardSubTypes, getRecognitionColumnOrder, init, initScanDocument, mapCardtypeToAuthmeClass, recognition, recognitionEncrypt, saveExtraDoc, saveResourceImage, twoWayAuthmeCardClassMap, uploadFrameBase64, version };
300
+ export { CardOCR, CountryCode, IdCardAntiFraudService, IdRecognitionCardType, IdType, IdTypeConfig, MRZService, RecognitionFileType, ResourceImageType, ServerSideEAuthMeCardClass, confirmScan, finishScanDocument, getCardSubTypes, getRecognitionColumnOrder, init, initScanDocument, recognition, recognitionEncrypt, saveExtraDoc, saveResourceImage, twoWayAuthmeCardClassMap, uploadFrameBase64, version };
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@authme/id-recognition",
3
- "version": "2.4.8",
3
+ "version": "2.4.10",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
- "@authme/core": "2.4.8",
7
- "@authme/util": "2.4.8",
8
- "@authme/engine": "2.4.8"
6
+ "@authme/core": "2.4.10",
7
+ "@authme/engine": "2.4.10"
9
8
  },
10
9
  "module": "./index.js",
11
10
  "main": "./index.cjs",
@@ -1,7 +1,7 @@
1
- import { CountryCode, IdRecognitionCardType, RecognitionFileType, ResourceImageType } from '../enum';
1
+ import { CountryCode, IdRecognitionCardType, RecognitionFileType, ResourceImageType, ServerSideEAuthMeCardClass } from '../enum';
2
2
  import { InitScanResponse } from '../model';
3
- export declare function init(type: IdRecognitionCardType, country: CountryCode, needConfirm: boolean, cardTypes: string[], encrypt?: boolean): Promise<InitScanResponse>;
4
- export declare function initScanDocument(scanId: string, cardType: string): Promise<{
3
+ export declare function init(type: IdRecognitionCardType, country: CountryCode, needConfirm: boolean, encrypt?: boolean): Promise<InitScanResponse>;
4
+ export declare function initScanDocument(scanId: string, cardType: `${ServerSideEAuthMeCardClass}`): Promise<{
5
5
  scanDocumentId: string;
6
6
  }>;
7
7
  export declare function recognition(documentId: string, file: Blob): Promise<{
@@ -6,25 +6,7 @@ export declare enum ResourceImageType {
6
6
  }
7
7
  export declare enum CountryCode {
8
8
  TWN = "TWN",
9
- JPN = "JPN",
10
- ZAF = "ZAF",
11
- USA = "USA",
12
- CHN = "CHN",
13
- PHL = "PHL",
14
- GBR = "GBR",
15
- KOR = "KOR",
16
- HKG = "HKG",
17
- FRA = "FRA",
18
- ESP = "ESP",
19
- MEX = "MEX",
20
- ITA = "ITA",
21
- IND = "IND",
22
- COL = "COL",
23
- RUS = "RUS",
24
- DEU = "DEU",
25
- TUR = "TUR",
26
- CAN = "CAN",
27
- AUS = "AUS"
9
+ JPW = "JP"
28
10
  }
29
11
  export declare enum IdRecognitionCardType {
30
12
  IDCard = "IDCard",
package/src/lib/util.d.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import { CountryCode, EAuthMeCardClass, IdRecognitionCardType, ServerSideEAuthMeCardClass } from './enum';
2
2
  export declare function getCardSubTypes(type: IdRecognitionCardType, country: CountryCode): EAuthMeCardClass[];
3
- export declare function cardTypeTitle(cardType: string): any;
4
- export declare function cardTypeConfirmTitle(cardType: string): any;
5
- export declare function mapCardtypeToAuthmeClass(type: string): any;
6
3
  export declare function getRecognitionColumnOrder(column: string): number;
7
4
  export declare const twoWayAuthmeCardClassMap: {
8
5
  toServer(clientEnum: `${EAuthMeCardClass}`): `${ServerSideEAuthMeCardClass}`;