UNPKG

@nevis-security/nevis-mobile-authentication-sdk-react

Version:

React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.

70 lines (66 loc) 2.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OutOfBandPlatformOperationType = exports.OutOfBandPlatformOperation = void 0; var _PlatformOperation = require("./PlatformOperation"); var _OutOfBandAuthentication = require("../../operations/outOfBand/OutOfBandAuthentication"); var _OutOfBandRegistration = require("../../operations/outOfBand/OutOfBandRegistration"); /** * Copyright © 2023-2024 Nevis Security AG. All rights reserved. */ /** * Represents the eligible types of an out-of-band operation. */ let OutOfBandPlatformOperationType = exports.OutOfBandPlatformOperationType = /*#__PURE__*/function (OutOfBandPlatformOperationType) { /** * Out-of-band registration. */ OutOfBandPlatformOperationType["registration"] = "REGISTRATION"; /** * Out-of-band authentication. */ OutOfBandPlatformOperationType["authentication"] = "AUTHENTICATION"; return OutOfBandPlatformOperationType; }({}); /** * Helps in following the states of out-of-band operations during method channel calls. */ class OutOfBandPlatformOperation extends _PlatformOperation.PlatformOperation { /** * The callback that will be invoked by the SDK with the {@link OutOfBandRegistration} object. */ /** * The callback that will be invoked by the SDK with the {@link OutOfBandAuthentication} object. */ constructor(operationId, subOperationId, onRegistration, onAuthentication) { super(); this.operationId = operationId; this.subOperationId = subOperationId; this.onRegistration = onRegistration; this.onAuthentication = onAuthentication; } /** * Provides a way to continue the out-of-band operation when the type of the operation turned out. * * @param type the operation type. */ selectOperation(type) { switch (type) { case OutOfBandPlatformOperationType.registration: { const registration = new _OutOfBandRegistration.OutOfBandRegistrationImpl(this.subOperationId); this.onRegistration?.(registration); break; } case OutOfBandPlatformOperationType.authentication: { const authentication = new _OutOfBandAuthentication.OutOfBandAuthenticationImpl(this.subOperationId); this.onAuthentication?.(authentication); break; } } } } exports.OutOfBandPlatformOperation = OutOfBandPlatformOperation; //# sourceMappingURL=OutOfBandPlatformOperation.js.map