UNPKG

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

Version:

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

56 lines (49 loc) 1.94 kB
/** * Copyright © 2023 Nevis Security AG. All rights reserved. */ import { UserVerificationContext } from './UserVerificationContext'; import { Authenticator } from '../../localData/Authenticator'; import { PinAuthenticatorProtectionStatus } from '../pin/PinAuthenticatorProtectionStatus'; /** * The object providing information about the PIN 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 PinUserVerifier.verifyPin} */ export abstract class PinUserVerificationContext extends UserVerificationContext { /** * The authenticator protection status. */ abstract authenticatorProtectionStatus: PinAuthenticatorProtectionStatus; /** * Alternate constructor that creates a {@link UserVerificationContext} from a json. * * @param json contains the source for instance creation. * @returns the created {@link PinUserVerificationContext} instance. */ static fromJson(json: any): PinUserVerificationContext { return PinUserVerificationContextImpl.fromJson(json); } } export class PinUserVerificationContextImpl extends PinUserVerificationContext { authenticator: Authenticator; authenticatorProtectionStatus: PinAuthenticatorProtectionStatus; constructor( authenticator: Authenticator, authenticatorProtectionStatus: PinAuthenticatorProtectionStatus ) { super(); this.authenticator = authenticator; this.authenticatorProtectionStatus = authenticatorProtectionStatus; } static fromJson(json: any): PinUserVerificationContextImpl { const authenticator = Authenticator.fromJson(json.authenticator); const status = PinAuthenticatorProtectionStatus.fromJson( json.authenticatorProtectionStatus ); return new PinUserVerificationContextImpl(authenticator, status); } }