@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
58 lines (53 loc) • 2.15 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PasswordChangeContextImpl = exports.PasswordChangeContext = void 0;
var _PasswordAuthenticatorProtectionStatus = require("./PasswordAuthenticatorProtectionStatus");
var _PasswordChangeRecoverableErrorConverter = require("../../error/password/change/PasswordChangeRecoverableErrorConverter");
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
/**
* The object providing some contextual information during password change.
*
* @see {@link PasswordChanger.changePassword}
*/
class PasswordChangeContext {
/**
* The username whose password must be changed.
*/
/**
* The object describing the password protection status (whether is locked, in
* cool-down mode, etc.).
*/
/**
* The object describing the latest recoverable error (if any).
*/
/**
* Alternate constructor that creates a {@link PasswordChangeContext} from a json.
*
* @param json contains the source for instance creation.
* @returns the created {@link PasswordChangeContext} instance.
*/
static fromJson(json) {
return PasswordChangeContextImpl.fromJson(json);
}
}
exports.PasswordChangeContext = PasswordChangeContext;
class PasswordChangeContextImpl extends PasswordChangeContext {
constructor(username, authenticatorProtectionStatus, lastRecoverableError) {
super();
this.username = username;
this.authenticatorProtectionStatus = authenticatorProtectionStatus;
this.lastRecoverableError = lastRecoverableError;
}
static fromJson(json) {
const username = json.username;
const status = _PasswordAuthenticatorProtectionStatus.PasswordAuthenticatorProtectionStatus.fromJson(json.authenticatorProtectionStatus);
const lastRecoverableError = json.lastRecoverableError && new _PasswordChangeRecoverableErrorConverter.PasswordChangeRecoverableErrorConverter(json.lastRecoverableError).convert();
return new PasswordChangeContextImpl(username, status, lastRecoverableError);
}
}
exports.PasswordChangeContextImpl = PasswordChangeContextImpl;
//# sourceMappingURL=PasswordChangeContext.js.map
;