@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
62 lines (61 loc) • 4.55 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DeviceInformationCheckErrorConverter = void 0;
var _DeviceInformationCheckClockSkewTooBigError = require("./DeviceInformationCheckClockSkewTooBigError");
var _DeviceInformationCheckDeviceProtectionError = require("./DeviceInformationCheckDeviceProtectionError");
var _DeviceInformationCheckForbidden = require("./DeviceInformationCheckForbidden");
var _DeviceInformationCheckNetworkError = require("./DeviceInformationCheckNetworkError");
var _DeviceInformationCheckNoDeviceLockError = require("./DeviceInformationCheckNoDeviceLockError");
var _DeviceInformationCheckOperationNotSupportedByBackendError = require("./DeviceInformationCheckOperationNotSupportedByBackendError");
var _DeviceInformationCheckUnknownError = require("./DeviceInformationCheckUnknownError");
var _ErrorConverter = require("../../ErrorConverter");
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
var DeviceInformationCheckErrorType = /*#__PURE__*/function (DeviceInformationCheckErrorType) {
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["ClockSkewTooBig"] = 0] = "ClockSkewTooBig";
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["DeviceProtectionError"] = 1] = "DeviceProtectionError";
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["Forbidden"] = 2] = "Forbidden";
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["NetworkError"] = 3] = "NetworkError";
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["NoDeviceLockError"] = 4] = "NoDeviceLockError";
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["OperationNotSupportedByBackend"] = 5] = "OperationNotSupportedByBackend";
DeviceInformationCheckErrorType[DeviceInformationCheckErrorType["Unknown"] = 6] = "Unknown";
return DeviceInformationCheckErrorType;
}(DeviceInformationCheckErrorType || {});
class DeviceInformationCheckErrorConverter extends _ErrorConverter.ErrorConverter {
convert() {
const subtype = DeviceInformationCheckErrorType[this.error.type];
switch (subtype) {
case DeviceInformationCheckErrorType.ClockSkewTooBig:
if (this.error.server) {
return new _DeviceInformationCheckClockSkewTooBigError.DeviceInformationCheckClockSkewTooBigError(this.error.server, this.error.description, this.error.cause);
}
return new _DeviceInformationCheckUnknownError.DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.DeviceProtectionError:
return new _DeviceInformationCheckDeviceProtectionError.DeviceInformationCheckDeviceProtectionError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.Forbidden:
if (this.error.server) {
return new _DeviceInformationCheckForbidden.DeviceInformationCheckForbidden(this.error.server, this.error.description, this.error.cause);
}
return new _DeviceInformationCheckUnknownError.DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.NetworkError:
if (this.error.server) {
return new _DeviceInformationCheckNetworkError.DeviceInformationCheckNetworkError(this.error.server, this.error.description, this.error.cause);
}
return new _DeviceInformationCheckUnknownError.DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.NoDeviceLockError:
return new _DeviceInformationCheckNoDeviceLockError.DeviceInformationCheckNoDeviceLockError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.OperationNotSupportedByBackend:
if (this.error.server) {
return new _DeviceInformationCheckOperationNotSupportedByBackendError.DeviceInformationCheckOperationNotSupportedByBackendError(this.error.server, this.error.description, this.error.cause);
}
return new _DeviceInformationCheckUnknownError.DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.Unknown:
return new _DeviceInformationCheckUnknownError.DeviceInformationCheckUnknownError(this.error.description, this.error.cause, this.error.server);
}
}
}
exports.DeviceInformationCheckErrorConverter = DeviceInformationCheckErrorConverter;
//# sourceMappingURL=DeviceInformationCheckErrorConverter.js.map