UNPKG

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

Version:

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

125 lines (119 loc) 5.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PinProtectionStatusUnlockedImpl = exports.PinProtectionStatusUnlocked = exports.PinProtectionStatusLockedOutImpl = exports.PinProtectionStatusLockedOut = exports.PinProtectionStatusLastAttemptFailedImpl = exports.PinProtectionStatusLastAttemptFailed = exports.PinAuthenticatorProtectionStatus = void 0; /** * Copyright © 2023 Nevis Security AG. All rights reserved. */ var PinAuthenticatorProtectionStatusType = /*#__PURE__*/function (PinAuthenticatorProtectionStatusType) { PinAuthenticatorProtectionStatusType[PinAuthenticatorProtectionStatusType["Unlocked"] = 0] = "Unlocked"; PinAuthenticatorProtectionStatusType[PinAuthenticatorProtectionStatusType["LastAttemptFailed"] = 1] = "LastAttemptFailed"; PinAuthenticatorProtectionStatusType[PinAuthenticatorProtectionStatusType["LockedOut"] = 2] = "LockedOut"; return PinAuthenticatorProtectionStatusType; }(PinAuthenticatorProtectionStatusType || {}); /** * The object describing the PIN authenticator protection status. * * It provides information regarding how many retries are available for the end user before locking * the authenticator. */ class PinAuthenticatorProtectionStatus { /** * Alternate constructor that creates a {@link PinAuthenticatorProtectionStatus} from a json. * * @param json contains the source for instance creation. * @returns a {@link PinAuthenticatorProtectionStatus} instance. */ static fromJson(json) { const subtype = PinAuthenticatorProtectionStatusType[json.type]; switch (subtype) { case PinAuthenticatorProtectionStatusType.Unlocked: return PinProtectionStatusUnlocked.fromJson(); case PinAuthenticatorProtectionStatusType.LastAttemptFailed: return PinProtectionStatusLastAttemptFailed.fromJson(json.data); case PinAuthenticatorProtectionStatusType.LockedOut: return PinProtectionStatusLockedOut.fromJson(); default: throw new Error(`Unknown pin authenticator protection status (${json.type}).`); } } } /** * The authenticator is unlocked and can be used. */ exports.PinAuthenticatorProtectionStatus = PinAuthenticatorProtectionStatus; class PinProtectionStatusUnlocked extends PinAuthenticatorProtectionStatus { /** * Alternate constructor that creates a {@link PinProtectionStatusUnlocked} from a json. * * @returns the created {@link PinProtectionStatusUnlocked} instance. */ static fromJson() { return PinProtectionStatusUnlockedImpl.fromJson(); } } exports.PinProtectionStatusUnlocked = PinProtectionStatusUnlocked; class PinProtectionStatusUnlockedImpl extends PinProtectionStatusUnlocked { static fromJson() { return new PinProtectionStatusUnlockedImpl(); } } /** * An invalid PIN was provided previously. * * This may imply that an attacker is trying to use the PIN authenticator. */ exports.PinProtectionStatusUnlockedImpl = PinProtectionStatusUnlockedImpl; class PinProtectionStatusLastAttemptFailed extends PinAuthenticatorProtectionStatus { /** * The number of remaining retries available. */ /** * The time that must be passed before the user can try to provide credentials again. * If the value is 0, it means that no cool-down is required, and that a new PIN can * be provided immediately. */ /** * Alternate constructor that creates a {@link PinProtectionStatusLastAttemptFailed} from a json. * * @param json contains the source for instance creation. * @returns the created {@link PinProtectionStatusLastAttemptFailed} instance. */ static fromJson(json) { return PinProtectionStatusLastAttemptFailedImpl.fromJson(json); } } exports.PinProtectionStatusLastAttemptFailed = PinProtectionStatusLastAttemptFailed; class PinProtectionStatusLastAttemptFailedImpl extends PinProtectionStatusLastAttemptFailed { constructor(remainingRetries, coolDownTimeInSec) { super(); this.remainingRetries = remainingRetries; this.coolDownTimeInSec = coolDownTimeInSec; } static fromJson(json) { return new PinProtectionStatusLastAttemptFailedImpl(json.remainingRetries, json.coolDownTimeInSec); } } /** * The authenticator is locked and cannot be used. */ exports.PinProtectionStatusLastAttemptFailedImpl = PinProtectionStatusLastAttemptFailedImpl; class PinProtectionStatusLockedOut extends PinAuthenticatorProtectionStatus { /** * Alternate constructor that creates a {@link PinProtectionStatusLockedOut} from a json. * * @returns the created {@link PinProtectionStatusLockedOut} instance. */ static fromJson() { return PinProtectionStatusLockedOutImpl.fromJson(); } } exports.PinProtectionStatusLockedOut = PinProtectionStatusLockedOut; class PinProtectionStatusLockedOutImpl extends PinProtectionStatusLockedOut { static fromJson() { return new PinProtectionStatusLockedOutImpl(); } } exports.PinProtectionStatusLockedOutImpl = PinProtectionStatusLockedOutImpl; //# sourceMappingURL=PinAuthenticatorProtectionStatus.js.map