freerasp-react-native 2.0.1 → 2.0.2

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.
Files changed (2) hide show
  1. package/README.md +82 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -20,11 +20,11 @@ freeRASP for React Native is a mobile in-app protection and security monitoring
20
20
  - [Dev vs Release version](#dev-vs-release-version)
21
21
  - [Callbacks](#callbacks)
22
22
  - [Initialization](#initialization)
23
+ - [Alternative: Initialize freeRASP in a Class component](#alternative-initialize-freerasp-in-a-class-component)
23
24
  - [Step 5: Additional note about obfuscation](#step-5-additional-note-about-obfuscation)
24
25
  - [Step 6: User Data Policies](#step-6-user-data-policies)
25
26
  - [Security Report](#security-report)
26
- - [Enterprise Services](#bar_chart-enterprise-services)
27
- - [Commercial version](#commercial-version)
27
+ - [Commercial versions (RASP+ and more)](#bar_chart-commercial-versions-rasp-and-more)
28
28
  - [Plans Comparison](#plans-comparison)
29
29
  - [About Us](#about-us)
30
30
  - [License](#license)
@@ -73,7 +73,7 @@ in order to run freeRASP in your app:
73
73
 
74
74
  # Usage
75
75
 
76
- We will guide you step-by-step, but you can always check the expected result in the example.
76
+ We will guide you step-by-step, but you can always check the expected result in the example folder.
77
77
 
78
78
  ## (Optional) Create a new React Native demo application
79
79
 
@@ -101,9 +101,20 @@ freeRASP React Native plugin uses Pods. Navigate to the `ios` folder and run:
101
101
 
102
102
  $ pod install
103
103
 
104
+ **IMPORTANT:** If you are upgrading from a previous version of freeRASP, please remove the old TalsecRuntime.xcframework and integration script from your project:
105
+
106
+ 1. Open up the **.xcworkspace** file
107
+ 1. Go to **Target -> Build Phases -> Link Binary With Libraries**
108
+ 1. Remove **TalsecRuntime.xcframework**
109
+ 1. On top bar select **Product -> Scheme -> Edit Scheme...**
110
+ 1. On the left side select **Build -> Pre-actions**
111
+ 1. Find integration script and click trash icon on the right side to remove it
112
+ 1. Update freeRASP. If you are getting any errors, check that in `node_modules/freerasp-react-native/ios`, TalsecRuntime.xcframework is a folder, not a symlink. If it is a symlink, remove it and reinstall the module.
113
+ 1. run `pod install`
114
+
104
115
  ## Step 3: Import freeRASP into the app
105
116
 
106
- We provide a custom hook that handles all required logic as registration of freeRASP, mounting and unmounting of listeners for you. Import the hook into your app:
117
+ We provide a React Custom Hook that handles all required logic as registration of freeRASP, mounting and unmounting of listeners for you. Import the Hook into your app:
107
118
 
108
119
  ```ts
109
120
  import { useFreeRasp } from 'freerasp-react-native';
@@ -219,10 +230,46 @@ const actions = {
219
230
  useFreeRasp(config, actions);
220
231
  ```
221
232
 
233
+ _Please note that useFreeRasp Hook should be called outside useEffect._
234
+
222
235
  When freeRASP initializes correctly, you should see `freeRASP initialized` message in logs. Otherwise, you'll see warning with description of what went wrong.
223
236
 
224
237
  _You can override this default behavior by extending the `actions` object with `started` key (to change action after successful initialization), and `initializationError` key (to set up action after unsuccessful initialization)_
225
238
 
239
+ ### Alternative: Initialize freeRASP in a Class component
240
+
241
+ - import methods from the freeRASP plugin:
242
+
243
+ ```ts
244
+ import {
245
+ talsecStart,
246
+ setThreatListeners,
247
+ removeThreatListeners,
248
+ } from 'freerasp-react-native';
249
+ ```
250
+
251
+ - override `constructor()` method in the entry point to your app, set listeners to threats and start freeRASP:
252
+
253
+ ```ts
254
+ constructor(props) {
255
+ super(props);
256
+
257
+ // Add these method calls
258
+ setThreatListeners(actions);
259
+ talsecStart(config);
260
+ }
261
+ ```
262
+
263
+ _In this code snippet, `actions` is object with your reactions to threats and `config` is freeRASP configuration object from previous parts of the readme._
264
+
265
+ - override `componentWillUnmount()` method where you clean up the listeners:
266
+
267
+ ```ts
268
+ componentWillUnmount() {
269
+ removeThreatListeners();
270
+ }
271
+ ```
272
+
226
273
  ## Step 5: Additional note about obfuscation
227
274
 
228
275
  The freeRASP contains public API, so the integration process is as simple as possible. Unfortunately, this public API also creates opportunities for the attacker to use publicly available information to interrupt freeRASP operations or modify your custom reaction implementation in threat callbacks. In order for freeRASP to be as effective as possible, it is highly recommended to apply obfuscation to the final package/application, making the public API more difficult to find and also partially randomized for each application so it cannot be automatically abused by generic hooking scripts.
@@ -273,6 +320,36 @@ If you encounter any other issues, you can see the list of solved issues [here](
273
320
  - In `package.json`, update `react-native` to a higher patch version and run `npm install` (or `yarn install`).
274
321
  - [See this issue to find out which patch version is relevant for you.](https://github.com/facebook/react-native/issues/35210)
275
322
 
323
+ ### `Invalid hook call. Hooks can only be called inside of the body of a function component.`
324
+
325
+ **Reason:**
326
+ The `useFreeRasp` Hook cannot be called inside useEffect.
327
+
328
+ **Solution:**
329
+
330
+ - If you want to initialize freeRASP inside useEffect, you have to handle the initialization on your own. Such inititialization would look like this:
331
+
332
+ ```ts
333
+ import {
334
+ setThreatListeners,
335
+ talsecStart,
336
+ removeThreatListeners,
337
+ } from 'freerasp-react-native';
338
+
339
+ ...
340
+
341
+ useEffect(() => {
342
+ setThreatListeners(actions);
343
+ talsecStart(config);
344
+
345
+ return () => {
346
+ removeThreatListeners();
347
+ };
348
+ }, []);
349
+ ```
350
+
351
+ Where `actions`, `config` are objects described in previous chapters.
352
+
276
353
  # Security Report
277
354
 
278
355
  The Security Report is a weekly summary describing the application's security state and characteristics of the devices it runs on in a practical and easy-to-understand way.
@@ -283,12 +360,10 @@ To receive Security Reports, fill out the _watcherMail_ field in [config](#confi
283
360
 
284
361
  ![dashboard](https://raw.githubusercontent.com/talsec/Free-RASP-Community/master/visuals/dashboard.png)
285
362
 
286
- # :bar_chart: Enterprise Services
363
+ # :bar_chart: Commercial versions (RASP+ and more)
287
364
 
288
365
  We provide app security hardening SDK: i.e. AppiCrypt®, Customer Data Encryption (local storage), End-to-end encryption, Strings protection (e.g. API keys) and Dynamic Certificate Pinning to our commercial customers as well. To get the most advanced protection compliant with PSD2 RT and eIDAS and support from our experts, contact us at [talsec.app](https://talsec.app).
289
366
 
290
- ## Commercial version
291
-
292
367
  The commercial version provides a top-notch protection level, extra features, support, and maintenance. One of the most valued commercial features is [AppiCrypt®](https://www.talsec.app/appicrypt) - App Integrity Cryptogram.
293
368
 
294
369
  It allows easy to implement API protection and App Integrity verification on the backend to prevent API abuse:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freerasp-react-native",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",