Files
kapp/6709.js
T
2026-05-12 16:58:11 -03:00

271 lines
12 KiB
JavaScript

(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([[6709],{
/***/ 73315:
/*!***************************************************************************!*\
!*** ./node_modules/@aparajita/capacitor-biometric-auth/dist/esm/base.js ***!
\***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "BiometricAuthBase": () => (/* binding */ BiometricAuthBase)
/* harmony export */ });
/* harmony import */ var _Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 71670);
/* harmony import */ var _capacitor_app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @capacitor/app */ 35057);
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @capacitor/core */ 97718);
/* harmony import */ var _definitions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./definitions */ 43172);
class BiometricAuthBase extends _capacitor_core__WEBPACK_IMPORTED_MODULE_2__.WebPlugin {
authenticate(options) {
var _this = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
try {
yield _this.internalAuthenticate(options);
} catch (error) {
// error will be an instance of CapacitorException on native platforms,
// an instance of BiometryError on the web.
if (error instanceof _capacitor_core__WEBPACK_IMPORTED_MODULE_2__.CapacitorException) {
throw new _definitions__WEBPACK_IMPORTED_MODULE_3__.BiometryError(error.message, error.code);
} else {
throw error;
}
}
})();
}
addResumeListener(listener) {
var _this2 = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
return _capacitor_app__WEBPACK_IMPORTED_MODULE_1__.App.addListener('appStateChange', ({
isActive
}) => {
if (isActive) {
_this2.checkBiometry().then(info => {
listener(info);
}).catch(console.error);
}
});
})();
}
}
/***/ }),
/***/ 36709:
/*!**************************************************************************!*\
!*** ./node_modules/@aparajita/capacitor-biometric-auth/dist/esm/web.js ***!
\**************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "BiometricAuthWeb": () => (/* binding */ BiometricAuthWeb)
/* harmony export */ });
/* harmony import */ var _Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 71670);
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ 73315);
/* harmony import */ var _definitions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./definitions */ 43172);
/* harmony import */ var _web_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./web-utils */ 56798);
// eslint-disable-next-line import/prefer-default-export
class BiometricAuthWeb extends _base__WEBPACK_IMPORTED_MODULE_1__.BiometricAuthBase {
constructor() {
super(...arguments);
this.biometryType = _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.none;
this.biometryTypes = [];
this.biometryIsEnrolled = false;
this.deviceIsSecure = false;
} // On the web, return the fake biometry set by setBiometryType().
checkBiometry() {
var _this = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
const hasBiometry = _this.biometryType !== _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.none;
const available = hasBiometry && _this.biometryIsEnrolled;
let reason = '';
let code = _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.none;
if (!hasBiometry) {
reason = 'No biometry is available';
code = _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.biometryNotAvailable;
} else if (!_this.biometryIsEnrolled) {
reason = 'Biometry is not enrolled';
code = _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.biometryNotEnrolled;
}
return Promise.resolve({
isAvailable: available,
strongBiometryIsAvailable: _this.biometryIsEnrolled && _this.hasStrongBiometry(),
biometryType: _this.biometryType,
biometryTypes: _this.biometryTypes,
deviceIsSecure: _this.deviceIsSecure,
reason,
code
});
})();
}
hasStrongBiometry() {
return this.biometryTypes.some(type => type === _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.faceId || type === _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.touchId || type === _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.fingerprintAuthentication);
}
/* eslint-disable no-alert */
// On the web, fake authentication with a confirm dialog.
internalAuthenticate(options) {
var _this2 = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
const result = yield _this2.checkBiometry(); // First try biometry if available.
if (result.isAvailable) {
if (confirm( // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- we want to use the default value if options?.reason is an empty string
(options === null || options === void 0 ? void 0 : options.reason) || `Authenticate with ${result.biometryTypes.map(type => (0,_web_utils__WEBPACK_IMPORTED_MODULE_3__.getBiometryName)(type)).join(' or ')}?`)) {
return;
}
}
if (options === null || options === void 0 ? void 0 : options.allowDeviceCredential) {
// Either biometry is not available, or the user declined to use it
// and device security is allowed.
if (result.deviceIsSecure) {
if (confirm('Authenticate with device security?')) {
return;
} else {
throw new _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryError('User cancelled', _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.userCancel);
}
} else if (result.isAvailable) {
throw new _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryError('Device is not secure', _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.noDeviceCredential);
}
} else if (!result.isAvailable) {
// Biometry is not available and device security is not allowed.
if (result.biometryType === _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.none) {
throw new _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryError('Biometry is not available', _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.biometryNotAvailable);
} else {
throw new _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryError('Biometry is not enrolled', _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.biometryNotEnrolled);
}
} // The user declined to use biometry and device credentials not allowed.
throw new _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryError('User cancelled', _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryErrorType.userCancel);
})();
} // Web only, used for simulating biometric authentication.
setBiometryType(type) {
var _this3 = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
if (type === undefined) {
return Promise.resolve();
}
const types = Array.isArray(type) ? type : [type];
_this3.biometryTypes = [];
_this3.biometryType = _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.none;
if (types.length === 0) {
return Promise.resolve();
}
if (isBiometryTypes(types)) {
_this3.biometryType = types[0];
if (_this3.biometryType !== _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.none) {
_this3.biometryTypes = types;
}
} else {
for (let i = 0; i < types.length; i++) {
// eslint-disable-next-line no-prototype-builtins
if (_definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.hasOwnProperty(types[i])) {
const biometryType = _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType[types[i]];
if (_this3.biometryType === _definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType.none) {
_this3.biometryTypes = [];
} else {
_this3.biometryTypes.push(biometryType);
}
if (i === 0) {
_this3.biometryType = biometryType;
}
}
}
}
return Promise.resolve();
})();
} // Web only, used for simulating device unlock security.
setBiometryIsEnrolled(enrolled) {
var _this4 = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
_this4.biometryIsEnrolled = enrolled;
return Promise.resolve();
})();
} // Web only, used for simulating device unlock security.
setDeviceIsSecure(isSecure) {
var _this5 = this;
return (0,_Volumes_case_workspace_work_APPS_KA_APP_WORK_NOW_KA_PASS_V2_2_6_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
_this5.deviceIsSecure = isSecure;
return Promise.resolve();
})();
}
}
function isBiometryTypes(value) {
return Object.values(_definitions__WEBPACK_IMPORTED_MODULE_2__.BiometryType).includes(value[0]);
}
/***/ }),
/***/ 64406:
/*!**************************************************************************************************************!*\
!*** ./node_modules/@aparajita/capacitor-biometric-auth/node_modules/@capacitor/app/dist/esm/definitions.js ***!
\**************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ 35057:
/*!********************************************************************************************************!*\
!*** ./node_modules/@aparajita/capacitor-biometric-auth/node_modules/@capacitor/app/dist/esm/index.js ***!
\********************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "App": () => (/* binding */ App)
/* harmony export */ });
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @capacitor/core */ 97718);
/* harmony import */ var _definitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./definitions */ 64406);
const App = (0,_capacitor_core__WEBPACK_IMPORTED_MODULE_0__.registerPlugin)('App', {
web: () => __webpack_require__.e(/*! import() */ 740).then(__webpack_require__.bind(__webpack_require__, /*! ./web */ 50740)).then(m => new m.AppWeb())
});
/***/ })
}])
//# sourceMappingURL=6709.js.map