@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
58 lines (55 loc) • 2.41 kB
JavaScript
/**
* Copyright © 2023 Nevis Security AG. All rights reserved.
*/
import { UserInteractionPlatformOperation } from '../../cache/operation/UserInteractionPlatformOperation';
import { PlatformOperationCache } from '../../cache/PlatformOperationCache';
import NevisMobileAuthenticationSdkReact from '../../MobileAuthenticationSdk';
import { OperationIdMessage } from '../../model/messages/out/OperationIdMessage';
/**
* 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}
*/
export class OsAuthenticationListenHandler {}
export class OsAuthenticationListenHandlerImpl extends OsAuthenticationListenHandler {
constructor(operationId) {
super();
this._operationId = operationId;
}
async cancelAuthentication() {
const message = new OperationIdMessage(this._operationId);
return NevisMobileAuthenticationSdkReact.cancelAuthentication(message);
}
async pauseListening() {
const operation = PlatformOperationCache.getInstance().read(this._operationId);
if (!(operation instanceof UserInteractionPlatformOperation) || operation.userVerificationHandler === undefined) {
return this;
}
const message = new OperationIdMessage(this._operationId);
return NevisMobileAuthenticationSdkReact.pauseListening(message).then(() => {
return this;
});
}
async resumeListening() {
const operation = PlatformOperationCache.getInstance().read(this._operationId);
if (!(operation instanceof UserInteractionPlatformOperation) || operation.userVerificationHandler === undefined) {
return this;
}
const message = new OperationIdMessage(this._operationId);
return NevisMobileAuthenticationSdkReact.resumeListening(message).then(() => {
return this;
});
}
}
//# sourceMappingURL=OsAuthenticationListenHandler.js.map
;