@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
64 lines (62 loc) • 2.98 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.OsAuthenticationListenHandlerImpl = exports.OsAuthenticationListenHandler = void 0;
var _UserInteractionPlatformOperation = require("../../cache/operation/UserInteractionPlatformOperation");
var _PlatformOperationCache = require("../../cache/PlatformOperationCache");
var _MobileAuthenticationSdk = _interopRequireDefault(require("../../MobileAuthenticationSdk"));
var _OperationIdMessage = require("../../model/messages/out/OperationIdMessage");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright © 2023 Nevis Security AG. All rights reserved.
*/
/**
* An object that can be used to pause or resume listening for OS credentials (i.e. fingerprint, face
* recognition) and to cancel the whole operation while listening for credentials.
*
* **IMPORTANT** \
* The {@link OsAuthenticationListenHandler} class is Android specific.
*
* This is used with {@link Aaid.BIOMETRIC}, {@link Aaid.DEVICE_PASSCODE} and {@link Aaid.FINGERPRINT}
* authenticator attestation identifiers.
*
* @see
* - {@link BiometricUserVerificationHandler.listenForOsCredentials}
* - {@link DevicePasscodeUserVerificationHandler.listenForOsCredentials}
* - {@link FingerprintUserVerificationHandler.listenForOsCredentials}
*/
class OsAuthenticationListenHandler {}
exports.OsAuthenticationListenHandler = OsAuthenticationListenHandler;
class OsAuthenticationListenHandlerImpl extends OsAuthenticationListenHandler {
constructor(operationId) {
super();
this._operationId = operationId;
}
async cancelAuthentication() {
const message = new _OperationIdMessage.OperationIdMessage(this._operationId);
return _MobileAuthenticationSdk.default.cancelAuthentication(message);
}
async pauseListening() {
const operation = _PlatformOperationCache.PlatformOperationCache.getInstance().read(this._operationId);
if (!(operation instanceof _UserInteractionPlatformOperation.UserInteractionPlatformOperation) || operation.userVerificationHandler === undefined) {
return this;
}
const message = new _OperationIdMessage.OperationIdMessage(this._operationId);
return _MobileAuthenticationSdk.default.pauseListening(message).then(() => {
return this;
});
}
async resumeListening() {
const operation = _PlatformOperationCache.PlatformOperationCache.getInstance().read(this._operationId);
if (!(operation instanceof _UserInteractionPlatformOperation.UserInteractionPlatformOperation) || operation.userVerificationHandler === undefined) {
return this;
}
const message = new _OperationIdMessage.OperationIdMessage(this._operationId);
return _MobileAuthenticationSdk.default.resumeListening(message).then(() => {
return this;
});
}
}
exports.OsAuthenticationListenHandlerImpl = OsAuthenticationListenHandlerImpl;
//# sourceMappingURL=OsAuthenticationListenHandler.js.map
;