@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
97 lines • 3.28 kB
TypeScript
/**
* Copyright © 2023-2024 Nevis Security AG. All rights reserved.
*/
import type { PinChanger } from './PinChanger';
import type { PinChangeError } from '../../error/pin/change/PinChangeError';
import { Operation } from '../Operation';
/**
* The object that can be used to change the PIN.
*
* Usage example:
* ```ts
* class PinChangerImpl implements PinChanger {
* async changePin(context: PinChangeContext, handler: PinChangeHandler) {
* handler.pins(oldPin, newPin);
* }
* }
*
* [...]
* async changePin({
* client: MobileAuthenticationClient,
* username: string,
* }): Promise<void> {
* await client.operations.pinChange
* .username(username)
* .pinChanger(PinChangerImpl(...))
* .onSuccess(() {
* // handle success
* })
* .onError((error) {
* // handle error
* })
* .execute();
* }
* [...]
* ```
*/
export declare abstract class PinChange extends Operation {
/**
* The username whose PIN must be changed.
*
* **IMPORTANT** \
* Providing the {@link username} is required.
*
* **WARNING** \
* The username is the technical user identifier stored in the {@link Account.username} property.
* Do not provide the login identifier (for example the users e-mail address) here.
* We recommend always using the username provided via {@link LocalData.accounts}.
*
* @param username the username.
* @returns a {@link PinChange} object.
*/
abstract username(username: string): PinChange;
/**
* Specifies the object that will be informed of the potential recoverable
* errors and is responsible for obtaining the PIN from the end-user.
*
* **IMPORTANT** \
* Providing the {@link pinChanger} is required.
*
* @param pinChanger the {@link PinChanger}
* @returns a {@link PinChange} object.
*/
abstract pinChanger(pinChanger: PinChanger): PinChange;
/**
* Specifies the object that will be invoked if the PIN was successfully modified.
*
* **IMPORTANT** \
* Providing the {@link onSuccess} is required.
*
* @param onSuccess the callback which is invoked on successful PIN modification.
* @returns a {@link PinChange} object.
*/
abstract onSuccess(onSuccess: () => void): PinChange;
/**
* Specifies the object that will be invoked when the PIN could not be changed:
* the PIN was not enrolled, the PIN is locked or the operation was canceled.
*
* **IMPORTANT** \
* Providing the {@link onError} is required.
*
* @param onError the callback which receives a {@link PinChangeError}.
* @returns a {@link PinChange} object.
*/
abstract onError(onError: (error: PinChangeError) => void): PinChange;
}
export declare class PinChangeImpl extends PinChange {
private _username?;
private _pinChanger?;
private _onSuccess?;
private _onError?;
username(username: string): PinChange;
pinChanger(pinChanger: PinChanger): PinChange;
onSuccess(onSuccess: () => void): PinChange;
onError(onError: (error: PinChangeError) => void): PinChange;
execute(): Promise<void>;
}
//# sourceMappingURL=PinChange.d.ts.map