UNPKG

freerasp-react-native

Version:

React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.

36 lines (35 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.prepareRaspExecutionStateMapping = exports.getRaspExecutionStateIdentifiers = exports.getRaspExecutionStateChannelData = void 0; var _utils = require("../utils/utils"); var _nativeModules = require("../api/nativeModules"); var _native = require("../api/methods/native"); var _raspExecutionState = require("../models/raspExecutionState"); const getRaspExecutionStateIdentifiers = async () => { const identifiers = await _nativeModules.FreeraspReactNative.getRaspExecutionStateIdentifiers(); if (identifiers.length !== (0, _utils.getRaspExecutionStateCount)() || !(0, _utils.itemsHaveType)(identifiers, 'number')) { (0, _native.onInvalidCallback)(); } return identifiers; }; exports.getRaspExecutionStateIdentifiers = getRaspExecutionStateIdentifiers; const getRaspExecutionStateChannelData = async () => { const dataLength = 2; const data = await _nativeModules.FreeraspReactNative.getRaspExecutionStateChannelData(); if (data.length !== dataLength || !(0, _utils.itemsHaveType)(data, 'string')) { (0, _native.onInvalidCallback)(); } return data; }; exports.getRaspExecutionStateChannelData = getRaspExecutionStateChannelData; const prepareRaspExecutionStateMapping = async () => { const newValues = await getRaspExecutionStateIdentifiers(); const threats = _raspExecutionState.RaspExecutionState.getValues(); threats.map((threat, index) => { threat.value = newValues[index]; }); }; exports.prepareRaspExecutionStateMapping = prepareRaspExecutionStateMapping; //# sourceMappingURL=raspExecutionState.js.map