@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
58 lines (56 loc) • 3.9 kB
JavaScript
"use strict";
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
import { DeviceInformationCheckClockSkewTooBigError } from './DeviceInformationCheckClockSkewTooBigError';
import { DeviceInformationCheckDeviceProtectionError } from './DeviceInformationCheckDeviceProtectionError';
import { DeviceInformationCheckForbidden } from './DeviceInformationCheckForbidden';
import { DeviceInformationCheckNetworkError } from './DeviceInformationCheckNetworkError';
import { DeviceInformationCheckNoDeviceLockError } from './DeviceInformationCheckNoDeviceLockError';
import { DeviceInformationCheckOperationNotSupportedByBackendError } from './DeviceInformationCheckOperationNotSupportedByBackendError';
import { DeviceInformationCheckUnknownError } from './DeviceInformationCheckUnknownError';
import { ErrorConverter } from '../../ErrorConverter';
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 || {});
export class DeviceInformationCheckErrorConverter extends ErrorConverter {
convert() {
const subtype = DeviceInformationCheckErrorType[this.error.type];
switch (subtype) {
case DeviceInformationCheckErrorType.ClockSkewTooBig:
if (this.error.server) {
return new DeviceInformationCheckClockSkewTooBigError(this.error.server, this.error.description, this.error.cause);
}
return new DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.DeviceProtectionError:
return new DeviceInformationCheckDeviceProtectionError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.Forbidden:
if (this.error.server) {
return new DeviceInformationCheckForbidden(this.error.server, this.error.description, this.error.cause);
}
return new DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.NetworkError:
if (this.error.server) {
return new DeviceInformationCheckNetworkError(this.error.server, this.error.description, this.error.cause);
}
return new DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.NoDeviceLockError:
return new DeviceInformationCheckNoDeviceLockError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.OperationNotSupportedByBackend:
if (this.error.server) {
return new DeviceInformationCheckOperationNotSupportedByBackendError(this.error.server, this.error.description, this.error.cause);
}
return new DeviceInformationCheckUnknownError(this.error.description, this.error.cause);
case DeviceInformationCheckErrorType.Unknown:
return new DeviceInformationCheckUnknownError(this.error.description, this.error.cause, this.error.server);
}
}
}
//# sourceMappingURL=DeviceInformationCheckErrorConverter.js.map