@authme/id-recognition 2.8.0 → 2.8.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.
- package/index.cjs +94 -2
- package/index.js +93 -3
- package/package.json +4 -4
- package/src/lib/data-access/api.d.ts +3 -0
package/index.cjs
CHANGED
|
@@ -373,9 +373,34 @@ const twoWayAuthmeCardClassMap = (() => {
|
|
|
373
373
|
};
|
|
374
374
|
})();
|
|
375
375
|
|
|
376
|
+
/******************************************************************************
|
|
377
|
+
Copyright (c) Microsoft Corporation.
|
|
378
|
+
|
|
379
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
380
|
+
purpose with or without fee is hereby granted.
|
|
381
|
+
|
|
382
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
383
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
384
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
385
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
386
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
387
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
388
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
389
|
+
***************************************************************************** */
|
|
390
|
+
|
|
391
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
392
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
393
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
394
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
395
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
396
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
397
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
|
|
376
401
|
var name = "authme/sdk";
|
|
377
|
-
var version$1 = "2.8.
|
|
378
|
-
var date = "2025-
|
|
402
|
+
var version$1 = "2.8.2";
|
|
403
|
+
var date = "2025-02-26T06:47:43+0000";
|
|
379
404
|
var packageInfo = {
|
|
380
405
|
name: name,
|
|
381
406
|
version: version$1,
|
|
@@ -394,6 +419,7 @@ function initScan(type, country, needConfirm, cardTypes) {
|
|
|
394
419
|
scanType: type === exports.IdRecognitionCardType.Passport ? `ALL_Passport` : `${country}_${type}`,
|
|
395
420
|
cardTypes: useCardTypes,
|
|
396
421
|
needConfirm,
|
|
422
|
+
encrypt: true,
|
|
397
423
|
clientInfo: {
|
|
398
424
|
os: 'web',
|
|
399
425
|
os_ver: util.osVersion(),
|
|
@@ -585,6 +611,70 @@ function logCollect(message, stackTrace) {
|
|
|
585
611
|
body: JSON.stringify(body)
|
|
586
612
|
});
|
|
587
613
|
}
|
|
614
|
+
function option() {
|
|
615
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
616
|
+
// const url = '/api/identity-verification/v1/option';
|
|
617
|
+
// const accessToken = Storage.getItem('token') as string | null;
|
|
618
|
+
// const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
|
|
619
|
+
// const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
|
|
620
|
+
// try {
|
|
621
|
+
// const response = await fetch(normalizedUrl, {
|
|
622
|
+
// method: 'GET',
|
|
623
|
+
// headers: {
|
|
624
|
+
// 'Content-Type': 'application/json',
|
|
625
|
+
// 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
|
|
626
|
+
// 'sdk-info': [
|
|
627
|
+
// `sdk-version: ${version}`,
|
|
628
|
+
// `platform: ${navigator.platform}`,
|
|
629
|
+
// ].join(';') as string
|
|
630
|
+
// }
|
|
631
|
+
// });
|
|
632
|
+
// if (!response.ok) {
|
|
633
|
+
// // throw new Error(`HTTP error! Status: ${response.status}`);
|
|
634
|
+
// return {};
|
|
635
|
+
// }
|
|
636
|
+
// const data = await response.json();
|
|
637
|
+
// console.log('Response Data:', data);
|
|
638
|
+
// return data; // 可以回傳資料讓其他函式使用
|
|
639
|
+
// } catch (error) {
|
|
640
|
+
// console.error('Fetch Error:', error);
|
|
641
|
+
// return {}; // 或拋出錯誤,視需求而定
|
|
642
|
+
// }
|
|
643
|
+
return core.sendRequest('/api/identity-verification/v1/option', 'GET');
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function themeUI(themeId) {
|
|
647
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
648
|
+
// const url = `/api/identity-verification/v1/ui-themes/${themeId}`;
|
|
649
|
+
// const accessToken = Storage.getItem('token') as string | null;
|
|
650
|
+
// const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
|
|
651
|
+
// const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
|
|
652
|
+
// try {
|
|
653
|
+
// const response = await fetch(normalizedUrl, {
|
|
654
|
+
// method: 'GET',
|
|
655
|
+
// headers: {
|
|
656
|
+
// 'Content-Type': 'application/json',
|
|
657
|
+
// 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
|
|
658
|
+
// 'sdk-info': [
|
|
659
|
+
// `sdk-version: ${version}`,
|
|
660
|
+
// `platform: ${navigator.platform}`,
|
|
661
|
+
// ].join(';') as string
|
|
662
|
+
// }
|
|
663
|
+
// });
|
|
664
|
+
// if (!response.ok) {
|
|
665
|
+
// // throw new Error(`HTTP error! Status: ${response.status}`);
|
|
666
|
+
// return {};
|
|
667
|
+
// }
|
|
668
|
+
// const data = await response.json();
|
|
669
|
+
// console.log('Response Data:', data);
|
|
670
|
+
// return data; // 可以回傳資料讓其他函式使用
|
|
671
|
+
// } catch (error) {
|
|
672
|
+
// console.error('Fetch Error:', error);
|
|
673
|
+
// return {}; // 或拋出錯誤,視需求而定
|
|
674
|
+
// }
|
|
675
|
+
return core.sendRequest(`/api/identity-verification/v1/ui-themes/${themeId}`, 'GET');
|
|
676
|
+
});
|
|
677
|
+
}
|
|
588
678
|
|
|
589
679
|
var _a;
|
|
590
680
|
var _b, _c;
|
|
@@ -637,10 +727,12 @@ exports.initScanDocument = initScanDocument;
|
|
|
637
727
|
exports.initScanDocumentResourceBase64 = initScanDocumentResourceBase64;
|
|
638
728
|
exports.logCollect = logCollect;
|
|
639
729
|
exports.mapCardtypeToAuthmeClass = mapCardtypeToAuthmeClass;
|
|
730
|
+
exports.option = option;
|
|
640
731
|
exports.recognition = recognition;
|
|
641
732
|
exports.recognizeBase64 = recognizeBase64;
|
|
642
733
|
exports.saveExtraDoc = saveExtraDoc;
|
|
643
734
|
exports.saveResourceImage = saveResourceImage;
|
|
735
|
+
exports.themeUI = themeUI;
|
|
644
736
|
exports.thicknessDefaultConfig = thicknessDefaultConfig;
|
|
645
737
|
exports.twoWayAuthmeCardClassMap = twoWayAuthmeCardClassMap;
|
|
646
738
|
exports.uploadFrameBase64 = uploadFrameBase64;
|
package/index.js
CHANGED
|
@@ -370,9 +370,34 @@ const twoWayAuthmeCardClassMap = (() => {
|
|
|
370
370
|
};
|
|
371
371
|
})();
|
|
372
372
|
|
|
373
|
+
/******************************************************************************
|
|
374
|
+
Copyright (c) Microsoft Corporation.
|
|
375
|
+
|
|
376
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
377
|
+
purpose with or without fee is hereby granted.
|
|
378
|
+
|
|
379
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
380
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
381
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
382
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
383
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
384
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
385
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
386
|
+
***************************************************************************** */
|
|
387
|
+
|
|
388
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
389
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
390
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
391
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
392
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
393
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
394
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
373
398
|
var name = "authme/sdk";
|
|
374
|
-
var version$1 = "2.8.
|
|
375
|
-
var date = "2025-
|
|
399
|
+
var version$1 = "2.8.2";
|
|
400
|
+
var date = "2025-02-26T06:47:43+0000";
|
|
376
401
|
var packageInfo = {
|
|
377
402
|
name: name,
|
|
378
403
|
version: version$1,
|
|
@@ -391,6 +416,7 @@ function initScan(type, country, needConfirm, cardTypes) {
|
|
|
391
416
|
scanType: type === IdRecognitionCardType.Passport ? `ALL_Passport` : `${country}_${type}`,
|
|
392
417
|
cardTypes: useCardTypes,
|
|
393
418
|
needConfirm,
|
|
419
|
+
encrypt: true,
|
|
394
420
|
clientInfo: {
|
|
395
421
|
os: 'web',
|
|
396
422
|
os_ver: osVersion(),
|
|
@@ -582,6 +608,70 @@ function logCollect(message, stackTrace) {
|
|
|
582
608
|
body: JSON.stringify(body)
|
|
583
609
|
});
|
|
584
610
|
}
|
|
611
|
+
function option() {
|
|
612
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
613
|
+
// const url = '/api/identity-verification/v1/option';
|
|
614
|
+
// const accessToken = Storage.getItem('token') as string | null;
|
|
615
|
+
// const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
|
|
616
|
+
// const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
|
|
617
|
+
// try {
|
|
618
|
+
// const response = await fetch(normalizedUrl, {
|
|
619
|
+
// method: 'GET',
|
|
620
|
+
// headers: {
|
|
621
|
+
// 'Content-Type': 'application/json',
|
|
622
|
+
// 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
|
|
623
|
+
// 'sdk-info': [
|
|
624
|
+
// `sdk-version: ${version}`,
|
|
625
|
+
// `platform: ${navigator.platform}`,
|
|
626
|
+
// ].join(';') as string
|
|
627
|
+
// }
|
|
628
|
+
// });
|
|
629
|
+
// if (!response.ok) {
|
|
630
|
+
// // throw new Error(`HTTP error! Status: ${response.status}`);
|
|
631
|
+
// return {};
|
|
632
|
+
// }
|
|
633
|
+
// const data = await response.json();
|
|
634
|
+
// console.log('Response Data:', data);
|
|
635
|
+
// return data; // 可以回傳資料讓其他函式使用
|
|
636
|
+
// } catch (error) {
|
|
637
|
+
// console.error('Fetch Error:', error);
|
|
638
|
+
// return {}; // 或拋出錯誤,視需求而定
|
|
639
|
+
// }
|
|
640
|
+
return sendRequest('/api/identity-verification/v1/option', 'GET');
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
function themeUI(themeId) {
|
|
644
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
645
|
+
// const url = `/api/identity-verification/v1/ui-themes/${themeId}`;
|
|
646
|
+
// const accessToken = Storage.getItem('token') as string | null;
|
|
647
|
+
// const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
|
|
648
|
+
// const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
|
|
649
|
+
// try {
|
|
650
|
+
// const response = await fetch(normalizedUrl, {
|
|
651
|
+
// method: 'GET',
|
|
652
|
+
// headers: {
|
|
653
|
+
// 'Content-Type': 'application/json',
|
|
654
|
+
// 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
|
|
655
|
+
// 'sdk-info': [
|
|
656
|
+
// `sdk-version: ${version}`,
|
|
657
|
+
// `platform: ${navigator.platform}`,
|
|
658
|
+
// ].join(';') as string
|
|
659
|
+
// }
|
|
660
|
+
// });
|
|
661
|
+
// if (!response.ok) {
|
|
662
|
+
// // throw new Error(`HTTP error! Status: ${response.status}`);
|
|
663
|
+
// return {};
|
|
664
|
+
// }
|
|
665
|
+
// const data = await response.json();
|
|
666
|
+
// console.log('Response Data:', data);
|
|
667
|
+
// return data; // 可以回傳資料讓其他函式使用
|
|
668
|
+
// } catch (error) {
|
|
669
|
+
// console.error('Fetch Error:', error);
|
|
670
|
+
// return {}; // 或拋出錯誤,視需求而定
|
|
671
|
+
// }
|
|
672
|
+
return sendRequest(`/api/identity-verification/v1/ui-themes/${themeId}`, 'GET');
|
|
673
|
+
});
|
|
674
|
+
}
|
|
585
675
|
|
|
586
676
|
var _a;
|
|
587
677
|
var _b, _c;
|
|
@@ -589,4 +679,4 @@ const version = packageInfo.version;
|
|
|
589
679
|
(_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
|
|
590
680
|
window[Symbol.for('authme-sdk')][packageInfo.name] = version;
|
|
591
681
|
|
|
592
|
-
export { CardOCR, CountryCode, IdCardAntiFraudService, IdRecognitionCardName, IdRecognitionCardType, IdType, IdTypeConfig, MRZService, RecognitionFileType, ResourceImageType, ServerSideEAuthMeCardClass, cardTypeConfirmTitle, cardTypeHeader, cardTypeTitle, confirmScan, finishScanDocument, getCardSubTypes, getCardTypes, getRecognitionColumnOrder, initScan, initScanDocument, initScanDocumentResourceBase64, logCollect, mapCardtypeToAuthmeClass, recognition, recognizeBase64, saveExtraDoc, saveResourceImage, thicknessDefaultConfig, twoWayAuthmeCardClassMap, uploadFrameBase64, version };
|
|
682
|
+
export { CardOCR, CountryCode, IdCardAntiFraudService, IdRecognitionCardName, IdRecognitionCardType, IdType, IdTypeConfig, MRZService, RecognitionFileType, ResourceImageType, ServerSideEAuthMeCardClass, cardTypeConfirmTitle, cardTypeHeader, cardTypeTitle, confirmScan, finishScanDocument, getCardSubTypes, getCardTypes, getRecognitionColumnOrder, initScan, initScanDocument, initScanDocumentResourceBase64, logCollect, mapCardtypeToAuthmeClass, option, recognition, recognizeBase64, saveExtraDoc, saveResourceImage, themeUI, thicknessDefaultConfig, twoWayAuthmeCardClassMap, uploadFrameBase64, version };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/id-recognition",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0",
|
|
6
|
-
"@authme/core": "2.8.
|
|
7
|
-
"@authme/util": "2.8.
|
|
8
|
-
"@authme/engine": "2.8.
|
|
6
|
+
"@authme/core": "2.8.2",
|
|
7
|
+
"@authme/util": "2.8.2",
|
|
8
|
+
"@authme/engine": "2.8.2"
|
|
9
9
|
},
|
|
10
10
|
"module": "./index.js",
|
|
11
11
|
"main": "./index.cjs",
|
|
@@ -44,6 +44,7 @@ export declare function recognizeBase64(body: {
|
|
|
44
44
|
details: {
|
|
45
45
|
[key: string]: string | null;
|
|
46
46
|
};
|
|
47
|
+
detectCardResult: boolean;
|
|
47
48
|
}>;
|
|
48
49
|
export declare function uploadFrameBase64(body: {
|
|
49
50
|
scanDocumentId?: string;
|
|
@@ -86,4 +87,6 @@ export declare function saveExtraDoc(params: {
|
|
|
86
87
|
};
|
|
87
88
|
}): Promise<any>;
|
|
88
89
|
export declare function logCollect(message: string, stackTrace: string): Promise<any>;
|
|
90
|
+
export declare function option(): Promise<any>;
|
|
91
|
+
export declare function themeUI(themeId: string): Promise<any>;
|
|
89
92
|
export {};
|