@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
41 lines (35 loc) • 1.17 kB
text/typescript
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
import { PlatformOperation } from './PlatformOperation';
import type { PendingOutOfBandOperationsResult } from '../../operations/outOfBand/PendingOutOfBandOperationsResult';
/**
* Helps in following the states of pending out-of-band operations during method
* channel calls.
*/
export class PendingOutOfBandPlatformOperation extends PlatformOperation {
operationId: string;
/**
* The callback that will be invoked by the SDK with the {@link PendingOutOfBandOperationsResult}
* containing the pending out-of-band operations for this application and the
* errors (if any).
*/
onResult?: (result: PendingOutOfBandOperationsResult) => void;
constructor(
operationId: string,
onResult?: (result: PendingOutOfBandOperationsResult) => void
) {
super();
this.operationId = operationId;
this.onResult = onResult;
}
/**
* Provides a way to handle the result of the pending out-of-band operations
* method channel call.
*
* @param result the result of the method channel call.
*/
handleResult(result: PendingOutOfBandOperationsResult) {
this.onResult?.(result);
}
}