UNPKG

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

Version:

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

46 lines (44 loc) 3.04 kB
"use strict"; /** * Copyright © 2023 Nevis Security AG. All rights reserved. */ import { OutOfBandOperationDeviceProtectionError } from "./OutOfBandOperationDeviceProtectionError.js"; import { OutOfBandOperationNetworkError } from "./OutOfBandOperationNetworkError.js"; import { OutOfBandOperationNoDeviceLockError } from "./OutOfBandOperationNoDeviceLockError.js"; import { OutOfBandOperationServerCanceledOperation } from "./OutOfBandOperationServerCanceledOperation.js"; import { OutOfBandOperationTokenAlreadyRedeemed } from "./OutOfBandOperationTokenAlreadyRedeemed.js"; import { OutOfBandOperationTokenExpired } from "./OutOfBandOperationTokenExpired.js"; import { OutOfBandOperationUnknownError } from "./OutOfBandOperationUnknownError.js"; import { ErrorConverter } from "../../ErrorConverter.js"; var OutOfBandOperationErrorType = /*#__PURE__*/function (OutOfBandOperationErrorType) { OutOfBandOperationErrorType[OutOfBandOperationErrorType["DeviceProtectionError"] = 0] = "DeviceProtectionError"; OutOfBandOperationErrorType[OutOfBandOperationErrorType["NetworkError"] = 1] = "NetworkError"; OutOfBandOperationErrorType[OutOfBandOperationErrorType["NoDeviceLockError"] = 2] = "NoDeviceLockError"; OutOfBandOperationErrorType[OutOfBandOperationErrorType["ServerCanceledOperation"] = 3] = "ServerCanceledOperation"; OutOfBandOperationErrorType[OutOfBandOperationErrorType["TokenAlreadyRedeemed"] = 4] = "TokenAlreadyRedeemed"; OutOfBandOperationErrorType[OutOfBandOperationErrorType["TokenExpired"] = 5] = "TokenExpired"; OutOfBandOperationErrorType[OutOfBandOperationErrorType["Unknown"] = 6] = "Unknown"; return OutOfBandOperationErrorType; }(OutOfBandOperationErrorType || {}); export class OutOfBandOperationErrorConverter extends ErrorConverter { convert() { const subtype = OutOfBandOperationErrorType[this.error.type]; switch (subtype) { case OutOfBandOperationErrorType.DeviceProtectionError: return new OutOfBandOperationDeviceProtectionError(this.error.description, this.error.cause); case OutOfBandOperationErrorType.NetworkError: return new OutOfBandOperationNetworkError(this.error.description, this.error.cause); case OutOfBandOperationErrorType.NoDeviceLockError: return new OutOfBandOperationNoDeviceLockError(this.error.description, this.error.cause); case OutOfBandOperationErrorType.ServerCanceledOperation: return new OutOfBandOperationServerCanceledOperation(this.error.description, this.error.cause); case OutOfBandOperationErrorType.TokenAlreadyRedeemed: return new OutOfBandOperationTokenAlreadyRedeemed(this.error.description, this.error.cause); case OutOfBandOperationErrorType.TokenExpired: return new OutOfBandOperationTokenExpired(this.error.description, this.error.cause); case OutOfBandOperationErrorType.Unknown: return new OutOfBandOperationUnknownError(this.error.description, this.error.cause); } } } //# sourceMappingURL=OutOfBandOperationErrorConverter.js.map