@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
53 lines (47 loc) • 1.83 kB
JavaScript
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
import { PasswordAuthenticatorProtectionStatus } from './PasswordAuthenticatorProtectionStatus';
import { PasswordChangeRecoverableErrorConverter } from '../../error/password/change/PasswordChangeRecoverableErrorConverter';
/**
* The object providing some contextual information during password change.
*
* @see {@link PasswordChanger.changePassword}
*/
export 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);
}
}
export 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.fromJson(json.authenticatorProtectionStatus);
const lastRecoverableError = json.lastRecoverableError && new PasswordChangeRecoverableErrorConverter(json.lastRecoverableError).convert();
return new PasswordChangeContextImpl(username, status, lastRecoverableError);
}
}
//# sourceMappingURL=PasswordChangeContext.js.map
;