UNPKG

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

Version:

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

51 lines (49 loc) 3.23 kB
"use strict"; /** * Copyright © 2023 Nevis Security AG. All rights reserved. */ import { AuthenticationAppAttestationError } from "./AuthenticationAppAttestationError.js"; import { AuthenticationDeviceProtectionError } from "./AuthenticationDeviceProtectionError.js"; import { AuthenticationFidoError } from "./AuthenticationFidoError.js"; import { AuthenticationNetworkError } from "./AuthenticationNetworkError.js"; import { AuthenticationNoDeviceLockError } from "./AuthenticationNoDeviceLockError.js"; import { AuthenticationServerCanceledOperation } from "./AuthenticationServerCanceledOperation.js"; import { AuthenticationUnknownError } from "./AuthenticationUnknownError.js"; import { ErrorConverter } from "../ErrorConverter.js"; var AuthenticationErrorType = /*#__PURE__*/function (AuthenticationErrorType) { AuthenticationErrorType[AuthenticationErrorType["AppAttestationError"] = 0] = "AppAttestationError"; AuthenticationErrorType[AuthenticationErrorType["DeviceProtectionError"] = 1] = "DeviceProtectionError"; AuthenticationErrorType[AuthenticationErrorType["FidoError"] = 2] = "FidoError"; AuthenticationErrorType[AuthenticationErrorType["NetworkError"] = 3] = "NetworkError"; AuthenticationErrorType[AuthenticationErrorType["NoDeviceLockError"] = 4] = "NoDeviceLockError"; AuthenticationErrorType[AuthenticationErrorType["ServerCanceledOperation"] = 5] = "ServerCanceledOperation"; AuthenticationErrorType[AuthenticationErrorType["Unknown"] = 6] = "Unknown"; return AuthenticationErrorType; }(AuthenticationErrorType || {}); export class AuthenticationErrorConverter extends ErrorConverter { convert() { const subtype = AuthenticationErrorType[this.error.type]; switch (subtype) { case AuthenticationErrorType.AppAttestationError: return new AuthenticationAppAttestationError(this.error.description, this.error.cause, this.error.sessionProvider); case AuthenticationErrorType.DeviceProtectionError: return new AuthenticationDeviceProtectionError(this.error.description, this.error.cause, this.error.sessionProvider); case AuthenticationErrorType.FidoError: { if (this.error.errorCode) { return new AuthenticationFidoError(this.error.errorCode, this.error.description, this.error.cause, this.error.sessionProvider); } return new AuthenticationUnknownError(this.error.description, this.error.cause, this.error.sessionProvider); } case AuthenticationErrorType.NetworkError: return new AuthenticationNetworkError(this.error.description, this.error.cause, this.error.sessionProvider); case AuthenticationErrorType.NoDeviceLockError: return new AuthenticationNoDeviceLockError(this.error.description, this.error.cause, this.error.sessionProvider); case AuthenticationErrorType.ServerCanceledOperation: return new AuthenticationServerCanceledOperation(this.error.description, this.error.cause, this.error.sessionProvider); case AuthenticationErrorType.Unknown: return new AuthenticationUnknownError(this.error.description, this.error.cause, this.error.sessionProvider); } } } //# sourceMappingURL=AuthenticationErrorConverter.js.map