freerasp-react-native
Version:
React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.
35 lines (34 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.prepareThreatMapping = exports.getThreatIdentifiers = exports.getThreatChannelData = void 0;
var _utils = require("../utils/utils");
var _nativeModules = require("../api/nativeModules");
var _threat = require("../models/threat");
var _native = require("../api/methods/native");
const getThreatIdentifiers = async () => {
const identifiers = await _nativeModules.FreeraspReactNative.getThreatIdentifiers();
if (identifiers.length !== (0, _utils.getThreatCount)() || !(0, _utils.itemsHaveType)(identifiers, 'number')) {
(0, _native.onInvalidCallback)();
}
return identifiers;
};
exports.getThreatIdentifiers = getThreatIdentifiers;
const getThreatChannelData = async () => {
const data = await _nativeModules.FreeraspReactNative.getThreatChannelData();
if (data.length !== 3 || !(0, _utils.itemsHaveType)(data, 'string')) {
(0, _native.onInvalidCallback)();
}
return data;
};
exports.getThreatChannelData = getThreatChannelData;
const prepareThreatMapping = async () => {
const newValues = await getThreatIdentifiers();
const threats = _threat.Threat.getValues();
threats.map((threat, index) => {
threat.value = newValues[index];
});
};
exports.prepareThreatMapping = prepareThreatMapping;
//# sourceMappingURL=threat.js.map