@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
46 lines (41 loc) • 1.43 kB
JavaScript
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
import { PasswordEnrollmentErrorConverter } from '../../error/password/enrollment/PasswordEnrollmentErrorConverter';
/**
* The object providing some contextual information during password enrollment.
*
* @see {@link PasswordEnroller.enrollPassword}
*/
export class PasswordEnrollmentContext {
/**
* The username associated with the authenticator.
*/
/**
* When a recoverable error occurred during the last password enrollment, this method returns the
* object describing the last error.
*/
/**
* Alternate constructor that creates an instance from a json.
*
* @param json contains the source for instance creation.
* @returns the created instance.
*/
static fromJson(json) {
return PasswordEnrollmentContextImpl.fromJson(json);
}
}
class PasswordEnrollmentContextImpl extends PasswordEnrollmentContext {
constructor(username, lastRecoverableError) {
super();
this.username = username;
this.lastRecoverableError = lastRecoverableError;
}
static fromJson(json) {
const username = json.username;
const lastRecoverableError = json.lastRecoverableError && new PasswordEnrollmentErrorConverter(json.lastRecoverableError).convert();
return new PasswordEnrollmentContextImpl(username, lastRecoverableError);
}
}
//# sourceMappingURL=PasswordEnrollmentContext.js.map
;