freerasp-react-native 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -19
- package/android/build.gradle +3 -2
- package/android/gradle.properties +2 -1
- package/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +58 -48
- package/android/src/main/java/com/freeraspreactnative/FreeraspThreatHandler.kt +52 -0
- package/android/src/main/java/com/freeraspreactnative/Threat.kt +44 -0
- package/ios/FreeraspReactNative.m +8 -1
- package/ios/FreeraspReactNative.swift +82 -13
- package/ios/TalsecRuntime.xcframework/Info.plist +5 -5
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +2 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.abi.json +142 -160
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios.swiftinterface +3 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/CurlWrapper.h +1 -1
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Headers/TalsecRuntime-Swift.h +4 -4
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Info.plist +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json +142 -160
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json +142 -160
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -2
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/TalsecRuntime +0 -0
- package/ios/TalsecRuntime.xcframework/ios-arm64_x86_64-simulator/TalsecRuntime.framework/_CodeSignature/CodeResources +25 -25
- package/lib/commonjs/definitions.js +32 -0
- package/lib/commonjs/definitions.js.map +1 -0
- package/lib/commonjs/index.js +83 -20
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +16 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/definitions.js +25 -0
- package/lib/module/definitions.js.map +1 -0
- package/lib/module/index.js +84 -21
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +8 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/definitions.d.ts +43 -0
- package/lib/typescript/definitions.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -32
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +3 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/definitions.ts +77 -0
- package/src/index.tsx +93 -60
- package/src/utils.ts +9 -0
- package/android/src/main/java/com/freeraspreactnative/FreeraspDeviceStateListener.kt +0 -25
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// swift-interface-format-version: 1.0
|
|
2
|
-
// swift-compiler-version: Apple Swift version 5.8 (swiftlang-5.8.0.124.
|
|
3
|
-
// swift-module-flags: -target x86_64-apple-
|
|
2
|
+
// swift-compiler-version: Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
|
|
3
|
+
// swift-module-flags: -target x86_64-apple-ios13.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name TalsecRuntime
|
|
4
4
|
// swift-module-flags-ignorable: -enable-bare-slash-regex
|
|
5
|
+
import CryptoKit
|
|
5
6
|
import Foundation
|
|
6
7
|
import LocalAuthentication
|
|
7
8
|
import TalsecRuntime.Private
|
|
Binary file
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// swift-interface-format-version: 1.0
|
|
2
|
-
// swift-compiler-version: Apple Swift version 5.8 (swiftlang-5.8.0.124.
|
|
3
|
-
// swift-module-flags: -target x86_64-apple-
|
|
2
|
+
// swift-compiler-version: Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
|
|
3
|
+
// swift-module-flags: -target x86_64-apple-ios13.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name TalsecRuntime
|
|
4
4
|
// swift-module-flags-ignorable: -enable-bare-slash-regex
|
|
5
|
+
import CryptoKit
|
|
5
6
|
import Foundation
|
|
6
7
|
import LocalAuthentication
|
|
7
8
|
import TalsecRuntime.Private
|
|
Binary file
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/CurlWrapper.h</key>
|
|
12
12
|
<data>
|
|
13
|
-
|
|
13
|
+
KcY0bJ6+vxlligYtvx38ttTGDyg=
|
|
14
14
|
</data>
|
|
15
15
|
<key>Headers/TalsecRuntime-Swift.h</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
31Chz21Xvwhpz52yK+6MkCDP95Y=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Headers/TalsecRuntime_iOS.h</key>
|
|
20
20
|
<data>
|
|
@@ -58,47 +58,47 @@
|
|
|
58
58
|
</data>
|
|
59
59
|
<key>Info.plist</key>
|
|
60
60
|
<data>
|
|
61
|
-
|
|
61
|
+
rJKT1T8xeneLKrThBXJKvJb91wk=
|
|
62
62
|
</data>
|
|
63
63
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
64
64
|
<data>
|
|
65
|
-
|
|
65
|
+
qQcLhCa772j9c8ELG0w4YQ7tnco=
|
|
66
66
|
</data>
|
|
67
67
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
68
68
|
<data>
|
|
69
|
-
|
|
69
|
+
ZLzzSXxSUv3YQolHNN32P63d4vY=
|
|
70
70
|
</data>
|
|
71
71
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
72
72
|
<data>
|
|
73
|
-
|
|
73
|
+
bEsIPa2Qphg9zXAsTwKdEEs4gUY=
|
|
74
74
|
</data>
|
|
75
75
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
76
76
|
<data>
|
|
77
|
-
|
|
77
|
+
ZLzzSXxSUv3YQolHNN32P63d4vY=
|
|
78
78
|
</data>
|
|
79
79
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
80
80
|
<data>
|
|
81
|
-
|
|
81
|
+
xQYcX8haKwdJ1onRy7zciVQxr/8=
|
|
82
82
|
</data>
|
|
83
83
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
84
84
|
<data>
|
|
85
|
-
|
|
85
|
+
qQcLhCa772j9c8ELG0w4YQ7tnco=
|
|
86
86
|
</data>
|
|
87
87
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
88
88
|
<data>
|
|
89
|
-
|
|
89
|
+
xjQ8CnTWnIaXK0hQYG3Or+Ih43w=
|
|
90
90
|
</data>
|
|
91
91
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
92
92
|
<data>
|
|
93
|
-
|
|
93
|
+
Q2tZeB9R4GCBD9JBGzR4ly7W+XM=
|
|
94
94
|
</data>
|
|
95
95
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
96
96
|
<data>
|
|
97
|
-
|
|
97
|
+
xjQ8CnTWnIaXK0hQYG3Or+Ih43w=
|
|
98
98
|
</data>
|
|
99
99
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
100
100
|
<data>
|
|
101
|
-
|
|
101
|
+
fNeWrv5cFXPPIxqP7y56uyPoLsc=
|
|
102
102
|
</data>
|
|
103
103
|
<key>Modules/module.modulemap</key>
|
|
104
104
|
<data>
|
|
@@ -126,14 +126,14 @@
|
|
|
126
126
|
<dict>
|
|
127
127
|
<key>hash2</key>
|
|
128
128
|
<data>
|
|
129
|
-
|
|
129
|
+
OLx4GSbZPRyV+x4Z9ujJL00S7KXv6r0bpIJvcmIDbhs=
|
|
130
130
|
</data>
|
|
131
131
|
</dict>
|
|
132
132
|
<key>Headers/TalsecRuntime-Swift.h</key>
|
|
133
133
|
<dict>
|
|
134
134
|
<key>hash2</key>
|
|
135
135
|
<data>
|
|
136
|
-
|
|
136
|
+
Voll7kZ6JlhPY7uDo8kBPvhhdEP9me9x0yL6nWLQch0=
|
|
137
137
|
</data>
|
|
138
138
|
</dict>
|
|
139
139
|
<key>Headers/TalsecRuntime_iOS.h</key>
|
|
@@ -210,70 +210,70 @@
|
|
|
210
210
|
<dict>
|
|
211
211
|
<key>hash2</key>
|
|
212
212
|
<data>
|
|
213
|
-
|
|
213
|
+
wWfPTqdQKTvgYfr4HTDep65I1WAFgw7uBtM47b8wBK8=
|
|
214
214
|
</data>
|
|
215
215
|
</dict>
|
|
216
216
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
217
217
|
<dict>
|
|
218
218
|
<key>hash2</key>
|
|
219
219
|
<data>
|
|
220
|
-
|
|
220
|
+
n14bh0R0iY3Aamq/B1lr9+otBItf+Pgdj+g/4x/XjrQ=
|
|
221
221
|
</data>
|
|
222
222
|
</dict>
|
|
223
223
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
224
224
|
<dict>
|
|
225
225
|
<key>hash2</key>
|
|
226
226
|
<data>
|
|
227
|
-
|
|
227
|
+
KUTEQbZMYvJtxtbHL3hmTjf1q37Efj6x8yiU/Vy0Kt8=
|
|
228
228
|
</data>
|
|
229
229
|
</dict>
|
|
230
230
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
231
231
|
<dict>
|
|
232
232
|
<key>hash2</key>
|
|
233
233
|
<data>
|
|
234
|
-
|
|
234
|
+
n14bh0R0iY3Aamq/B1lr9+otBItf+Pgdj+g/4x/XjrQ=
|
|
235
235
|
</data>
|
|
236
236
|
</dict>
|
|
237
237
|
<key>Modules/TalsecRuntime.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
238
238
|
<dict>
|
|
239
239
|
<key>hash2</key>
|
|
240
240
|
<data>
|
|
241
|
-
|
|
241
|
+
/3UXTpNp7UH2NjtVc5r+AKQmM2p9xceAWv0fLbbuvPc=
|
|
242
242
|
</data>
|
|
243
243
|
</dict>
|
|
244
244
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
245
245
|
<dict>
|
|
246
246
|
<key>hash2</key>
|
|
247
247
|
<data>
|
|
248
|
-
|
|
248
|
+
wWfPTqdQKTvgYfr4HTDep65I1WAFgw7uBtM47b8wBK8=
|
|
249
249
|
</data>
|
|
250
250
|
</dict>
|
|
251
251
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
252
252
|
<dict>
|
|
253
253
|
<key>hash2</key>
|
|
254
254
|
<data>
|
|
255
|
-
|
|
255
|
+
SPjtSdC8RxisbjPRZ4SSI9tQ7qIUJ3nhBM8lAgE3LPw=
|
|
256
256
|
</data>
|
|
257
257
|
</dict>
|
|
258
258
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
259
259
|
<dict>
|
|
260
260
|
<key>hash2</key>
|
|
261
261
|
<data>
|
|
262
|
-
|
|
262
|
+
j2EG9fF3KqoqbfqPwPcserKQGRVySb9tGxYJHK2H43E=
|
|
263
263
|
</data>
|
|
264
264
|
</dict>
|
|
265
265
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
266
266
|
<dict>
|
|
267
267
|
<key>hash2</key>
|
|
268
268
|
<data>
|
|
269
|
-
|
|
269
|
+
SPjtSdC8RxisbjPRZ4SSI9tQ7qIUJ3nhBM8lAgE3LPw=
|
|
270
270
|
</data>
|
|
271
271
|
</dict>
|
|
272
272
|
<key>Modules/TalsecRuntime.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
273
273
|
<dict>
|
|
274
274
|
<key>hash2</key>
|
|
275
275
|
<data>
|
|
276
|
-
|
|
276
|
+
1cnSeaSEL7iUb0hrNA60O/0qobenQPd/h1NN0zE1GC8=
|
|
277
277
|
</data>
|
|
278
278
|
</dict>
|
|
279
279
|
<key>Modules/module.modulemap</key>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Threat = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
|
+
class Threat {
|
|
12
|
+
constructor(value) {
|
|
13
|
+
_defineProperty(this, "value", void 0);
|
|
14
|
+
this.value = value;
|
|
15
|
+
}
|
|
16
|
+
static getValues() {
|
|
17
|
+
return _reactNative.Platform.OS === 'android' ? [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.DeviceBinding, this.UnofficialStore, this.ObfuscationIssues] : [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.DeviceBinding, this.DeviceID, this.UnofficialStore];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Threat = Threat;
|
|
21
|
+
_defineProperty(Threat, "AppIntegrity", new Threat(0));
|
|
22
|
+
_defineProperty(Threat, "PrivilegedAccess", new Threat(0));
|
|
23
|
+
_defineProperty(Threat, "Debug", new Threat(0));
|
|
24
|
+
_defineProperty(Threat, "Hooks", new Threat(0));
|
|
25
|
+
_defineProperty(Threat, "Passcode", new Threat(0));
|
|
26
|
+
_defineProperty(Threat, "Simulator", new Threat(0));
|
|
27
|
+
_defineProperty(Threat, "SecureHardwareNotAvailable", new Threat(0));
|
|
28
|
+
_defineProperty(Threat, "DeviceBinding", new Threat(0));
|
|
29
|
+
_defineProperty(Threat, "DeviceID", new Threat(0));
|
|
30
|
+
_defineProperty(Threat, "UnofficialStore", new Threat(0));
|
|
31
|
+
_defineProperty(Threat, "ObfuscationIssues", new Threat(0));
|
|
32
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Threat","constructor","value","getValues","Platform","OS","AppIntegrity","PrivilegedAccess","Debug","Hooks","Passcode","Simulator","SecureHardwareNotAvailable","DeviceBinding","UnofficialStore","ObfuscationIssues","DeviceID"],"sourceRoot":"../../src","sources":["definitions.ts"],"mappings":";;;;;;AAAA;AAAwC;AAAA;AAAA;AA8BjC,MAAMA,MAAM,CAAC;EAelBC,WAAW,CAACC,KAAa,EAAE;IAAA;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEA,OAAOC,SAAS,GAAa;IAC3B,OAAOC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAC5B,CACE,IAAI,CAACC,YAAY,EACjB,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,0BAA0B,EAC/B,IAAI,CAACC,aAAa,EAClB,IAAI,CAACC,eAAe,EACpB,IAAI,CAACC,iBAAiB,CACvB,GACD,CACE,IAAI,CAACT,YAAY,EACjB,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,0BAA0B,EAC/B,IAAI,CAACC,aAAa,EAClB,IAAI,CAACG,QAAQ,EACb,IAAI,CAACF,eAAe,CACrB;EACP;AACF;AAAC;AAAA,gBA9CYd,MAAM,kBAGK,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAHxBA,MAAM,sBAIS,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAJ5BA,MAAM,WAKF,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBALjBA,MAAM,WAMF,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBANjBA,MAAM,cAOC,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAPpBA,MAAM,eAQE,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBARrBA,MAAM,gCASmB,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBATtCA,MAAM,mBAUM,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAVzBA,MAAM,cAWC,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAXpBA,MAAM,qBAYQ,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAZ3BA,MAAM,uBAaU,IAAIA,MAAM,CAAC,CAAC,CAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -6,41 +6,104 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useFreeRasp = exports.talsecStart = exports.setThreatListeners = exports.removeThreatListeners = exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _definitions = require("./definitions");
|
|
10
|
+
var _utils = require("./utils");
|
|
9
11
|
const {
|
|
10
12
|
FreeraspReactNative
|
|
11
13
|
} = _reactNative.NativeModules;
|
|
12
14
|
const eventEmitter = new _reactNative.NativeEventEmitter(FreeraspReactNative);
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
let eventsListener;
|
|
16
|
+
const onInvalidCallback = () => {
|
|
17
|
+
FreeraspReactNative.onInvalidCallback();
|
|
18
|
+
};
|
|
19
|
+
const getThreatIdentifiers = async () => {
|
|
20
|
+
let identifiers = await FreeraspReactNative.getThreatIdentifiers();
|
|
21
|
+
if (identifiers.length !== (0, _utils.getThreatCount)() || !(0, _utils.itemsHaveType)(identifiers, 'number')) {
|
|
22
|
+
onInvalidCallback();
|
|
23
|
+
}
|
|
24
|
+
return identifiers;
|
|
25
|
+
};
|
|
26
|
+
const getThreatChannelData = async () => {
|
|
27
|
+
let data = await FreeraspReactNative.getThreatChannelData();
|
|
28
|
+
if (data.length !== 2 || !(0, _utils.itemsHaveType)(data, 'string')) {
|
|
29
|
+
onInvalidCallback();
|
|
26
30
|
}
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
const prepareMapping = async () => {
|
|
34
|
+
const newValues = await getThreatIdentifiers();
|
|
35
|
+
const threats = _definitions.Threat.getValues();
|
|
36
|
+
threats.map((threat, index) => {
|
|
37
|
+
threat.value = newValues[index];
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const setThreatListeners = async config => {
|
|
41
|
+
const [channel, key] = await getThreatChannelData();
|
|
42
|
+
await prepareMapping();
|
|
43
|
+
eventsListener = eventEmitter.addListener(channel, event => {
|
|
44
|
+
var _config$privilegedAcc, _config$debug, _config$simulator, _config$appIntegrity, _config$unofficialSto, _config$hooks, _config$deviceBinding, _config$passcode, _config$secureHardwar, _config$obfuscationIs;
|
|
45
|
+
if (event[key] === undefined) {
|
|
46
|
+
onInvalidCallback();
|
|
47
|
+
}
|
|
48
|
+
switch (event[key]) {
|
|
49
|
+
case _definitions.Threat.PrivilegedAccess.value:
|
|
50
|
+
(_config$privilegedAcc = config.privilegedAccess) === null || _config$privilegedAcc === void 0 ? void 0 : _config$privilegedAcc.call(config);
|
|
51
|
+
break;
|
|
52
|
+
case _definitions.Threat.Debug.value:
|
|
53
|
+
(_config$debug = config.debug) === null || _config$debug === void 0 ? void 0 : _config$debug.call(config);
|
|
54
|
+
break;
|
|
55
|
+
case _definitions.Threat.Simulator.value:
|
|
56
|
+
(_config$simulator = config.simulator) === null || _config$simulator === void 0 ? void 0 : _config$simulator.call(config);
|
|
57
|
+
break;
|
|
58
|
+
case _definitions.Threat.AppIntegrity.value:
|
|
59
|
+
(_config$appIntegrity = config.appIntegrity) === null || _config$appIntegrity === void 0 ? void 0 : _config$appIntegrity.call(config);
|
|
60
|
+
break;
|
|
61
|
+
case _definitions.Threat.UnofficialStore.value:
|
|
62
|
+
(_config$unofficialSto = config.unofficialStore) === null || _config$unofficialSto === void 0 ? void 0 : _config$unofficialSto.call(config);
|
|
63
|
+
break;
|
|
64
|
+
case _definitions.Threat.Hooks.value:
|
|
65
|
+
(_config$hooks = config.hooks) === null || _config$hooks === void 0 ? void 0 : _config$hooks.call(config);
|
|
66
|
+
break;
|
|
67
|
+
case _definitions.Threat.DeviceBinding.value:
|
|
68
|
+
(_config$deviceBinding = config.deviceBinding) === null || _config$deviceBinding === void 0 ? void 0 : _config$deviceBinding.call(config);
|
|
69
|
+
break;
|
|
70
|
+
case _definitions.Threat.Passcode.value:
|
|
71
|
+
(_config$passcode = config.passcode) === null || _config$passcode === void 0 ? void 0 : _config$passcode.call(config);
|
|
72
|
+
break;
|
|
73
|
+
case _definitions.Threat.SecureHardwareNotAvailable.value:
|
|
74
|
+
(_config$secureHardwar = config.secureHardwareNotAvailable) === null || _config$secureHardwar === void 0 ? void 0 : _config$secureHardwar.call(config);
|
|
75
|
+
break;
|
|
76
|
+
case _definitions.Threat.ObfuscationIssues.value:
|
|
77
|
+
(_config$obfuscationIs = config.obfuscationIssues) === null || _config$obfuscationIs === void 0 ? void 0 : _config$obfuscationIs.call(config);
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
onInvalidCallback();
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
27
84
|
};
|
|
28
85
|
exports.setThreatListeners = setThreatListeners;
|
|
29
86
|
const removeThreatListeners = () => {
|
|
30
|
-
|
|
87
|
+
eventsListener.remove();
|
|
31
88
|
};
|
|
32
89
|
exports.removeThreatListeners = removeThreatListeners;
|
|
33
|
-
const talsecStart = options => {
|
|
90
|
+
const talsecStart = async options => {
|
|
34
91
|
return FreeraspReactNative.talsecStart(options);
|
|
35
92
|
};
|
|
36
93
|
exports.talsecStart = talsecStart;
|
|
37
94
|
const useFreeRasp = (config, actions) => {
|
|
38
95
|
(0, _react.useEffect)(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
96
|
+
(async () => {
|
|
97
|
+
await setThreatListeners(actions);
|
|
98
|
+
let response = await talsecStart(config);
|
|
99
|
+
if (response !== 'freeRASP started') {
|
|
100
|
+
onInvalidCallback();
|
|
101
|
+
}
|
|
102
|
+
console.log(response);
|
|
103
|
+
return () => {
|
|
104
|
+
removeThreatListeners();
|
|
105
|
+
};
|
|
106
|
+
})();
|
|
44
107
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
108
|
}, []);
|
|
46
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FreeraspReactNative","NativeModules","eventEmitter","NativeEventEmitter","
|
|
1
|
+
{"version":3,"names":["FreeraspReactNative","NativeModules","eventEmitter","NativeEventEmitter","eventsListener","onInvalidCallback","getThreatIdentifiers","identifiers","length","getThreatCount","itemsHaveType","getThreatChannelData","data","prepareMapping","newValues","threats","Threat","getValues","map","threat","index","value","setThreatListeners","config","channel","key","addListener","event","undefined","PrivilegedAccess","privilegedAccess","Debug","debug","Simulator","simulator","AppIntegrity","appIntegrity","UnofficialStore","unofficialStore","Hooks","hooks","DeviceBinding","deviceBinding","Passcode","passcode","SecureHardwareNotAvailable","secureHardwareNotAvailable","ObfuscationIssues","obfuscationIssues","removeThreatListeners","remove","talsecStart","options","useFreeRasp","actions","useEffect","response","console","log"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA;AACA;AAKA;AAKA;AAEA,MAAM;EAAEA;AAAoB,CAAC,GAAGC,0BAAa;AAE7C,MAAMC,YAAY,GAAG,IAAIC,+BAAkB,CAACH,mBAAmB,CAAC;AAChE,IAAII,cAAmC;AAEvC,MAAMC,iBAAiB,GAAG,MAAY;EACpCL,mBAAmB,CAACK,iBAAiB,EAAE;AACzC,CAAC;AAED,MAAMC,oBAAoB,GAAG,YAA+B;EAC1D,IAAIC,WAAW,GAAG,MAAMP,mBAAmB,CAACM,oBAAoB,EAAE;EAClE,IACEC,WAAW,CAACC,MAAM,KAAK,IAAAC,qBAAc,GAAE,IACvC,CAAC,IAAAC,oBAAa,EAACH,WAAW,EAAE,QAAQ,CAAC,EACrC;IACAF,iBAAiB,EAAE;EACrB;EACA,OAAOE,WAAW;AACpB,CAAC;AAED,MAAMI,oBAAoB,GAAG,YAAuC;EAClE,IAAIC,IAAI,GAAG,MAAMZ,mBAAmB,CAACW,oBAAoB,EAAE;EAC3D,IAAIC,IAAI,CAACJ,MAAM,KAAK,CAAC,IAAI,CAAC,IAAAE,oBAAa,EAACE,IAAI,EAAE,QAAQ,CAAC,EAAE;IACvDP,iBAAiB,EAAE;EACrB;EACA,OAAOO,IAAI;AACb,CAAC;AAED,MAAMC,cAAc,GAAG,YAA2B;EAChD,MAAMC,SAAS,GAAG,MAAMR,oBAAoB,EAAE;EAC9C,MA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A"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.itemsHaveType = exports.getThreatCount = void 0;
|
|
7
|
+
var _definitions = require("./definitions");
|
|
8
|
+
const getThreatCount = () => {
|
|
9
|
+
return _definitions.Threat.getValues().length;
|
|
10
|
+
};
|
|
11
|
+
exports.getThreatCount = getThreatCount;
|
|
12
|
+
const itemsHaveType = (data, desidedType) => {
|
|
13
|
+
return data.every(item => typeof item === desidedType);
|
|
14
|
+
};
|
|
15
|
+
exports.itemsHaveType = itemsHaveType;
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getThreatCount","Threat","getValues","length","itemsHaveType","data","desidedType","every","item"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA;AAEO,MAAMA,cAAc,GAAG,MAAc;EAC1C,OAAOC,mBAAM,CAACC,SAAS,EAAE,CAACC,MAAM;AAClC,CAAC;AAAC;AAEK,MAAMC,aAAa,GAAG,CAACC,IAAW,EAAEC,WAAmB,KAAK;EACjE,OAAOD,IAAI,CAACE,KAAK,CAAEC,IAAI,IAAK,OAAOA,IAAI,KAAKF,WAAW,CAAC;AAC1D,CAAC;AAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
export class Threat {
|
|
6
|
+
constructor(value) {
|
|
7
|
+
_defineProperty(this, "value", void 0);
|
|
8
|
+
this.value = value;
|
|
9
|
+
}
|
|
10
|
+
static getValues() {
|
|
11
|
+
return Platform.OS === 'android' ? [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.DeviceBinding, this.UnofficialStore, this.ObfuscationIssues] : [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.DeviceBinding, this.DeviceID, this.UnofficialStore];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
_defineProperty(Threat, "AppIntegrity", new Threat(0));
|
|
15
|
+
_defineProperty(Threat, "PrivilegedAccess", new Threat(0));
|
|
16
|
+
_defineProperty(Threat, "Debug", new Threat(0));
|
|
17
|
+
_defineProperty(Threat, "Hooks", new Threat(0));
|
|
18
|
+
_defineProperty(Threat, "Passcode", new Threat(0));
|
|
19
|
+
_defineProperty(Threat, "Simulator", new Threat(0));
|
|
20
|
+
_defineProperty(Threat, "SecureHardwareNotAvailable", new Threat(0));
|
|
21
|
+
_defineProperty(Threat, "DeviceBinding", new Threat(0));
|
|
22
|
+
_defineProperty(Threat, "DeviceID", new Threat(0));
|
|
23
|
+
_defineProperty(Threat, "UnofficialStore", new Threat(0));
|
|
24
|
+
_defineProperty(Threat, "ObfuscationIssues", new Threat(0));
|
|
25
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","Threat","constructor","value","getValues","OS","AppIntegrity","PrivilegedAccess","Debug","Hooks","Passcode","Simulator","SecureHardwareNotAvailable","DeviceBinding","UnofficialStore","ObfuscationIssues","DeviceID"],"sourceRoot":"../../src","sources":["definitions.ts"],"m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A,MAAM,cAWC,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAXpBA,MAAM,qBAYQ,IAAIA,MAAM,CAAC,CAAC,CAAC;AAAA,gBAZ3BA,MAAM,uBAaU,IAAIA,MAAM,CAAC,CAAC,CAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,37 +1,100 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { NativeEventEmitter, NativeModules
|
|
2
|
+
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
3
|
+
import { Threat } from './definitions';
|
|
4
|
+
import { getThreatCount, itemsHaveType } from './utils';
|
|
3
5
|
const {
|
|
4
6
|
FreeraspReactNative
|
|
5
7
|
} = NativeModules;
|
|
6
8
|
const eventEmitter = new NativeEventEmitter(FreeraspReactNative);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
let eventsListener;
|
|
10
|
+
const onInvalidCallback = () => {
|
|
11
|
+
FreeraspReactNative.onInvalidCallback();
|
|
12
|
+
};
|
|
13
|
+
const getThreatIdentifiers = async () => {
|
|
14
|
+
let identifiers = await FreeraspReactNative.getThreatIdentifiers();
|
|
15
|
+
if (identifiers.length !== getThreatCount() || !itemsHaveType(identifiers, 'number')) {
|
|
16
|
+
onInvalidCallback();
|
|
17
|
+
}
|
|
18
|
+
return identifiers;
|
|
19
|
+
};
|
|
20
|
+
const getThreatChannelData = async () => {
|
|
21
|
+
let data = await FreeraspReactNative.getThreatChannelData();
|
|
22
|
+
if (data.length !== 2 || !itemsHaveType(data, 'string')) {
|
|
23
|
+
onInvalidCallback();
|
|
20
24
|
}
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
const prepareMapping = async () => {
|
|
28
|
+
const newValues = await getThreatIdentifiers();
|
|
29
|
+
const threats = Threat.getValues();
|
|
30
|
+
threats.map((threat, index) => {
|
|
31
|
+
threat.value = newValues[index];
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const setThreatListeners = async config => {
|
|
35
|
+
const [channel, key] = await getThreatChannelData();
|
|
36
|
+
await prepareMapping();
|
|
37
|
+
eventsListener = eventEmitter.addListener(channel, event => {
|
|
38
|
+
var _config$privilegedAcc, _config$debug, _config$simulator, _config$appIntegrity, _config$unofficialSto, _config$hooks, _config$deviceBinding, _config$passcode, _config$secureHardwar, _config$obfuscationIs;
|
|
39
|
+
if (event[key] === undefined) {
|
|
40
|
+
onInvalidCallback();
|
|
41
|
+
}
|
|
42
|
+
switch (event[key]) {
|
|
43
|
+
case Threat.PrivilegedAccess.value:
|
|
44
|
+
(_config$privilegedAcc = config.privilegedAccess) === null || _config$privilegedAcc === void 0 ? void 0 : _config$privilegedAcc.call(config);
|
|
45
|
+
break;
|
|
46
|
+
case Threat.Debug.value:
|
|
47
|
+
(_config$debug = config.debug) === null || _config$debug === void 0 ? void 0 : _config$debug.call(config);
|
|
48
|
+
break;
|
|
49
|
+
case Threat.Simulator.value:
|
|
50
|
+
(_config$simulator = config.simulator) === null || _config$simulator === void 0 ? void 0 : _config$simulator.call(config);
|
|
51
|
+
break;
|
|
52
|
+
case Threat.AppIntegrity.value:
|
|
53
|
+
(_config$appIntegrity = config.appIntegrity) === null || _config$appIntegrity === void 0 ? void 0 : _config$appIntegrity.call(config);
|
|
54
|
+
break;
|
|
55
|
+
case Threat.UnofficialStore.value:
|
|
56
|
+
(_config$unofficialSto = config.unofficialStore) === null || _config$unofficialSto === void 0 ? void 0 : _config$unofficialSto.call(config);
|
|
57
|
+
break;
|
|
58
|
+
case Threat.Hooks.value:
|
|
59
|
+
(_config$hooks = config.hooks) === null || _config$hooks === void 0 ? void 0 : _config$hooks.call(config);
|
|
60
|
+
break;
|
|
61
|
+
case Threat.DeviceBinding.value:
|
|
62
|
+
(_config$deviceBinding = config.deviceBinding) === null || _config$deviceBinding === void 0 ? void 0 : _config$deviceBinding.call(config);
|
|
63
|
+
break;
|
|
64
|
+
case Threat.Passcode.value:
|
|
65
|
+
(_config$passcode = config.passcode) === null || _config$passcode === void 0 ? void 0 : _config$passcode.call(config);
|
|
66
|
+
break;
|
|
67
|
+
case Threat.SecureHardwareNotAvailable.value:
|
|
68
|
+
(_config$secureHardwar = config.secureHardwareNotAvailable) === null || _config$secureHardwar === void 0 ? void 0 : _config$secureHardwar.call(config);
|
|
69
|
+
break;
|
|
70
|
+
case Threat.ObfuscationIssues.value:
|
|
71
|
+
(_config$obfuscationIs = config.obfuscationIssues) === null || _config$obfuscationIs === void 0 ? void 0 : _config$obfuscationIs.call(config);
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
onInvalidCallback();
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
21
78
|
};
|
|
22
79
|
export const removeThreatListeners = () => {
|
|
23
|
-
|
|
80
|
+
eventsListener.remove();
|
|
24
81
|
};
|
|
25
|
-
export const talsecStart = options => {
|
|
82
|
+
export const talsecStart = async options => {
|
|
26
83
|
return FreeraspReactNative.talsecStart(options);
|
|
27
84
|
};
|
|
28
85
|
export const useFreeRasp = (config, actions) => {
|
|
29
86
|
useEffect(() => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
87
|
+
(async () => {
|
|
88
|
+
await setThreatListeners(actions);
|
|
89
|
+
let response = await talsecStart(config);
|
|
90
|
+
if (response !== 'freeRASP started') {
|
|
91
|
+
onInvalidCallback();
|
|
92
|
+
}
|
|
93
|
+
console.log(response);
|
|
94
|
+
return () => {
|
|
95
|
+
removeThreatListeners();
|
|
96
|
+
};
|
|
97
|
+
})();
|
|
35
98
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
99
|
}, []);
|
|
37
100
|
};
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","NativeEventEmitter","NativeModules","
|
|
1
|
+
{"version":3,"names":["useEffect","NativeEventEmitter","NativeModules","Threat","getThreatCount","itemsHaveType","FreeraspReactNative","eventEmitter","eventsListener","onInvalidCallback","getThreatIdentifiers","identifiers","length","getThreatChannelData","data","prepareMapping","newValues","threats","getValues","map","threat","index","value","setThreatListeners","config","channel","key","addListener","event","undefined","PrivilegedAccess","privilegedAccess","Debug","debug","Simulator","simulator","AppIntegrity","appIntegrity","UnofficialStore","unofficialStore","Hooks","hooks","DeviceBinding","deviceBinding","Passcode","passcode","SecureHardwareNotAvailable","secureHardwareNotAvailable","ObfuscationIssues","obfuscationIssues","removeThreatListeners","remove","talsecStart","options","useFreeRasp","actions","response","console","log"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAEEC,kBAAkB,EAClBC,aAAa,QACR,cAAc;AACrB,SACEC,MAAM,QAGD,eAAe;AACtB,SAASC,cAAc,EAAEC,aAAa,QAAQ,SAAS;AAEvD,MAAM;EAAEC;AAAoB,CAAC,GAAGJ,aAAa;AAE7C,MAAMK,YAAY,GAAG,IAAIN,kBAAkB,CAACK,mBAAmB,CAAC;AAChE,IAAIE,cAAmC;AAEvC,MAAMC,iBAAiB,GAAG,MAAY;EACpCH,mBAAmB,CAACG,iBAAiB,EAAE;AACzC,CAAC;AAED,MAAMC,oBAAoB,GAAG,YAA+B;EAC1D,IAAIC,WAAW,GAAG,MAAML,mBAAmB,CAACI,oBAAoB,EAAE;EAClE,IACEC,WAAW,CAACC,MAAM,KAAKR,cAAc,EAAE,IACvC,CAACC,aAAa,CAACM,WAAW,EAAE,QAAQ,CAAC,EACrC;IACAF,iBAAiB,EAAE;EACrB;EACA,OAAOE,WAAW;AACpB,CAAC;AAED,MAAME,oBAAoB,GAAG,YAAuC;EAClE,IAAIC,IAAI,GAAG,MAAMR,mBAAmB,CAACO,oBAAoB,EAAE;EAC3D,IAAIC,IAAI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kB,EAAE;QACnC/C,iBAAiB,EAAE;MACrB;MACAgD,OAAO,CAACC,GAAG,CAACF,QAAQ,CAAC;MAErB,OAAO,MAAM;QACXN,qBAAqB,EAAE;MACzB,CAAC;IACH,CAAC,GAAG;IACJ;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAED,eAAe5C,mBAAmB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Threat } from './definitions';
|
|
2
|
+
export const getThreatCount = () => {
|
|
3
|
+
return Threat.getValues().length;
|
|
4
|
+
};
|
|
5
|
+
export const itemsHaveType = (data, desidedType) => {
|
|
6
|
+
return data.every(item => typeof item === desidedType);
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Threat","getThreatCount","getValues","length","itemsHaveType","data","desidedType","every","item"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAAA,SAASA,MAAM,QAAQ,eAAe;AAEtC,OAAO,MAAMC,cAAc,GAAG,MAAc;EAC1C,OAAOD,MAAM,CAACE,SAAS,EAAE,CAACC,MAAM;AAClC,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG,CAACC,IAAW,EAAEC,WAAmB,KAAK;EACjE,OAAOD,IAAI,CAACE,KAAK,CAAEC,IAAI,IAAK,OAAOA,IAAI,KAAKF,WAAW,CAAC;AAC1D,CAAC"}
|