freerasp-react-native
Version:
React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.
27 lines • 1.15 kB
JavaScript
import { getRaspExecutionStateCount, itemsHaveType } from '../utils/utils';
import { FreeraspReactNative } from '../api/nativeModules';
import { onInvalidCallback } from '../api/methods/native';
import { RaspExecutionState } from '../models/raspExecutionState';
export const getRaspExecutionStateIdentifiers = async () => {
const identifiers = await FreeraspReactNative.getRaspExecutionStateIdentifiers();
if (identifiers.length !== getRaspExecutionStateCount() || !itemsHaveType(identifiers, 'number')) {
onInvalidCallback();
}
return identifiers;
};
export const getRaspExecutionStateChannelData = async () => {
const dataLength = 2;
const data = await FreeraspReactNative.getRaspExecutionStateChannelData();
if (data.length !== dataLength || !itemsHaveType(data, 'string')) {
onInvalidCallback();
}
return data;
};
export const prepareRaspExecutionStateMapping = async () => {
const newValues = await getRaspExecutionStateIdentifiers();
const threats = RaspExecutionState.getValues();
threats.map((threat, index) => {
threat.value = newValues[index];
});
};
//# sourceMappingURL=raspExecutionState.js.map