@authme/identity-verification 2.8.57 → 2.8.60
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 +169 -8
- package/index.esm.js +170 -10
- 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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@use 'base';
|
|
2
|
+
@use 'ocr';
|
|
3
|
+
@use 'liveness';
|
|
4
|
+
@use 'theme';
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
--authme-close-icon-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAYCAYAAAAPtVbGAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADoSURBVHgB7ZTNDYJAEIUf0ogNgB4ogDoIMfFGF2AXHDmgdcCdi9CAneBONIZs1t23xoMmfAnhJzv7ZdiZAVb+guxQlHJ9KybUP+R5kc5Aox7TaJ9gug49CAFmVBKzi5N+HIebVSILojgJECBlRAsB1P10busGrkyEaRw6RqQLLm1dmfYzShgRK7BKbCIfgRCAIMuLSq0snwGdKoyUFQghCLSMtj4CYQOWjdrW9m6BymR5BvK78MiG7iOnxHDIR58+ckreVRHbR06Jq0x9ROEnAl+RbUBSZaqL/AYk0LN98BKpGNOAXPk97mOkwoggZdKjAAAAAElFTkSuQmCC');
|
|
8
|
+
--authme-back-icon-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD7SURBVHgB3ZU9EoIwEIVXuQA3MCWl3EA7y3ACh5voSeQIWFI53sCSztYypR2+jHGGwYT8NvpmdhIW+B4hP0v061pQgDjnazQXhECUbdsK07NL8tQIniOYCkpiMIFLHfH1t7l3nH+RAX6wvec0gqqq9iFwKesIJHwYhmaUcoZbDWLhswYp4EYDDbwGvKEAfRlgtTA09xRwKd0qEio+WlGEsmmi7/tnURQdujt6L8sNrmX+SgHKdEnAHoCe0eWxJpnpBmBCY5Ij35GHrBtNTbrcxUylGkx6TY5yOotiTHwOOxZi4lVwQky8K5rGpJyrCaElk6E5yT7gW/prvQCHpnbdSHXj/AAAAABJRU5ErkJggg==');
|
|
9
|
+
--authme-camera-icon-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAXCAYAAAAV1F8QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADFSURBVHgB7VbRDYIwFLzHAnYERmADZQM3ECdgBd1AJ1A30AlgBDaQDXSDei+pCSGRSqT+0EuOl5Jr773+XAUeWGtLlrVHVovIfkggGDZZsVRkQz4/yAyZkTnNaowFTQx5dzS/6qTTeem6G92pZ/IL95+FooKLkxM0PdGNogO+AM/ZsSx7v1PHXAWVjo1A4NkP8pq4dYtw0FtaJPgTolE0ikbRaC5GmkMZwiHVj3TSscX0caEDaFJv31FesGwwPfS2jvoUeAEf2F2Th2w/vQAAAABJRU5ErkJggg==');
|
|
10
|
+
--authme-check-icon-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQ4IDI0QzQ4IDM3LjI1NDggMzcuMjU0OCA0OCAyNCA0OEMxMC43NDUyIDQ4IDAgMzcuMjU0OCAwIDI0QzAgMTAuNzQ1MiAxMC43NDUyIDAgMjQgMEMzNy4yNTQ4IDAgNDggMTAuNzQ1MiA0OCAyNFoiIGZpbGw9IiMwMEMxQjYiLz4KPHBhdGggZD0iTTE5Ljk5MzQgMjguODQ0MUwxNC43ODA5IDIzLjYzMTZMMTMuMDA1OSAyNS4zOTQxTDE5Ljk5MzQgMzIuMzgxNkwzNC45OTM0IDE3LjM4MTZMMzMuMjMwOSAxNS42MTkxTDE5Ljk5MzQgMjguODQ0MVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=');
|
|
11
|
+
}
|
package/index.cjs.js
CHANGED
|
@@ -70,6 +70,13 @@ require('core-js/modules/es.uint8-array.set-from-hex.js');
|
|
|
70
70
|
require('core-js/modules/es.uint8-array.to-base64.js');
|
|
71
71
|
require('core-js/modules/es.uint8-array.to-hex.js');
|
|
72
72
|
require('core-js/modules/es.iterator.some.js');
|
|
73
|
+
require('core-js/modules/es.set.difference.v2.js');
|
|
74
|
+
require('core-js/modules/es.set.intersection.v2.js');
|
|
75
|
+
require('core-js/modules/es.set.is-disjoint-from.v2.js');
|
|
76
|
+
require('core-js/modules/es.set.is-subset-of.v2.js');
|
|
77
|
+
require('core-js/modules/es.set.is-superset-of.v2.js');
|
|
78
|
+
require('core-js/modules/es.set.symmetric-difference.v2.js');
|
|
79
|
+
require('core-js/modules/es.set.union.v2.js');
|
|
73
80
|
|
|
74
81
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
75
82
|
if (null == r) return {};
|
|
@@ -29333,7 +29340,11 @@ const modal = arg => {
|
|
|
29333
29340
|
domTitle.innerText = arg.title;
|
|
29334
29341
|
domSubtitle.innerText = arg.subtitle;
|
|
29335
29342
|
domImage.src = arg.image;
|
|
29336
|
-
|
|
29343
|
+
if (arg.content instanceof HTMLElement) {
|
|
29344
|
+
domContent.appendChild(arg.content);
|
|
29345
|
+
} else {
|
|
29346
|
+
domContent.innerHTML = arg.content;
|
|
29347
|
+
}
|
|
29337
29348
|
domClose.textContent = '';
|
|
29338
29349
|
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>`);
|
|
29339
29350
|
domConfirm.innerText = arg.confirm;
|
|
@@ -29623,15 +29634,18 @@ async function startLiveness(config) {
|
|
|
29623
29634
|
// Start
|
|
29624
29635
|
const step1 = rxjs.defer(() => {
|
|
29625
29636
|
return new Promise((resolve, reject) => {
|
|
29637
|
+
const hintList = document.createElement('ul');
|
|
29638
|
+
['sdk.liveness.detection.infopageHint.face', 'sdk.liveness.detection.infopageHint.environment'].forEach(key => {
|
|
29639
|
+
const li = document.createElement('li');
|
|
29640
|
+
li.textContent = translateService.translate(key);
|
|
29641
|
+
hintList.appendChild(li);
|
|
29642
|
+
});
|
|
29626
29643
|
modal({
|
|
29627
29644
|
header: translateService.translate('sdk.liveness.detection.header'),
|
|
29628
29645
|
title: translateService.translate('sdk.liveness.detection.subtitle'),
|
|
29629
29646
|
subtitle: translateService.translate('sdk.liveness.detection.content'),
|
|
29630
29647
|
image: LIVENESS_GUIDE_IMG,
|
|
29631
|
-
content:
|
|
29632
|
-
<li>${translateService.translate('sdk.liveness.detection.infopageHint.face')}</li>
|
|
29633
|
-
<li>${translateService.translate('sdk.liveness.detection.infopageHint.environment')}</li>
|
|
29634
|
-
</ul>`,
|
|
29648
|
+
content: hintList,
|
|
29635
29649
|
confirm: translateService.translate('sdk.general.start'),
|
|
29636
29650
|
onClose: () => {
|
|
29637
29651
|
sendStatusAction$2(core.StatusAction.BtnClose);
|
|
@@ -32211,10 +32225,10 @@ const ocrResultModal = arg => {
|
|
|
32211
32225
|
domCountDownContainer.style.color = uiThemeConfig.resultPageCountdown.textColor;
|
|
32212
32226
|
domCountDownContainer.style.fontSize = `${uiThemeConfig.resultPageCountdown.fontSize}px`;
|
|
32213
32227
|
domCountDownContainer.style.fontWeight = util.fontWeight[uiThemeConfig.resultPageCountdown.textWeight];
|
|
32214
|
-
domCountDownContainer.innerHTML = `${arg.countDown1Text} <span class="video-container__ocrResultModal-countdown" style="color: ${uiThemeConfig.resultPageCountdown.timeTextColor};font-size:${uiThemeConfig.resultPageCountdown.timeFontSize}px;font-weight:${util.fontWeight[uiThemeConfig.resultPageCountdown.timeTextWeight]}"> ${formatTime(timer)} </span> ${arg.countDown2Text}`;
|
|
32228
|
+
domCountDownContainer.innerHTML = `${arg.countDown1Text} <span class="video-container__ocrResultModal-countdown" style="color: ${util.safeColor(uiThemeConfig.resultPageCountdown.timeTextColor)};font-size:${util.safeFontSize(uiThemeConfig.resultPageCountdown.timeFontSize)}px;font-weight:${util.safeFontWeight(util.fontWeight[uiThemeConfig.resultPageCountdown.timeTextWeight])}"> ${formatTime(timer)} </span> ${arg.countDown2Text}`;
|
|
32215
32229
|
domConfirm.innerText = arg.confirmText;
|
|
32216
32230
|
domClose.textContent = '';
|
|
32217
|
-
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>`);
|
|
32231
|
+
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="${util.safeColor(uiThemeConfig.nonEkycCloseButton.contentColor)}" fill-opacity="${util.safeOpacity(uiThemeConfig.nonEkycCloseButton.contentOpacity)}" /></svg>`);
|
|
32218
32232
|
const countdownInterval = setInterval(() => {
|
|
32219
32233
|
timer -= 1;
|
|
32220
32234
|
const countdownEl = domModal.querySelector('.video-container__ocrResultModal-countdown');
|
|
@@ -37102,6 +37116,23 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
37102
37116
|
});
|
|
37103
37117
|
}
|
|
37104
37118
|
|
|
37119
|
+
const VALID_COUNTRY_CODES = new Set(Object.values(idRecognition.CountryCode));
|
|
37120
|
+
/**
|
|
37121
|
+
* Defense-in-depth check for the public `getCardTypeAndCountry` API.
|
|
37122
|
+
*
|
|
37123
|
+
* The `supportCountries` value is interpolated into translation keys like
|
|
37124
|
+
* `sdk.general.country.${country}`. TypeScript's `CountryCode` enum does not
|
|
37125
|
+
* enforce values at runtime, so a misconfigured integrator could pass an
|
|
37126
|
+
* arbitrary string. Reject anything outside the SDK's known country list at
|
|
37127
|
+
* the entry point.
|
|
37128
|
+
*/
|
|
37129
|
+
function validateSupportCountries(countries) {
|
|
37130
|
+
const invalid = countries.filter(c => !VALID_COUNTRY_CODES.has(c));
|
|
37131
|
+
if (invalid.length > 0) {
|
|
37132
|
+
throw new Error(`Invalid country code in supportCountries: ${invalid.join(', ')}`);
|
|
37133
|
+
}
|
|
37134
|
+
}
|
|
37135
|
+
|
|
37105
37136
|
const _excluded = ["canvas", "loadingLottie"];
|
|
37106
37137
|
function identityVerificationFeatureIdentityVerification() {
|
|
37107
37138
|
return 'identity-verification-feature-identity-verification';
|
|
@@ -37201,6 +37232,9 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
37201
37232
|
}
|
|
37202
37233
|
async getCardTypeAndCountry(userConfig) {
|
|
37203
37234
|
var _userConfig$supportCo, _userConfig$supportCa;
|
|
37235
|
+
if (userConfig.supportCountries) {
|
|
37236
|
+
validateSupportCountries(userConfig.supportCountries);
|
|
37237
|
+
}
|
|
37204
37238
|
const defaultCountries = [idRecognition.CountryCode.TWN, idRecognition.CountryCode.JPN, idRecognition.CountryCode.ZAF, idRecognition.CountryCode.USA, idRecognition.CountryCode.CHN, idRecognition.CountryCode.PHL, idRecognition.CountryCode.GBR, idRecognition.CountryCode.KOR, idRecognition.CountryCode.HKG, idRecognition.CountryCode.FRA, idRecognition.CountryCode.ESP, idRecognition.CountryCode.MEX, idRecognition.CountryCode.ITA, idRecognition.CountryCode.IND, idRecognition.CountryCode.COL, idRecognition.CountryCode.RUS, idRecognition.CountryCode.DEU, idRecognition.CountryCode.TUR, idRecognition.CountryCode.CAN, idRecognition.CountryCode.AUS, idRecognition.CountryCode.IDN, idRecognition.CountryCode.MYS, idRecognition.CountryCode.EGY, idRecognition.CountryCode.SAU, idRecognition.CountryCode.NLD, idRecognition.CountryCode.SGP];
|
|
37205
37239
|
const defaultCountry = userConfig.defaultCountry !== undefined && defaultCountries.includes(userConfig.defaultCountry) ? userConfig.defaultCountry : defaultCountries[0];
|
|
37206
37240
|
const supportCountries = (_userConfig$supportCo = userConfig.supportCountries) != null ? _userConfig$supportCo : defaultCountries;
|
|
@@ -37371,8 +37405,134 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
37371
37405
|
}
|
|
37372
37406
|
}
|
|
37373
37407
|
|
|
37408
|
+
const MIN_IOS_MAJOR = 16;
|
|
37409
|
+
const MIN_IOS_MINOR_FOR_16 = 4;
|
|
37410
|
+
const MIN_ANDROID_MAJOR = 9;
|
|
37411
|
+
const IN_APP_WEBVIEW_PATTERNS = [{
|
|
37412
|
+
key: 'line',
|
|
37413
|
+
pattern: /\bLine\//i
|
|
37414
|
+
}, {
|
|
37415
|
+
key: 'messenger',
|
|
37416
|
+
pattern: /\bMessenger\b/i
|
|
37417
|
+
}, {
|
|
37418
|
+
key: 'fb',
|
|
37419
|
+
pattern: /\bFBAN|FBAV|FB_IAB\b/i
|
|
37420
|
+
}, {
|
|
37421
|
+
key: 'instagram',
|
|
37422
|
+
pattern: /\bInstagram\b/i
|
|
37423
|
+
}, {
|
|
37424
|
+
key: 'wechat',
|
|
37425
|
+
pattern: /MicroMessenger|WeChat/i
|
|
37426
|
+
}];
|
|
37427
|
+
function detectWebAssembly() {
|
|
37428
|
+
return typeof WebAssembly !== 'undefined';
|
|
37429
|
+
}
|
|
37430
|
+
function detectWebAssemblySimd() {
|
|
37431
|
+
if (!detectWebAssembly()) return false;
|
|
37432
|
+
// Mirrors libs/engine/src/lib/engine.ts isSimdSupported(); kept independent
|
|
37433
|
+
// so callers don't have to load the engine bundle just to introspect.
|
|
37434
|
+
try {
|
|
37435
|
+
if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
|
|
37436
|
+
return false;
|
|
37437
|
+
}
|
|
37438
|
+
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]));
|
|
37439
|
+
} catch (_unused) {
|
|
37440
|
+
return false;
|
|
37441
|
+
}
|
|
37442
|
+
}
|
|
37443
|
+
function detectMediaDevices() {
|
|
37444
|
+
var _navigator$mediaDevic;
|
|
37445
|
+
return typeof navigator !== 'undefined' && 'mediaDevices' in navigator && typeof ((_navigator$mediaDevic = navigator.mediaDevices) == null ? void 0 : _navigator$mediaDevic.getUserMedia) === 'function';
|
|
37446
|
+
}
|
|
37447
|
+
function detectSecureContext() {
|
|
37448
|
+
var _window$location;
|
|
37449
|
+
if (typeof window === 'undefined') return false;
|
|
37450
|
+
if (typeof window.isSecureContext === 'boolean') {
|
|
37451
|
+
return window.isSecureContext;
|
|
37452
|
+
}
|
|
37453
|
+
return ((_window$location = window.location) == null ? void 0 : _window$location.protocol) === 'https:';
|
|
37454
|
+
}
|
|
37455
|
+
function detectInAppWebView() {
|
|
37456
|
+
var _navigator$userAgent;
|
|
37457
|
+
const ua = (_navigator$userAgent = navigator.userAgent) != null ? _navigator$userAgent : '';
|
|
37458
|
+
for (const {
|
|
37459
|
+
key,
|
|
37460
|
+
pattern
|
|
37461
|
+
} of IN_APP_WEBVIEW_PATTERNS) {
|
|
37462
|
+
if (pattern.test(ua)) return key;
|
|
37463
|
+
}
|
|
37464
|
+
return 'none';
|
|
37465
|
+
}
|
|
37466
|
+
function parseIosVersion() {
|
|
37467
|
+
const m = navigator.userAgent.match(/OS (\d+)[._](\d+)(?:[._](\d+))?/);
|
|
37468
|
+
if (!m) return null;
|
|
37469
|
+
return {
|
|
37470
|
+
major: Number(m[1]),
|
|
37471
|
+
minor: Number(m[2])
|
|
37472
|
+
};
|
|
37473
|
+
}
|
|
37474
|
+
function parseAndroidMajor() {
|
|
37475
|
+
const m = navigator.userAgent.match(/Android\s+(\d+)/i);
|
|
37476
|
+
if (!m) return null;
|
|
37477
|
+
return Number(m[1]);
|
|
37478
|
+
}
|
|
37479
|
+
function detectHardwareConcurrency() {
|
|
37480
|
+
if (typeof navigator === 'undefined') return null;
|
|
37481
|
+
const v = navigator.hardwareConcurrency;
|
|
37482
|
+
return typeof v === 'number' && v > 0 ? v : null;
|
|
37483
|
+
}
|
|
37484
|
+
function detectDeviceMemory() {
|
|
37485
|
+
if (typeof navigator === 'undefined') return null;
|
|
37486
|
+
const v = navigator.deviceMemory;
|
|
37487
|
+
return typeof v === 'number' && v > 0 ? v : null;
|
|
37488
|
+
}
|
|
37489
|
+
/**
|
|
37490
|
+
* Synchronous pre-flight check that the current browser/device can run the
|
|
37491
|
+
* eKYC SDK. Returns a binary `supported` flag plus the reasons it failed
|
|
37492
|
+
* (when applicable) and a snapshot of the detected environment.
|
|
37493
|
+
*
|
|
37494
|
+
* The check is UA + feature detection only — it does not request the camera,
|
|
37495
|
+
* load the engine, or make network requests. Typical execution time < 5 ms.
|
|
37496
|
+
*/
|
|
37497
|
+
function isSupported() {
|
|
37498
|
+
const info = {
|
|
37499
|
+
device: util.getDeviceInfo(),
|
|
37500
|
+
system: util.getSystemInfo(),
|
|
37501
|
+
webAssembly: detectWebAssembly(),
|
|
37502
|
+
webAssemblySimd: detectWebAssemblySimd(),
|
|
37503
|
+
mediaDevices: detectMediaDevices(),
|
|
37504
|
+
secureContext: detectSecureContext(),
|
|
37505
|
+
inAppWebView: detectInAppWebView(),
|
|
37506
|
+
hardwareConcurrency: detectHardwareConcurrency(),
|
|
37507
|
+
deviceMemory: detectDeviceMemory()
|
|
37508
|
+
};
|
|
37509
|
+
const reasons = [];
|
|
37510
|
+
if (!info.webAssembly) reasons.push('NO_WEBASSEMBLY');
|
|
37511
|
+
if (!info.mediaDevices) reasons.push('NO_MEDIA_DEVICES');
|
|
37512
|
+
if (util.isMobileOrTablet() && !info.secureContext) {
|
|
37513
|
+
// Camera APIs require a secure context on mobile; localhost is always
|
|
37514
|
+
// treated as secure by the platform, so this fires for true plaintext only.
|
|
37515
|
+
reasons.push('INSECURE_CONTEXT');
|
|
37516
|
+
}
|
|
37517
|
+
if (info.inAppWebView !== 'none') reasons.push('IN_APP_WEBVIEW');
|
|
37518
|
+
const ios = parseIosVersion();
|
|
37519
|
+
if (ios) {
|
|
37520
|
+
const tooOld = ios.major < MIN_IOS_MAJOR || ios.major === MIN_IOS_MAJOR && ios.minor < MIN_IOS_MINOR_FOR_16;
|
|
37521
|
+
if (tooOld) reasons.push('OLD_IOS');
|
|
37522
|
+
}
|
|
37523
|
+
const android = parseAndroidMajor();
|
|
37524
|
+
if (android !== null && android < MIN_ANDROID_MAJOR) {
|
|
37525
|
+
reasons.push('OLD_ANDROID');
|
|
37526
|
+
}
|
|
37527
|
+
return {
|
|
37528
|
+
supported: reasons.length === 0,
|
|
37529
|
+
reasons,
|
|
37530
|
+
info
|
|
37531
|
+
};
|
|
37532
|
+
}
|
|
37533
|
+
|
|
37374
37534
|
var name = "authme/sdk";
|
|
37375
|
-
var version$1 = "2.8.
|
|
37535
|
+
var version$1 = "2.8.60";
|
|
37376
37536
|
var packageInfo = {
|
|
37377
37537
|
name: name,
|
|
37378
37538
|
version: version$1};
|
|
@@ -37401,6 +37561,7 @@ exports.defaultIdentityVerificationConfig = defaultIdentityVerificationConfig;
|
|
|
37401
37561
|
exports.defaultLivenessConfig = defaultLivenessConfig;
|
|
37402
37562
|
exports.fraudScanIntroPageStep1 = fraudScanIntroPageStep1;
|
|
37403
37563
|
exports.identityVerificationFeatureIdentityVerification = identityVerificationFeatureIdentityVerification;
|
|
37564
|
+
exports.isSupported = isSupported;
|
|
37404
37565
|
exports.renderExtraUI = renderExtraUI;
|
|
37405
37566
|
exports.scan = scan;
|
|
37406
37567
|
exports.startExtra = startExtra;
|
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 {};
|
|
@@ -29331,7 +29338,11 @@ const modal = arg => {
|
|
|
29331
29338
|
domTitle.innerText = arg.title;
|
|
29332
29339
|
domSubtitle.innerText = arg.subtitle;
|
|
29333
29340
|
domImage.src = arg.image;
|
|
29334
|
-
|
|
29341
|
+
if (arg.content instanceof HTMLElement) {
|
|
29342
|
+
domContent.appendChild(arg.content);
|
|
29343
|
+
} else {
|
|
29344
|
+
domContent.innerHTML = arg.content;
|
|
29345
|
+
}
|
|
29335
29346
|
domClose.textContent = '';
|
|
29336
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>`);
|
|
29337
29348
|
domConfirm.innerText = arg.confirm;
|
|
@@ -29621,15 +29632,18 @@ async function startLiveness(config) {
|
|
|
29621
29632
|
// Start
|
|
29622
29633
|
const step1 = defer(() => {
|
|
29623
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
|
+
});
|
|
29624
29641
|
modal({
|
|
29625
29642
|
header: translateService.translate('sdk.liveness.detection.header'),
|
|
29626
29643
|
title: translateService.translate('sdk.liveness.detection.subtitle'),
|
|
29627
29644
|
subtitle: translateService.translate('sdk.liveness.detection.content'),
|
|
29628
29645
|
image: LIVENESS_GUIDE_IMG,
|
|
29629
|
-
content:
|
|
29630
|
-
<li>${translateService.translate('sdk.liveness.detection.infopageHint.face')}</li>
|
|
29631
|
-
<li>${translateService.translate('sdk.liveness.detection.infopageHint.environment')}</li>
|
|
29632
|
-
</ul>`,
|
|
29646
|
+
content: hintList,
|
|
29633
29647
|
confirm: translateService.translate('sdk.general.start'),
|
|
29634
29648
|
onClose: () => {
|
|
29635
29649
|
sendStatusAction$2(StatusAction.BtnClose);
|
|
@@ -32209,10 +32223,10 @@ const ocrResultModal = arg => {
|
|
|
32209
32223
|
domCountDownContainer.style.color = uiThemeConfig.resultPageCountdown.textColor;
|
|
32210
32224
|
domCountDownContainer.style.fontSize = `${uiThemeConfig.resultPageCountdown.fontSize}px`;
|
|
32211
32225
|
domCountDownContainer.style.fontWeight = fontWeight[uiThemeConfig.resultPageCountdown.textWeight];
|
|
32212
|
-
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}`;
|
|
32213
32227
|
domConfirm.innerText = arg.confirmText;
|
|
32214
32228
|
domClose.textContent = '';
|
|
32215
|
-
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>`);
|
|
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>`);
|
|
32216
32230
|
const countdownInterval = setInterval(() => {
|
|
32217
32231
|
timer -= 1;
|
|
32218
32232
|
const countdownEl = domModal.querySelector('.video-container__ocrResultModal-countdown');
|
|
@@ -37100,6 +37114,23 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
37100
37114
|
});
|
|
37101
37115
|
}
|
|
37102
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
|
+
|
|
37103
37134
|
const _excluded = ["canvas", "loadingLottie"];
|
|
37104
37135
|
function identityVerificationFeatureIdentityVerification() {
|
|
37105
37136
|
return 'identity-verification-feature-identity-verification';
|
|
@@ -37199,6 +37230,9 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
|
|
|
37199
37230
|
}
|
|
37200
37231
|
async getCardTypeAndCountry(userConfig) {
|
|
37201
37232
|
var _userConfig$supportCo, _userConfig$supportCa;
|
|
37233
|
+
if (userConfig.supportCountries) {
|
|
37234
|
+
validateSupportCountries(userConfig.supportCountries);
|
|
37235
|
+
}
|
|
37202
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];
|
|
37203
37237
|
const defaultCountry = userConfig.defaultCountry !== undefined && defaultCountries.includes(userConfig.defaultCountry) ? userConfig.defaultCountry : defaultCountries[0];
|
|
37204
37238
|
const supportCountries = (_userConfig$supportCo = userConfig.supportCountries) != null ? _userConfig$supportCo : defaultCountries;
|
|
@@ -37369,8 +37403,134 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
|
|
|
37369
37403
|
}
|
|
37370
37404
|
}
|
|
37371
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
|
+
|
|
37372
37532
|
var name = "authme/sdk";
|
|
37373
|
-
var version$1 = "2.8.
|
|
37533
|
+
var version$1 = "2.8.60";
|
|
37374
37534
|
var packageInfo = {
|
|
37375
37535
|
name: name,
|
|
37376
37536
|
version: version$1};
|
|
@@ -37380,4 +37540,4 @@ const version = packageInfo.version;
|
|
|
37380
37540
|
(_window$_Symbol$for = (_window = window)[_Symbol$for = Symbol.for('authme-sdk')]) != null ? _window$_Symbol$for : _window[_Symbol$for] = {};
|
|
37381
37541
|
window[Symbol.for('authme-sdk')][packageInfo.name] = version;
|
|
37382
37542
|
|
|
37383
|
-
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;
|