@authme/id-recognition 2.4.7 → 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,13 +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";
22
+ CountryCode["JPW"] = "JP";
31
23
  })(exports.CountryCode || (exports.CountryCode = {}));
32
24
  exports.IdRecognitionCardType = void 0;
33
25
  (function (IdRecognitionCardType) {
@@ -148,67 +140,6 @@ const RECOGNITION_COLUMNS_ORDER = Object.fromEntries(['surname', 'givenName', 'n
148
140
  function getCardSubTypes(type, country) {
149
141
  return CardTypeMapping[type];
150
142
  }
151
- function cardTypeTitle(cardType) {
152
- if (cardType == null) {
153
- return '';
154
- }
155
- const cardTypeLower = cardType.toLowerCase();
156
- let titleKey = null;
157
- if (cardTypeLower.indexOf('idcard') != -1) {
158
- if (cardTypeLower.indexOf('front')) {
159
- titleKey = 'verify.idCardFrontSide';
160
- } else {
161
- titleKey = 'verify.idCardBackSide';
162
- }
163
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
164
- if (cardTypeLower.indexOf('front')) {
165
- titleKey = 'verify.licenseFrontSide';
166
- } else {
167
- titleKey = 'verify.licenseBackSide';
168
- }
169
- } else if (cardTypeLower.indexOf('resident') != -1) {
170
- if (cardTypeLower.indexOf('front')) {
171
- titleKey = 'verify.residentCardFrontSide';
172
- } else {
173
- titleKey = 'verify.residentCardBackSide';
174
- }
175
- }
176
- return titleKey;
177
- }
178
- function cardTypeConfirmTitle(cardType) {
179
- if (cardType == null) {
180
- return '';
181
- }
182
- const cardTypeLower = cardType.toLowerCase();
183
- let titleKey = null;
184
- if (cardTypeLower.indexOf('idcard') != -1) {
185
- if (cardTypeLower.indexOf('front')) {
186
- titleKey = 'verify.confirmIdCardFront';
187
- } else {
188
- titleKey = 'verify.confirmIdCardBack';
189
- }
190
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
191
- if (cardTypeLower.indexOf('front')) {
192
- titleKey = 'verify.confirmLicenseFront';
193
- } else {
194
- titleKey = 'verify.confirmLicenseBack';
195
- }
196
- } else if (cardTypeLower.indexOf('resident') != -1) {
197
- if (cardTypeLower.indexOf('front')) {
198
- titleKey = 'verify.confirmResidentCardFrontSide';
199
- } else {
200
- titleKey = 'verify.confirmResidentCardBackSide';
201
- }
202
- }
203
- return titleKey;
204
- }
205
- function mapCardtypeToAuthmeClass(type) {
206
- const known_type = Object.keys(engine.EAuthMeCardClass).filter(key => engine.EAuthMeCardClass[key].toString().toLowerCase() == ('EAuthMeCardClass_' + type).toLowerCase())[0];
207
- if (known_type == null) {
208
- return engine.EAuthMeCardClass.Unknown;
209
- }
210
- return engine.EAuthMeCardClass[known_type];
211
- }
212
143
  function getRecognitionColumnOrder(column) {
213
144
  var _a;
214
145
  return (_a = RECOGNITION_COLUMNS_ORDER[column]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
@@ -226,30 +157,12 @@ const twoWayAuthmeCardClassMap = (() => {
226
157
  };
227
158
  })();
228
159
 
229
- var name = "authme/sdk";
230
- var version$1 = "2.4.7";
231
- var date = "2023-12-14T08:29:41+0000";
232
- var packageInfo = {
233
- name: name,
234
- version: version$1,
235
- date: date
236
- };
237
-
238
- function init(type, country, needConfirm, cardTypes, encrypt = true) {
239
- let useCardTypes = getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c));
240
- if (cardTypes.length) {
241
- useCardTypes = cardTypes;
242
- }
160
+ function init(type, country, needConfirm, encrypt = true) {
243
161
  const body = {
244
162
  scanType: type === exports.IdRecognitionCardType.Passport ? type : `${country}_${type}`,
245
- cardTypes: useCardTypes,
163
+ cardTypes: getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c)),
246
164
  needConfirm,
247
- encrypt,
248
- clientInfo: {
249
- os: 'web',
250
- os_ver: util.osVersion(),
251
- client_ver: packageInfo.version
252
- }
165
+ encrypt
253
166
  };
254
167
  return core.sendRequest('/api/identity-verification/id-recognition/v3/init-scan', 'POST', {
255
168
  body: JSON.stringify(body)
@@ -370,6 +283,17 @@ function saveExtraDoc(params) {
370
283
  });
371
284
  }
372
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
+
373
297
  var _a;
374
298
  var _b, _c;
375
299
  const version = packageInfo.version;
@@ -408,15 +332,12 @@ exports.CardOCR = CardOCR;
408
332
  exports.IdCardAntiFraudService = IdCardAntiFraudService;
409
333
  exports.IdTypeConfig = IdTypeConfig;
410
334
  exports.MRZService = MRZService;
411
- exports.cardTypeConfirmTitle = cardTypeConfirmTitle;
412
- exports.cardTypeTitle = cardTypeTitle;
413
335
  exports.confirmScan = confirmScan;
414
336
  exports.finishScanDocument = finishScanDocument;
415
337
  exports.getCardSubTypes = getCardSubTypes;
416
338
  exports.getRecognitionColumnOrder = getRecognitionColumnOrder;
417
339
  exports.init = init;
418
340
  exports.initScanDocument = initScanDocument;
419
- exports.mapCardtypeToAuthmeClass = mapCardtypeToAuthmeClass;
420
341
  exports.recognition = recognition;
421
342
  exports.recognitionEncrypt = recognitionEncrypt;
422
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,13 +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";
19
+ CountryCode["JPW"] = "JP";
28
20
  })(CountryCode || (CountryCode = {}));
29
21
  var IdRecognitionCardType;
30
22
  (function (IdRecognitionCardType) {
@@ -145,67 +137,6 @@ const RECOGNITION_COLUMNS_ORDER = Object.fromEntries(['surname', 'givenName', 'n
145
137
  function getCardSubTypes(type, country) {
146
138
  return CardTypeMapping[type];
147
139
  }
148
- function cardTypeTitle(cardType) {
149
- if (cardType == null) {
150
- return '';
151
- }
152
- const cardTypeLower = cardType.toLowerCase();
153
- let titleKey = null;
154
- if (cardTypeLower.indexOf('idcard') != -1) {
155
- if (cardTypeLower.indexOf('front')) {
156
- titleKey = 'verify.idCardFrontSide';
157
- } else {
158
- titleKey = 'verify.idCardBackSide';
159
- }
160
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
161
- if (cardTypeLower.indexOf('front')) {
162
- titleKey = 'verify.licenseFrontSide';
163
- } else {
164
- titleKey = 'verify.licenseBackSide';
165
- }
166
- } else if (cardTypeLower.indexOf('resident') != -1) {
167
- if (cardTypeLower.indexOf('front')) {
168
- titleKey = 'verify.residentCardFrontSide';
169
- } else {
170
- titleKey = 'verify.residentCardBackSide';
171
- }
172
- }
173
- return titleKey;
174
- }
175
- function cardTypeConfirmTitle(cardType) {
176
- if (cardType == null) {
177
- return '';
178
- }
179
- const cardTypeLower = cardType.toLowerCase();
180
- let titleKey = null;
181
- if (cardTypeLower.indexOf('idcard') != -1) {
182
- if (cardTypeLower.indexOf('front')) {
183
- titleKey = 'verify.confirmIdCardFront';
184
- } else {
185
- titleKey = 'verify.confirmIdCardBack';
186
- }
187
- } else if (cardTypeLower.indexOf('driverlicense') != -1) {
188
- if (cardTypeLower.indexOf('front')) {
189
- titleKey = 'verify.confirmLicenseFront';
190
- } else {
191
- titleKey = 'verify.confirmLicenseBack';
192
- }
193
- } else if (cardTypeLower.indexOf('resident') != -1) {
194
- if (cardTypeLower.indexOf('front')) {
195
- titleKey = 'verify.confirmResidentCardFrontSide';
196
- } else {
197
- titleKey = 'verify.confirmResidentCardBackSide';
198
- }
199
- }
200
- return titleKey;
201
- }
202
- function mapCardtypeToAuthmeClass(type) {
203
- const known_type = Object.keys(EAuthMeCardClass).filter(key => EAuthMeCardClass[key].toString().toLowerCase() == ('EAuthMeCardClass_' + type).toLowerCase())[0];
204
- if (known_type == null) {
205
- return EAuthMeCardClass.Unknown;
206
- }
207
- return EAuthMeCardClass[known_type];
208
- }
209
140
  function getRecognitionColumnOrder(column) {
210
141
  var _a;
211
142
  return (_a = RECOGNITION_COLUMNS_ORDER[column]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
@@ -223,30 +154,12 @@ const twoWayAuthmeCardClassMap = (() => {
223
154
  };
224
155
  })();
225
156
 
226
- var name = "authme/sdk";
227
- var version$1 = "2.4.7";
228
- var date = "2023-12-14T08:29:41+0000";
229
- var packageInfo = {
230
- name: name,
231
- version: version$1,
232
- date: date
233
- };
234
-
235
- function init(type, country, needConfirm, cardTypes, encrypt = true) {
236
- let useCardTypes = getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c));
237
- if (cardTypes.length) {
238
- useCardTypes = cardTypes;
239
- }
157
+ function init(type, country, needConfirm, encrypt = true) {
240
158
  const body = {
241
159
  scanType: type === IdRecognitionCardType.Passport ? type : `${country}_${type}`,
242
- cardTypes: useCardTypes,
160
+ cardTypes: getCardSubTypes(type).map(c => twoWayAuthmeCardClassMap.toServer(c)),
243
161
  needConfirm,
244
- encrypt,
245
- clientInfo: {
246
- os: 'web',
247
- os_ver: osVersion(),
248
- client_ver: packageInfo.version
249
- }
162
+ encrypt
250
163
  };
251
164
  return sendRequest('/api/identity-verification/id-recognition/v3/init-scan', 'POST', {
252
165
  body: JSON.stringify(body)
@@ -367,10 +280,21 @@ function saveExtraDoc(params) {
367
280
  });
368
281
  }
369
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
+
370
294
  var _a;
371
295
  var _b, _c;
372
296
  const version = packageInfo.version;
373
297
  (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
374
298
  window[Symbol.for('authme-sdk')][packageInfo.name] = version;
375
299
 
376
- 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.7",
3
+ "version": "2.4.10",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
- "@authme/core": "2.4.7",
7
- "@authme/util": "2.4.7",
8
- "@authme/engine": "2.4.7"
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,13 +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"
9
+ JPW = "JP"
16
10
  }
17
11
  export declare enum IdRecognitionCardType {
18
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}`;