@authme/identity-verification 2.8.55 → 2.8.59
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/README.md +34 -0
- package/assets/locale/zh_Hant_TW.json +1 -1
- package/assets/styles/_base.scss +759 -0
- package/assets/styles/_liveness.scss +324 -0
- package/assets/styles/_ocr.scss +2422 -0
- package/assets/styles/_theme.scss +144 -0
- package/assets/styles/style.css +20 -1
- package/assets/styles/style.scss +11 -0
- package/index.cjs.js +192 -20
- package/index.esm.js +193 -22
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/support.d.ts +27 -0
- package/src/lib/v2/ui/modal.d.ts +1 -1
- package/src/lib/validate-config.d.ts +11 -0
package/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import 'core-js/modules/web.dom-collections.iterator.js';
|
|
|
9
9
|
import { getTranslateInstance, TrackingEvent, generateStatus, EventListenerService, StatusDescription, AuthmeError, ErrorCode, Feature, StatusEvent, StatusView, StatusAction, setRequestLoggingFunc, setAccessToken, getCustomerState } from '@authme/core';
|
|
10
10
|
import { EAuthMeFASServiceStatus, EAuthMeIDCardAntiFraudStage as EAuthMeIDCardAntiFraudStage$1, EAuthMeCardClass as EAuthMeCardClass$1, AuthmeFunctionModule, MlEngine, EngineModule, EAuthMeEngineReturnCode, AuthmeEngineModuleBase } from '@authme/engine';
|
|
11
11
|
import { CountryCode, IdRecognitionCardType, EAuthMeCardClass, EAuthMeIDCardAntiFraudStatus, thicknessDefaultConfig, EAuthMeIDCardAntiFraudStage, mapCardtypeToAuthmeClass, getRecognitionColumnOrder, cardTypeTitle, cardTypeConfirmTitle, cardTypeHeader, EAuthMeCardOCRStatus, EAuthMeMRZServiceStatus, saveExtraDoc, initScanDocumentResourceBase64, MRZService, ResourceImageType, uploadFrameBase64, finishScanDocument, initScanDocument, initScan, option, themeUI, CardOCR, IdCardAntiFraudService, twoWayAuthmeCardClassMap, RecognitionFileType, recognizeBase64, getCardSubTypes, getCardTypes, confirmScan } from '@authme/id-recognition';
|
|
12
|
-
import { getCssVariable, RGBToLottieColor, colorToRGB, Storage, useState, uiThemeText, uiThemeHint, clearCanvas, getImageData, hidePopup, showPopup, waitTime, TIME_UNIT, AuthmeError as AuthmeError$1, ErrorCode as ErrorCode$1, isMobile, uiThemeButton, requestCamera, showElement, asyncOnLineShowErrorMessage, getCanvasSize, startSpinner, stopSpinner, themeConfigDefault, mergeThemeConfig, uiThemeDirection, fontWeight, hideElement, checkOnlineStatus, showErrorMessage, dataURItoBlob, uiThemeSmallButton, dropMenu, hideErrorMessage, UintArrayToBlob, isIphone14proOrProMax, cropByRatio, switchCamera, asyncShowPopup, retryPromiseWithCondition, asyncShowErrorMessage, uploadModal, backgroundRequest, debugTools, STORAGE_KEY, splitResult, RUN_FUNCTION_NAME, DEVICE_TYPE, combineResult, startLoadingSDK, stopLoadingSDK } from '@authme/util';
|
|
12
|
+
import { getCssVariable, RGBToLottieColor, colorToRGB, Storage, useState, uiThemeText, uiThemeHint, clearCanvas, getImageData, hidePopup, showPopup, waitTime, TIME_UNIT, AuthmeError as AuthmeError$1, ErrorCode as ErrorCode$1, isMobile, uiThemeButton, requestCamera, showElement, asyncOnLineShowErrorMessage, getCanvasSize, startSpinner, stopSpinner, themeConfigDefault, mergeThemeConfig, uiThemeDirection, fontWeight, hideElement, checkOnlineStatus, showErrorMessage, dataURItoBlob, uiThemeSmallButton, safeColor, safeFontSize, safeFontWeight, safeOpacity, dropMenu, hideErrorMessage, UintArrayToBlob, isIphone14proOrProMax, cropByRatio, switchCamera, asyncShowPopup, retryPromiseWithCondition, asyncShowErrorMessage, uploadModal, backgroundRequest, debugTools, STORAGE_KEY, splitResult, RUN_FUNCTION_NAME, DEVICE_TYPE, combineResult, startLoadingSDK, stopLoadingSDK, getSystemInfo, getDeviceInfo, isMobileOrTablet } from '@authme/util';
|
|
13
13
|
import 'core-js/modules/es.array.push.js';
|
|
14
14
|
import { mergeMap, animationFrames, filter, tap, map, from, catchError, EMPTY, concatAll, takeUntil, of, merge, fromEvent, Subject, defer, throttleTime, switchMap, take, concatMap, throwError, finalize, Observable, interval, mapTo, firstValueFrom, shareReplay, switchMapTo, takeWhile as takeWhile$1, timer, race } from 'rxjs';
|
|
15
15
|
import 'core-js/modules/es.iterator.for-each.js';
|
|
@@ -68,6 +68,13 @@ import 'core-js/modules/es.uint8-array.set-from-hex.js';
|
|
|
68
68
|
import 'core-js/modules/es.uint8-array.to-base64.js';
|
|
69
69
|
import 'core-js/modules/es.uint8-array.to-hex.js';
|
|
70
70
|
import 'core-js/modules/es.iterator.some.js';
|
|
71
|
+
import 'core-js/modules/es.set.difference.v2.js';
|
|
72
|
+
import 'core-js/modules/es.set.intersection.v2.js';
|
|
73
|
+
import 'core-js/modules/es.set.is-disjoint-from.v2.js';
|
|
74
|
+
import 'core-js/modules/es.set.is-subset-of.v2.js';
|
|
75
|
+
import 'core-js/modules/es.set.is-superset-of.v2.js';
|
|
76
|
+
import 'core-js/modules/es.set.symmetric-difference.v2.js';
|
|
77
|
+
import 'core-js/modules/es.set.union.v2.js';
|
|
71
78
|
|
|
72
79
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
73
80
|
if (null == r) return {};
|
|
@@ -28849,7 +28856,8 @@ const renderBasicUI = userConfig => {
|
|
|
28849
28856
|
const closeIcon = document.createElement('div');
|
|
28850
28857
|
closeIcon.classList.add('video-container__close');
|
|
28851
28858
|
// closeIcon.src = Icon.CloseIcon;
|
|
28852
|
-
closeIcon.
|
|
28859
|
+
closeIcon.textContent = '';
|
|
28860
|
+
closeIcon.insertAdjacentHTML('beforeend', `<svg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><circle cx="32" cy="32" r="32" fill="#808080" fill-opacity="${uiThemeConfig.ekycCloseButton.backgroundOpacity}"/><path d="M24 24L40 40M40 24L24 40" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-opacity="${uiThemeConfig.ekycCloseButton.contentOpacity}"/></svg>`);
|
|
28853
28861
|
if (!userConfig.showCloseButton) {
|
|
28854
28862
|
closeIcon.classList.add('authme-hide');
|
|
28855
28863
|
}
|
|
@@ -29330,8 +29338,13 @@ const modal = arg => {
|
|
|
29330
29338
|
domTitle.innerText = arg.title;
|
|
29331
29339
|
domSubtitle.innerText = arg.subtitle;
|
|
29332
29340
|
domImage.src = arg.image;
|
|
29333
|
-
|
|
29334
|
-
|
|
29341
|
+
if (arg.content instanceof HTMLElement) {
|
|
29342
|
+
domContent.appendChild(arg.content);
|
|
29343
|
+
} else {
|
|
29344
|
+
domContent.innerHTML = arg.content;
|
|
29345
|
+
}
|
|
29346
|
+
domClose.textContent = '';
|
|
29347
|
+
domClose.insertAdjacentHTML('beforeend', `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.1943 6.41714C19.6393 5.97216 19.6393 5.2507 19.1943 4.80571C18.7493 4.36073 18.0278 4.36073 17.5829 4.80571L12 10.3886L6.41714 4.80572C5.97216 4.36073 5.2507 4.36073 4.80571 4.80571C4.36073 5.2507 4.36073 5.97216 4.80571 6.41714L10.3886 12L4.80571 17.5829C4.36073 18.0278 4.36073 18.7493 4.80571 19.1943C5.2507 19.6393 5.97216 19.6393 6.41714 19.1943L12 13.6114L17.5829 19.1943C18.0278 19.6393 18.7493 19.6393 19.1943 19.1943C19.6393 18.7493 19.6393 18.0278 19.1943 17.5829L13.6114 12L19.1943 6.41714Z" fill="${uiThemeConfig.nonEkycCloseButton.contentColor}" fill-opacity="${uiThemeConfig.nonEkycCloseButton.contentOpacity}" /></svg>`);
|
|
29335
29348
|
domConfirm.innerText = arg.confirm;
|
|
29336
29349
|
domClose.addEventListener('click', async () => {
|
|
29337
29350
|
if (arg.onClose) {
|
|
@@ -29619,15 +29632,18 @@ async function startLiveness(config) {
|
|
|
29619
29632
|
// Start
|
|
29620
29633
|
const step1 = defer(() => {
|
|
29621
29634
|
return new Promise((resolve, reject) => {
|
|
29635
|
+
const hintList = document.createElement('ul');
|
|
29636
|
+
['sdk.liveness.detection.infopageHint.face', 'sdk.liveness.detection.infopageHint.environment'].forEach(key => {
|
|
29637
|
+
const li = document.createElement('li');
|
|
29638
|
+
li.textContent = translateService.translate(key);
|
|
29639
|
+
hintList.appendChild(li);
|
|
29640
|
+
});
|
|
29622
29641
|
modal({
|
|
29623
29642
|
header: translateService.translate('sdk.liveness.detection.header'),
|
|
29624
29643
|
title: translateService.translate('sdk.liveness.detection.subtitle'),
|
|
29625
29644
|
subtitle: translateService.translate('sdk.liveness.detection.content'),
|
|
29626
29645
|
image: LIVENESS_GUIDE_IMG,
|
|
29627
|
-
content:
|
|
29628
|
-
<li>${translateService.translate('sdk.liveness.detection.infopageHint.face')}</li>
|
|
29629
|
-
<li>${translateService.translate('sdk.liveness.detection.infopageHint.environment')}</li>
|
|
29630
|
-
</ul>`,
|
|
29646
|
+
content: hintList,
|
|
29631
29647
|
confirm: translateService.translate('sdk.general.start'),
|
|
29632
29648
|
onClose: () => {
|
|
29633
29649
|
sendStatusAction$2(StatusAction.BtnClose);
|
|
@@ -30001,10 +30017,11 @@ const renderOCRUI = config => {
|
|
|
30001
30017
|
successBlockDom.classList.add('block');
|
|
30002
30018
|
const successDom = document.createElement('div');
|
|
30003
30019
|
// successDom.classList.add('img');
|
|
30004
|
-
successDom.
|
|
30020
|
+
successDom.textContent = '';
|
|
30021
|
+
successDom.insertAdjacentHTML('beforeend', `<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30005
30022
|
<path d="M48 24C48 37.2548 37.2548 48 24 48C10.7452 48 0 37.2548 0 24C0 10.7452 10.7452 0 24 0C37.2548 0 48 10.7452 48 24Z" fill="${uiThemeConfig.uploadCompleteView.backgroundColor}" fill-opacity="${uiThemeConfig.fraudIntroStepTitle.backgroundOpacity}"/>
|
|
30006
30023
|
<path d="M19.9938 28.8441L14.7813 23.6316L13.0063 25.3941L19.9938 32.3816L34.9938 17.3816L33.2313 15.6191L19.9938 28.8441Z" fill="white"/>
|
|
30007
|
-
</svg
|
|
30024
|
+
</svg>`);
|
|
30008
30025
|
const successText = document.createElement('div');
|
|
30009
30026
|
uiThemeText(successText, uiThemeConfig.bodyOne);
|
|
30010
30027
|
successText.textContent = translateService.translate('sdk.general.done');
|
|
@@ -31725,7 +31742,8 @@ const fraudScanIntroPage = arg => {
|
|
|
31725
31742
|
domImage2.src = arg.image2 || fraudScanIntroPageStep2;
|
|
31726
31743
|
domBody2.innerText = arg.body2;
|
|
31727
31744
|
domBody3.innerText = arg.body3;
|
|
31728
|
-
domClose.
|
|
31745
|
+
domClose.textContent = '';
|
|
31746
|
+
domClose.insertAdjacentHTML('beforeend', `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.1943 6.41714C19.6393 5.97216 19.6393 5.2507 19.1943 4.80571C18.7493 4.36073 18.0278 4.36073 17.5829 4.80571L12 10.3886L6.41714 4.80572C5.97216 4.36073 5.2507 4.36073 4.80571 4.80571C4.36073 5.2507 4.36073 5.97216 4.80571 6.41714L10.3886 12L4.80571 17.5829C4.36073 18.0278 4.36073 18.7493 4.80571 19.1943C5.2507 19.6393 5.97216 19.6393 6.41714 19.1943L12 13.6114L17.5829 19.1943C18.0278 19.6393 18.7493 19.6393 19.1943 19.1943C19.6393 18.7493 19.6393 18.0278 19.1943 17.5829L13.6114 12L19.1943 6.41714Z" fill="${uiThemeConfig.nonEkycCloseButton.contentColor}" fill-opacity="${uiThemeConfig.nonEkycCloseButton.contentOpacity}" /></svg>`);
|
|
31729
31747
|
domConfirm.innerText = arg.confirm;
|
|
31730
31748
|
uiThemeButton(domConfirm, uiThemeConfig.majorButton);
|
|
31731
31749
|
// domBack.addEventListener('click', async () => {
|
|
@@ -31939,7 +31957,7 @@ const ocrResultModal = arg => {
|
|
|
31939
31957
|
domDropMenuLi.classList.add('active');
|
|
31940
31958
|
}
|
|
31941
31959
|
domDropMenuLi.setAttribute('data-value', selection.value);
|
|
31942
|
-
domDropMenuLi.
|
|
31960
|
+
domDropMenuLi.textContent = selection.name;
|
|
31943
31961
|
domDropMenuUl.appendChild(domDropMenuLi);
|
|
31944
31962
|
});
|
|
31945
31963
|
domDropMenu.appendChild(domDropMenuTitle);
|
|
@@ -32201,18 +32219,19 @@ const ocrResultModal = arg => {
|
|
|
32201
32219
|
uiThemeText(domSubtitle, uiThemeConfig.resultBody);
|
|
32202
32220
|
domTitle.innerText = arg.title;
|
|
32203
32221
|
domSubtitle.innerText = arg.subtitle;
|
|
32204
|
-
domHint.
|
|
32222
|
+
domHint.textContent = arg.hintText;
|
|
32205
32223
|
domCountDownContainer.style.color = uiThemeConfig.resultPageCountdown.textColor;
|
|
32206
32224
|
domCountDownContainer.style.fontSize = `${uiThemeConfig.resultPageCountdown.fontSize}px`;
|
|
32207
32225
|
domCountDownContainer.style.fontWeight = fontWeight[uiThemeConfig.resultPageCountdown.textWeight];
|
|
32208
|
-
domCountDownContainer.innerHTML = `${arg.countDown1Text} <span class="video-container__ocrResultModal-countdown" style="color: ${uiThemeConfig.resultPageCountdown.timeTextColor};font-size:${uiThemeConfig.resultPageCountdown.timeFontSize}px;font-weight:${fontWeight[uiThemeConfig.resultPageCountdown.timeTextWeight]}"> ${formatTime(timer)} </span> ${arg.countDown2Text}`;
|
|
32226
|
+
domCountDownContainer.innerHTML = `${arg.countDown1Text} <span class="video-container__ocrResultModal-countdown" style="color: ${safeColor(uiThemeConfig.resultPageCountdown.timeTextColor)};font-size:${safeFontSize(uiThemeConfig.resultPageCountdown.timeFontSize)}px;font-weight:${safeFontWeight(fontWeight[uiThemeConfig.resultPageCountdown.timeTextWeight])}"> ${formatTime(timer)} </span> ${arg.countDown2Text}`;
|
|
32209
32227
|
domConfirm.innerText = arg.confirmText;
|
|
32210
|
-
domClose.
|
|
32228
|
+
domClose.textContent = '';
|
|
32229
|
+
domClose.insertAdjacentHTML('beforeend', `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.1943 6.41714C19.6393 5.97216 19.6393 5.2507 19.1943 4.80571C18.7493 4.36073 18.0278 4.36073 17.5829 4.80571L12 10.3886L6.41714 4.80572C5.97216 4.36073 5.2507 4.36073 4.80571 4.80571C4.36073 5.2507 4.36073 5.97216 4.80571 6.41714L10.3886 12L4.80571 17.5829C4.36073 18.0278 4.36073 18.7493 4.80571 19.1943C5.2507 19.6393 5.97216 19.6393 6.41714 19.1943L12 13.6114L17.5829 19.1943C18.0278 19.6393 18.7493 19.6393 19.1943 19.1943C19.6393 18.7493 19.6393 18.0278 19.1943 17.5829L13.6114 12L19.1943 6.41714Z" fill="${safeColor(uiThemeConfig.nonEkycCloseButton.contentColor)}" fill-opacity="${safeOpacity(uiThemeConfig.nonEkycCloseButton.contentOpacity)}" /></svg>`);
|
|
32211
32230
|
const countdownInterval = setInterval(() => {
|
|
32212
32231
|
timer -= 1;
|
|
32213
32232
|
const countdownEl = domModal.querySelector('.video-container__ocrResultModal-countdown');
|
|
32214
32233
|
if (countdownEl) {
|
|
32215
|
-
countdownEl.
|
|
32234
|
+
countdownEl.textContent = formatTime(timer);
|
|
32216
32235
|
}
|
|
32217
32236
|
if (timer <= 0) {
|
|
32218
32237
|
clearInterval(countdownInterval);
|
|
@@ -33695,7 +33714,7 @@ async function startOCR(config) {
|
|
|
33695
33714
|
container: uiComponentBasic.videoContainer
|
|
33696
33715
|
});
|
|
33697
33716
|
let hint = true;
|
|
33698
|
-
cameraHint.
|
|
33717
|
+
cameraHint.textContent = translateService.translate('sdk.general.verify.error.switchCamera');
|
|
33699
33718
|
cameraSwitchContainer.addEventListener('click', async () => {
|
|
33700
33719
|
if (hint) {
|
|
33701
33720
|
setTimeout(() => {
|
|
@@ -33771,7 +33790,8 @@ async function startOCR(config) {
|
|
|
33771
33790
|
<path d="M15.0559 0.844991C14.0954 0.299519 12.8746 0.635956 12.3291 1.59644C11.7837 2.55693 12.1201 3.77775 13.0806 4.32322L14.0683 2.58411L15.0559 0.844991ZM24.3237 38.8301C25.1047 39.6112 26.371 39.6112 27.1521 38.8301L39.88 26.1022C40.6611 25.3212 40.6611 24.0548 39.88 23.2738C39.099 22.4927 37.8326 22.4927 37.0516 23.2738L25.7379 34.5875L14.4242 23.2738C13.6431 22.4927 12.3768 22.4927 11.5957 23.2738C10.8147 24.0548 10.8147 25.3212 11.5957 26.1022L24.3237 38.8301ZM14.0683 2.58411L13.0806 4.32322C19.6901 8.07682 22.2819 12.7684 23.3088 18.1847C23.836 20.9652 23.9531 23.9667 23.9286 27.2094C23.9163 28.8287 23.8693 30.4812 23.8246 32.1902C23.78 33.8911 23.7379 35.6411 23.7379 37.4159L25.7379 37.4159L27.7379 37.4159C27.7379 35.6988 27.7786 33.9955 27.8232 32.2949C27.8675 30.6023 27.9159 28.9052 27.9285 27.2397C27.9537 23.9128 27.8388 20.6044 27.2388 17.4396C26.0113 10.9653 22.7684 5.225 15.0559 0.844991L14.0683 2.58411Z" fill="#4AD396"/>
|
|
33772
33791
|
</svg>`
|
|
33773
33792
|
};
|
|
33774
|
-
container.
|
|
33793
|
+
container.textContent = '';
|
|
33794
|
+
container.insertAdjacentHTML('beforeend', svgContent[direction]);
|
|
33775
33795
|
return container;
|
|
33776
33796
|
};
|
|
33777
33797
|
switch (stage) {
|
|
@@ -33885,7 +33905,7 @@ const renderExtraUI = config => {
|
|
|
33885
33905
|
config.videoContainer.appendChild(titleTextPanel);
|
|
33886
33906
|
config.videoContainer.appendChild(cardborderContainer);
|
|
33887
33907
|
// Set init text
|
|
33888
|
-
titleText.
|
|
33908
|
+
titleText.textContent = translateService.translate('extra.title');
|
|
33889
33909
|
// Picture
|
|
33890
33910
|
const confirmContainer = document.createElement('div');
|
|
33891
33911
|
confirmContainer.classList.add('confirm_container');
|
|
@@ -36905,6 +36925,11 @@ const [, setFeature] = featureUseState;
|
|
|
36905
36925
|
const [, setStatusEvent] = eventUseState;
|
|
36906
36926
|
const [, setStatusView] = viewUseState;
|
|
36907
36927
|
|
|
36928
|
+
function escapeHtml(str) {
|
|
36929
|
+
const div = document.createElement('div');
|
|
36930
|
+
div.textContent = str;
|
|
36931
|
+
return div.innerHTML;
|
|
36932
|
+
}
|
|
36908
36933
|
function renderCardTypeAndCountryConfig(config) {
|
|
36909
36934
|
eventListenerService.start();
|
|
36910
36935
|
setFeature(Feature.SelectCardTypeAndCountry);
|
|
@@ -37056,7 +37081,7 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
37056
37081
|
dom.addEventListener('click', handleCardTypeClick);
|
|
37057
37082
|
dom.innerHTML = `
|
|
37058
37083
|
<div class="card-in-frame">
|
|
37059
|
-
<label class="card-label ${item.cardType.toLowerCase()}">${item.display}</label>
|
|
37084
|
+
<label class="card-label ${item.cardType.toLowerCase()}">${escapeHtml(item.display)}</label>
|
|
37060
37085
|
<i class="card-icon"></i>
|
|
37061
37086
|
</div>
|
|
37062
37087
|
`;
|
|
@@ -37089,6 +37114,23 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
37089
37114
|
});
|
|
37090
37115
|
}
|
|
37091
37116
|
|
|
37117
|
+
const VALID_COUNTRY_CODES = new Set(Object.values(CountryCode));
|
|
37118
|
+
/**
|
|
37119
|
+
* Defense-in-depth check for the public `getCardTypeAndCountry` API.
|
|
37120
|
+
*
|
|
37121
|
+
* The `supportCountries` value is interpolated into translation keys like
|
|
37122
|
+
* `sdk.general.country.${country}`. TypeScript's `CountryCode` enum does not
|
|
37123
|
+
* enforce values at runtime, so a misconfigured integrator could pass an
|
|
37124
|
+
* arbitrary string. Reject anything outside the SDK's known country list at
|
|
37125
|
+
* the entry point.
|
|
37126
|
+
*/
|
|
37127
|
+
function validateSupportCountries(countries) {
|
|
37128
|
+
const invalid = countries.filter(c => !VALID_COUNTRY_CODES.has(c));
|
|
37129
|
+
if (invalid.length > 0) {
|
|
37130
|
+
throw new Error(`Invalid country code in supportCountries: ${invalid.join(', ')}`);
|
|
37131
|
+
}
|
|
37132
|
+
}
|
|
37133
|
+
|
|
37092
37134
|
const _excluded = ["canvas", "loadingLottie"];
|
|
37093
37135
|
function identityVerificationFeatureIdentityVerification() {
|
|
37094
37136
|
return 'identity-verification-feature-identity-verification';
|
|
@@ -37188,6 +37230,9 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
|
|
|
37188
37230
|
}
|
|
37189
37231
|
async getCardTypeAndCountry(userConfig) {
|
|
37190
37232
|
var _userConfig$supportCo, _userConfig$supportCa;
|
|
37233
|
+
if (userConfig.supportCountries) {
|
|
37234
|
+
validateSupportCountries(userConfig.supportCountries);
|
|
37235
|
+
}
|
|
37191
37236
|
const defaultCountries = [CountryCode.TWN, CountryCode.JPN, CountryCode.ZAF, CountryCode.USA, CountryCode.CHN, CountryCode.PHL, CountryCode.GBR, CountryCode.KOR, CountryCode.HKG, CountryCode.FRA, CountryCode.ESP, CountryCode.MEX, CountryCode.ITA, CountryCode.IND, CountryCode.COL, CountryCode.RUS, CountryCode.DEU, CountryCode.TUR, CountryCode.CAN, CountryCode.AUS, CountryCode.IDN, CountryCode.MYS, CountryCode.EGY, CountryCode.SAU, CountryCode.NLD, CountryCode.SGP];
|
|
37192
37237
|
const defaultCountry = userConfig.defaultCountry !== undefined && defaultCountries.includes(userConfig.defaultCountry) ? userConfig.defaultCountry : defaultCountries[0];
|
|
37193
37238
|
const supportCountries = (_userConfig$supportCo = userConfig.supportCountries) != null ? _userConfig$supportCo : defaultCountries;
|
|
@@ -37358,8 +37403,134 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
|
|
|
37358
37403
|
}
|
|
37359
37404
|
}
|
|
37360
37405
|
|
|
37406
|
+
const MIN_IOS_MAJOR = 16;
|
|
37407
|
+
const MIN_IOS_MINOR_FOR_16 = 4;
|
|
37408
|
+
const MIN_ANDROID_MAJOR = 9;
|
|
37409
|
+
const IN_APP_WEBVIEW_PATTERNS = [{
|
|
37410
|
+
key: 'line',
|
|
37411
|
+
pattern: /\bLine\//i
|
|
37412
|
+
}, {
|
|
37413
|
+
key: 'messenger',
|
|
37414
|
+
pattern: /\bMessenger\b/i
|
|
37415
|
+
}, {
|
|
37416
|
+
key: 'fb',
|
|
37417
|
+
pattern: /\bFBAN|FBAV|FB_IAB\b/i
|
|
37418
|
+
}, {
|
|
37419
|
+
key: 'instagram',
|
|
37420
|
+
pattern: /\bInstagram\b/i
|
|
37421
|
+
}, {
|
|
37422
|
+
key: 'wechat',
|
|
37423
|
+
pattern: /MicroMessenger|WeChat/i
|
|
37424
|
+
}];
|
|
37425
|
+
function detectWebAssembly() {
|
|
37426
|
+
return typeof WebAssembly !== 'undefined';
|
|
37427
|
+
}
|
|
37428
|
+
function detectWebAssemblySimd() {
|
|
37429
|
+
if (!detectWebAssembly()) return false;
|
|
37430
|
+
// Mirrors libs/engine/src/lib/engine.ts isSimdSupported(); kept independent
|
|
37431
|
+
// so callers don't have to load the engine bundle just to introspect.
|
|
37432
|
+
try {
|
|
37433
|
+
if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
|
|
37434
|
+
return false;
|
|
37435
|
+
}
|
|
37436
|
+
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]));
|
|
37437
|
+
} catch (_unused) {
|
|
37438
|
+
return false;
|
|
37439
|
+
}
|
|
37440
|
+
}
|
|
37441
|
+
function detectMediaDevices() {
|
|
37442
|
+
var _navigator$mediaDevic;
|
|
37443
|
+
return typeof navigator !== 'undefined' && 'mediaDevices' in navigator && typeof ((_navigator$mediaDevic = navigator.mediaDevices) == null ? void 0 : _navigator$mediaDevic.getUserMedia) === 'function';
|
|
37444
|
+
}
|
|
37445
|
+
function detectSecureContext() {
|
|
37446
|
+
var _window$location;
|
|
37447
|
+
if (typeof window === 'undefined') return false;
|
|
37448
|
+
if (typeof window.isSecureContext === 'boolean') {
|
|
37449
|
+
return window.isSecureContext;
|
|
37450
|
+
}
|
|
37451
|
+
return ((_window$location = window.location) == null ? void 0 : _window$location.protocol) === 'https:';
|
|
37452
|
+
}
|
|
37453
|
+
function detectInAppWebView() {
|
|
37454
|
+
var _navigator$userAgent;
|
|
37455
|
+
const ua = (_navigator$userAgent = navigator.userAgent) != null ? _navigator$userAgent : '';
|
|
37456
|
+
for (const {
|
|
37457
|
+
key,
|
|
37458
|
+
pattern
|
|
37459
|
+
} of IN_APP_WEBVIEW_PATTERNS) {
|
|
37460
|
+
if (pattern.test(ua)) return key;
|
|
37461
|
+
}
|
|
37462
|
+
return 'none';
|
|
37463
|
+
}
|
|
37464
|
+
function parseIosVersion() {
|
|
37465
|
+
const m = navigator.userAgent.match(/OS (\d+)[._](\d+)(?:[._](\d+))?/);
|
|
37466
|
+
if (!m) return null;
|
|
37467
|
+
return {
|
|
37468
|
+
major: Number(m[1]),
|
|
37469
|
+
minor: Number(m[2])
|
|
37470
|
+
};
|
|
37471
|
+
}
|
|
37472
|
+
function parseAndroidMajor() {
|
|
37473
|
+
const m = navigator.userAgent.match(/Android\s+(\d+)/i);
|
|
37474
|
+
if (!m) return null;
|
|
37475
|
+
return Number(m[1]);
|
|
37476
|
+
}
|
|
37477
|
+
function detectHardwareConcurrency() {
|
|
37478
|
+
if (typeof navigator === 'undefined') return null;
|
|
37479
|
+
const v = navigator.hardwareConcurrency;
|
|
37480
|
+
return typeof v === 'number' && v > 0 ? v : null;
|
|
37481
|
+
}
|
|
37482
|
+
function detectDeviceMemory() {
|
|
37483
|
+
if (typeof navigator === 'undefined') return null;
|
|
37484
|
+
const v = navigator.deviceMemory;
|
|
37485
|
+
return typeof v === 'number' && v > 0 ? v : null;
|
|
37486
|
+
}
|
|
37487
|
+
/**
|
|
37488
|
+
* Synchronous pre-flight check that the current browser/device can run the
|
|
37489
|
+
* eKYC SDK. Returns a binary `supported` flag plus the reasons it failed
|
|
37490
|
+
* (when applicable) and a snapshot of the detected environment.
|
|
37491
|
+
*
|
|
37492
|
+
* The check is UA + feature detection only — it does not request the camera,
|
|
37493
|
+
* load the engine, or make network requests. Typical execution time < 5 ms.
|
|
37494
|
+
*/
|
|
37495
|
+
function isSupported() {
|
|
37496
|
+
const info = {
|
|
37497
|
+
device: getDeviceInfo(),
|
|
37498
|
+
system: getSystemInfo(),
|
|
37499
|
+
webAssembly: detectWebAssembly(),
|
|
37500
|
+
webAssemblySimd: detectWebAssemblySimd(),
|
|
37501
|
+
mediaDevices: detectMediaDevices(),
|
|
37502
|
+
secureContext: detectSecureContext(),
|
|
37503
|
+
inAppWebView: detectInAppWebView(),
|
|
37504
|
+
hardwareConcurrency: detectHardwareConcurrency(),
|
|
37505
|
+
deviceMemory: detectDeviceMemory()
|
|
37506
|
+
};
|
|
37507
|
+
const reasons = [];
|
|
37508
|
+
if (!info.webAssembly) reasons.push('NO_WEBASSEMBLY');
|
|
37509
|
+
if (!info.mediaDevices) reasons.push('NO_MEDIA_DEVICES');
|
|
37510
|
+
if (isMobileOrTablet() && !info.secureContext) {
|
|
37511
|
+
// Camera APIs require a secure context on mobile; localhost is always
|
|
37512
|
+
// treated as secure by the platform, so this fires for true plaintext only.
|
|
37513
|
+
reasons.push('INSECURE_CONTEXT');
|
|
37514
|
+
}
|
|
37515
|
+
if (info.inAppWebView !== 'none') reasons.push('IN_APP_WEBVIEW');
|
|
37516
|
+
const ios = parseIosVersion();
|
|
37517
|
+
if (ios) {
|
|
37518
|
+
const tooOld = ios.major < MIN_IOS_MAJOR || ios.major === MIN_IOS_MAJOR && ios.minor < MIN_IOS_MINOR_FOR_16;
|
|
37519
|
+
if (tooOld) reasons.push('OLD_IOS');
|
|
37520
|
+
}
|
|
37521
|
+
const android = parseAndroidMajor();
|
|
37522
|
+
if (android !== null && android < MIN_ANDROID_MAJOR) {
|
|
37523
|
+
reasons.push('OLD_ANDROID');
|
|
37524
|
+
}
|
|
37525
|
+
return {
|
|
37526
|
+
supported: reasons.length === 0,
|
|
37527
|
+
reasons,
|
|
37528
|
+
info
|
|
37529
|
+
};
|
|
37530
|
+
}
|
|
37531
|
+
|
|
37361
37532
|
var name = "authme/sdk";
|
|
37362
|
-
var version$1 = "2.8.
|
|
37533
|
+
var version$1 = "2.8.59";
|
|
37363
37534
|
var packageInfo = {
|
|
37364
37535
|
name: name,
|
|
37365
37536
|
version: version$1};
|
|
@@ -37369,4 +37540,4 @@ const version = packageInfo.version;
|
|
|
37369
37540
|
(_window$_Symbol$for = (_window = window)[_Symbol$for = Symbol.for('authme-sdk')]) != null ? _window$_Symbol$for : _window[_Symbol$for] = {};
|
|
37370
37541
|
window[Symbol.for('authme-sdk')][packageInfo.name] = version;
|
|
37371
37542
|
|
|
37372
|
-
export { AuthmeIdentityVerification, arrow_down, arrow_left, arrow_right, arrow_up, card_lr, card_rotate_down, card_rotate_left, card_rotate_right, card_rotate_up, card_ud, circle_large_to_sm_mask, circle_sm_to_large_mask, defaultExtraDocumentConfig, defaultIdRecognitionConfig, defaultIdentityVerificationConfig, defaultLivenessConfig, fraudScanIntroPageStep1, identityVerificationFeatureIdentityVerification, renderExtraUI, scan, startExtra, startLiveness, startOCR, success, tutorial, version };
|
|
37543
|
+
export { AuthmeIdentityVerification, arrow_down, arrow_left, arrow_right, arrow_up, card_lr, card_rotate_down, card_rotate_left, card_rotate_right, card_rotate_up, card_ud, circle_large_to_sm_mask, circle_sm_to_large_mask, defaultExtraDocumentConfig, defaultIdRecognitionConfig, defaultIdentityVerificationConfig, defaultLivenessConfig, fraudScanIntroPageStep1, identityVerificationFeatureIdentityVerification, isSupported, renderExtraUI, scan, startExtra, startLiveness, startOCR, success, tutorial, version };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type SupportReason = 'NO_WEBASSEMBLY' | 'NO_MEDIA_DEVICES' | 'INSECURE_CONTEXT' | 'OLD_IOS' | 'OLD_ANDROID' | 'IN_APP_WEBVIEW';
|
|
2
|
+
export type InAppWebView = 'none' | 'line' | 'fb' | 'messenger' | 'instagram' | 'wechat' | 'other';
|
|
3
|
+
export interface SupportInfo {
|
|
4
|
+
device: string;
|
|
5
|
+
system: string;
|
|
6
|
+
webAssembly: boolean;
|
|
7
|
+
webAssemblySimd: boolean;
|
|
8
|
+
mediaDevices: boolean;
|
|
9
|
+
secureContext: boolean;
|
|
10
|
+
inAppWebView: InAppWebView;
|
|
11
|
+
hardwareConcurrency: number | null;
|
|
12
|
+
deviceMemory: number | null;
|
|
13
|
+
}
|
|
14
|
+
export interface SupportCheckResult {
|
|
15
|
+
supported: boolean;
|
|
16
|
+
reasons: SupportReason[];
|
|
17
|
+
info: SupportInfo;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Synchronous pre-flight check that the current browser/device can run the
|
|
21
|
+
* eKYC SDK. Returns a binary `supported` flag plus the reasons it failed
|
|
22
|
+
* (when applicable) and a snapshot of the detected environment.
|
|
23
|
+
*
|
|
24
|
+
* The check is UA + feature detection only — it does not request the camera,
|
|
25
|
+
* load the engine, or make network requests. Typical execution time < 5 ms.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isSupported(): SupportCheckResult;
|
package/src/lib/v2/ui/modal.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CountryCode } from '@authme/id-recognition';
|
|
2
|
+
/**
|
|
3
|
+
* Defense-in-depth check for the public `getCardTypeAndCountry` API.
|
|
4
|
+
*
|
|
5
|
+
* The `supportCountries` value is interpolated into translation keys like
|
|
6
|
+
* `sdk.general.country.${country}`. TypeScript's `CountryCode` enum does not
|
|
7
|
+
* enforce values at runtime, so a misconfigured integrator could pass an
|
|
8
|
+
* arbitrary string. Reject anything outside the SDK's known country list at
|
|
9
|
+
* the entry point.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateSupportCountries(countries: readonly CountryCode[]): void;
|