react-native-malwarelytics
Version:
Malwarelytics for React Native protects your banking or fintech app from a broad range of mobile security threats with an industry-leading mobile threat intelligence solution.
142 lines • 5.17 kB
TypeScript
import type { MalwarelyticsConfig } from "./MalwarelyticsConfig";
import { MalwarelyticsRasp } from "./MalwarelyticsRasp";
import { MalwarelyticsAntivirus } from "./MalwarelyticsAntivirus";
import { MalwarelyticsAppleDetectableApp } from "./MalwarelyticsConfig";
/**
* JavaScript wrapper around native kotlin/swift Malwarelytics code.
*/
export declare class Malwarelytics {
/**
* Contains shared instance of Malwarelytics class.
*/
static get sharedInstance(): Malwarelytics;
/**
* Get state of the Malwarelytics module.
*
* This function also updates content of `initializationResult` getter, if result
* is available.
*
* @returns State of the module.
*/
getState(): Promise<MalwarelyticsState>;
/**
* Apple specific: Obtain list of DetectableApp.KnownApp items that are predefined in native iOS library.
*
* @returns List of DetectableApp.KnownApp items.
*/
getKnownDetectableApps(): Promise<MalwarelyticsAppleDetectableApp[]>;
/**
* Initialize Malwarelytics instance with given configuration.
*
* Note that if you want to change the configuration on the running instance,
* then you have to `shutdown()` the instance first.
*
* @param configuration Configuration to apply.
*/
initialize(configuration: MalwarelyticsConfig): Promise<MalwarelyticsInitializationResult>;
/**
* Contains information about last initialization result.
*/
get initializationResult(): MalwarelyticsInitializationResult | undefined;
/**
* Shutdown the previously initialized Malwarelytics instance.
* @param clearAvUserId If `true`, then clears also persistent AV user ID, making the device appear as a newly created. The default value is `false`.
*/
shutdown(clearAvUserId?: boolean): Promise<void>;
/**
* Get information whether module is already initialized.
*/
isInitialized(): Promise<boolean>;
/**
* Sets new client id that will be sent to the backend for user identification.
* Pass `undefined` to remove the current client id (for example when user logged-out).
*
* @param clientId Client id, `undefied` for deleting the value
*/
setClientId(clientId: string | undefined): Promise<void>;
/**
* Sets new device id that will be sent to the backend for user identification.
* Pass `undefied` to remove the current device id.
*
* @param deviceId Device id, `undefied` for deleting the value
*/
setDeviceId(deviceId: string | undefined): Promise<void>;
/**
* Get AV User ID if it is available. The AV User ID will be available if the SDK initialized with
* result `SUCCESS`. Otherwise it might be undefined.
*/
getAvUserId(): Promise<string | undefined>;
/**
* Object representing a subscription to state events.
*/
private stateEventsSubscription;
/**
* Set listener for Malwarelytic's instance state changes.
* @param listener Listener implementation.
*/
setStateListener(listener: MalwarelyticsStateListener): Promise<void>;
/**
* Remove state listener previously set by `setStateListener()` method.
*/
removeStateListener(): void;
/**
* Instance of native module.
*/
private readonly nativeModule;
/**
* Instance of event helper.
*/
private readonly eventHelper;
/**
* RASP module
*/
readonly rasp: MalwarelyticsRasp;
/**
* Antivirus module
*/
readonly antivirus: MalwarelyticsAntivirus;
/**
* Shared instnace of this class.
*/
private static instance;
/**
* Last initialization result
*/
private lastInitializationResult;
/**
* Private constructor.
*/
private constructor();
/**
* Execute closure with action with properly acquired instnace to native module.
* @param action Action to execute.
* @returns Result returned from the action.
*/
private withModule;
}
/**
* Type defining the state of Malwarelytics module:
* - `"SHUTDOWN"` - Malwarelytics is not initialized.
* - `"PENDING_INIT"` - Malwarelytics is initializing.
* - `"READY"` - Malwarelytics is ready and prepared for use.
* - `"PENDING_SHUTDOWN"` - Malwarelytics is shutting down.
*/
export type MalwarelyticsState = 'SHUTDOWN' | 'PENDING_INIT' | 'READY' | 'PENDING_SHUTDOWN';
/**
* Type defining the result of Malwarelytics initialization.
* - `'SUCCESS'` - Initialization completed successfully
* - `'PERMANENT_OFFLINE_MODE'` - SDK works in permanent offline mode.
* - `'TEMPORARY_OFFLINE_MODE'` - Android only: SDK works in temporary offline mode.
*/
export type MalwarelyticsInitializationResult = 'SUCCESS' | 'TEMPORARY_OFFLINE_MODE' | 'PERMANENT_OFFLINE_MODE';
/**
* Interface for listening Malwarelytics module state changes.
*/
export interface MalwarelyticsStateListener {
/**
* Called when state of Malwarelytics module is changed.
* @param state New module's state.
*/
malwarelyticsStateChanged(state: MalwarelyticsState): void;
}
//# sourceMappingURL=Malwarelytics.d.ts.map