UNPKG

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

Version:

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

68 lines (61 loc) 2.16 kB
"use strict"; /** * Copyright © 2023-2024 Nevis Security AG. All rights reserved. */ import { PlatformOperation } from './PlatformOperation'; import { OutOfBandAuthenticationImpl } from '../../operations/outOfBand/OutOfBandAuthentication'; import { OutOfBandRegistrationImpl } from '../../operations/outOfBand/OutOfBandRegistration'; /** * Represents the eligible types of an out-of-band operation. */ export let 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. */ export class OutOfBandPlatformOperation extends 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 OutOfBandRegistrationImpl(this.subOperationId); this.onRegistration?.(registration); break; } case OutOfBandPlatformOperationType.authentication: { const authentication = new OutOfBandAuthenticationImpl(this.subOperationId); this.onAuthentication?.(authentication); break; } } } } //# sourceMappingURL=OutOfBandPlatformOperation.js.map