@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
64 lines (60 loc) • 2.98 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PasswordUserVerificationContextImpl = exports.PasswordUserVerificationContext = void 0;
var _UserVerificationContext = require("./UserVerificationContext");
var _PasswordUserVerificationErrorConverter = require("../../error/userVerification/PasswordUserVerificationErrorConverter");
var _Authenticator = require("../../localData/Authenticator");
var _PasswordAuthenticatorProtectionStatus = require("../password/PasswordAuthenticatorProtectionStatus");
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
/**
* The object providing information about the password user verification
* (i.e. the user credential validation) operation to be done.
*
* This object contains the information required to ask the user to authenticate:
* the authenticator to be used, whether there were previous errors authenticating, etc.
*
* @see {@link PasswordUserVerifier.verifyPassword}
*/
class PasswordUserVerificationContext extends _UserVerificationContext.UserVerificationContext {
/**
* The authenticator protection status.
*/
/**
* When a recoverable error occurred during the last credential verification, it returns the
* object describing the last error.
*
* If present, this means that an invalid password was provided in the previous invocation to
* {@link PasswordUserVerificationHandler.verifyPassword} and thus the protection status is
* {@link PasswordProtectionStatusLastAttemptFailed}.
*/
/**
* Alternate constructor that creates a {@link UserVerificationContext} from a json.
*
* @param json contains the source for instance creation.
* @returns the created {@link PasswordUserVerificationContext} instance.
*/
static fromJson(json) {
return PasswordUserVerificationContextImpl.fromJson(json);
}
}
exports.PasswordUserVerificationContext = PasswordUserVerificationContext;
class PasswordUserVerificationContextImpl extends PasswordUserVerificationContext {
constructor(authenticator, authenticatorProtectionStatus, lastRecoverableError) {
super();
this.authenticator = authenticator;
this.authenticatorProtectionStatus = authenticatorProtectionStatus;
this.lastRecoverableError = lastRecoverableError;
}
static fromJson(json) {
const authenticator = _Authenticator.Authenticator.fromJson(json.authenticator);
const status = _PasswordAuthenticatorProtectionStatus.PasswordAuthenticatorProtectionStatus.fromJson(json.authenticatorProtectionStatus);
const lastRecoverableError = json.lastRecoverableError && new _PasswordUserVerificationErrorConverter.PasswordUserVerificationErrorConverter(json.lastRecoverableError).convert();
return new PasswordUserVerificationContextImpl(authenticator, status, lastRecoverableError);
}
}
exports.PasswordUserVerificationContextImpl = PasswordUserVerificationContextImpl;
//# sourceMappingURL=PasswordUserVerificationContext.js.map
;