react-native-shield-full-plugin 2.4.0 → 2.4.1

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 CHANGED
@@ -2,236 +2,4 @@
2
2
 
3
3
  React Native Plugin for Shield Full (www.shield.com)
4
4
 
5
- React Native Shield Full Plugin helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour. It collects device's fingerprint, social metrics and network information.
6
-
7
- There are few steps to getting started with the SHIELD SDK:
8
-
9
- 1. [Integrate the SDK](#integrate-the-sdk)
10
-
11
- 2. [Initialize the SDK](#initialize-the-sdk)
12
-
13
- 3. [Get Session ID](#get-session-id)
14
-
15
- 4. [Get Device Results](#get-device-results)
16
-
17
- 5. [Send Custom Attributes](#send-custom-attributes)
18
-
19
- 6. [Send Device Fingerprint](#send-device-signature)
20
-
21
- 7. [Migration from BRIDGE CODE to PLUGIN](#migration-from-bridge-code-to-plugin)
22
-
23
-
24
-
25
- ### Integrate the SDK
26
-
27
- This package can be installed in two ways, you can choose a way depends on your need.
28
-
29
- **NPM:**
30
- ```
31
- npm install react-native-shield-full-plugin
32
- ```
33
- **OR**
34
-
35
- **YARN:**
36
- ```
37
- yarn add react-native-shield-full-plugin
38
- ```
39
-
40
- **Note**: We make continuous enhancements to our full library and detection capabilities which includes new functionalities, bug fixes and security updates. We recommend updating to the latest SDK version to protect against rapidly evolving fraud risks.
41
-
42
- You can refer to the Changelog to see more details about our updates.
43
-
44
- ### Initialize the SDK
45
-
46
- The SDK initialization should be configured on `useEffect` *(for **Functional Components**)* or `componentDidMount` *(for **Class Components**)* in your **App.tsx** or on **App launch** to ensure successful generation and processing of the device fingerprint. The SDK is to be initialized only once and will throw an exception if it is initialized more than once.
47
-
48
- You need both the **SHIELD_SITE_ID** and **SHIELD_SECRET_KEY** to initialize the SDK. You can locate them at the top of the page.
49
- ```
50
- const config: Config = {
51
- siteID: 'SHIELD_SITE_ID',
52
- secretKey: 'SHIELD_SECRET_KEY'
53
- };
54
-
55
- useEffect(() => {
56
- const initializeShield = async () => {
57
- await ShieldFraud.initShield(config);
58
- };
59
-
60
- initializeShield();
61
- }, []);
62
- ```
63
- **Note** - ```await ShieldFraud.initShield(config)``` - *The await keyword is used to wait for the promise returned by the initShield function to resolve. In React Native, It is best practice to use `await` when calling native modules from React Native, especially during `asynchronous` operations such as SDK Initialization. This is because using `await` ensures that the main thread is not blocked while the native module is initializing.*
64
-
65
- `Config` has these **optional** parameters:
66
-
67
- 1. `logLevel` Set your log level to `debug`, `info` or `none`. | Receives high-level information about how the SDK processes network requests, responses or error information during SDK integration. Default log level is `none`.
68
- 2. `environmentInfo` Set your environment info to `prod`, `dev` or `staging`. Default environment info is `prod`.
69
- 3. `blockedDialog` Set your dialog for the blocked dialog both title and body or you can send it as null as well
70
-
71
- Note: You can check whether Shield SDK is ready or not by using isSDKready function
72
-
73
- ```
74
- ShieldFraud.isSDKready(async (isReady: boolean) => {
75
- if (isReady) {
76
- // Shield is Ready: Do your implementation
77
- }
78
- }
79
- ```
80
-
81
- ### Get Session ID
82
- Session ID is the unique identifier of a user’s app session and acts as a point of reference when retrieving the device result for that session.
83
-
84
-
85
- Session ID follows the OS lifecycle management, in-line with industry best practice. This means that a user’s session is active for as long as the device maintains it, unless the user terminates the app or the device runs out of memory and has to kill the app.
86
-
87
- If you would like to retrieve device results using the backend API, it is important that you store the Session ID on your system. You will need to call the SHIELD backend API using this Session ID.
88
-
89
- ```
90
- ShieldFraud.isSDKready(async (isReady: boolean) => {
91
- if (isReady) {
92
- const sessionID = await ShieldFraud.getSessionId(); // Fetch session ID using await
93
- console.log('session id: ', sessionID);
94
- }
95
- }
96
- ```
97
-
98
- ### Get Device Results
99
- SHIELD provides you actionable device intelligence which you can retrieve from the SDK, via the `Optimized Listener` or `Customized Pull method`. You can also retrieve results via the backend API.
100
-
101
- *Warning: Only 1 method of obtaining device results **(Optimized Listener or Customized Pull)** can be in effect at any point in time.*
102
-
103
- #### Retrieve device results via Optimized Listener
104
-
105
- ##### SHIELD recommends the Optimized Listener method to reduce number of API calls. #####
106
-
107
- Our SDK will capture an initial device fingerprint upon SDK initialization and return an additional set of device intelligence ONLY if the device fingerprint changes along one session. This ensures a truly optimized end to end protection of your ecosystem.
108
-
109
- You can register a callback if you would like to be notified in the event that the device attributes change during the session (for example, a user activates a malicious tool a moment after launching the page).
110
-
111
- Add an additional parameter during intialization in order to register a callback.
112
-
113
- **For example - `await ShieldFraud.initShield(config, callbacks);`**
114
- ```
115
- const callbacks: ShieldCallback = {
116
- onSuccess: (data) => {
117
- // Handle success event here
118
- console.log('Success:', data);
119
- },
120
- onFailure: (error) => {
121
- // Handle failure event here
122
- console.log('Error:', error);
123
- },
124
- };
125
-
126
- const config: Config = {
127
- siteID: 'SHIELD_SITE_ID',
128
- secretKey: 'SHIELD_SECRET_KEY'
129
- };
130
-
131
- useEffect(() => {
132
- const initializeShield = async () => {
133
- await ShieldFraud.initShield(config, callbacks);
134
- };
135
- initializeShield();
136
- }, []);
137
- ```
138
-
139
- #### Retrieve device results via Customized Pull
140
- You can retrieve device results via Customized Pull at specific user checkpoints or activities, such as account registration, login, or checkout. This is to ensure that there is adequate time to generate a device fingerprint.
141
-
142
- ```
143
- ShieldFraud.isSDKready(async (isReady: boolean) => {
144
- if (isReady) {
145
- ShieldFraud.getLatestDeviceResult()
146
- .then((result: object) => {
147
- // Handle success with the result object
148
- console.log('Received latest device result:', result);
149
- })
150
- .catch((error: object) => {
151
- // Handle error with the error object
152
- console.log('Error retrieving device result:', error);
153
- });
154
- }
155
- });
156
- ```
157
-
158
- It is possible that getLatestDeviceResult returns null if the device result retrieval is unsuccessful.
159
-
160
- ### Send Custom Attributes
161
-
162
- Use the sendAttributes function to sent event-based attributes such as user_id or activity_id for enhanced analytics. This function accepts two parameters:screenName where the function is triggered, and data to provide any custom fields in key, value pairs.
163
-
164
- ```
165
- ShieldFraud.isSDKready(async (isReady: boolean) => {
166
- if (isReady) {
167
- ShieldFraud.sendAttributes('Screen_Name', { key1: 'value1', key2: 'value2' });
168
- }
169
- }
170
- ```
171
-
172
- ### Send Device Fingerprint
173
-
174
- Use the sendDeviceSignature function to manually trigger device signature collection for a screen or user checkpoint.
175
-
176
- ```
177
- // with screen name only
178
- const deviceintelligence = await ShieldFraud.sendDeviceSignature('screen_name');
179
-
180
- // with screen name and user id
181
- const deviceintelligence = await ShieldFraud.sendDeviceSignature('screen_name', 'user_id');
182
-
183
- ```
184
-
185
- ### Migration from BRIDGE CODE to PLUGIN
186
- If you've been using the old method of integrating the React Native bridge code for the Shield Full SDK on iOS and Android, follow these steps to migrate to our plugin.
187
-
188
- #### iOS Migration Steps
189
-
190
- **1. Remove Old Pod Dependency:**
191
- Open your iOS project's Podfile and remove the line `pod 'ShieldFraud'`. Then, in your project's root directory, run `pod deintegrate` followed by `pod install` to ensure the old ShieldFraud dependency is completely removed.
192
-
193
- **2. Remove Old Bridge Code Files:**
194
- In your Xcode project's file explorer, locate and remove the files `ShieldModule.h` and `ShieldModule.m`. Remove all these references as they are no longer needed.
195
-
196
- **3. Clean the Project:**
197
- Open your Xcode project. Go to `"Product"` in the top menu and select `"Clean Build Folder"` to make sure any residual build artifacts related to the old ShieldFraud library are removed.
198
-
199
- **4. Update React Native Project:**
200
- In your React Native project, search for any code that references the old `ShieldModule`. Remove all these references as they are no longer needed.
201
-
202
- **5. Follow Plugin Integration Steps:**
203
- Now that you've cleaned up the old bridge code, follow the integration steps outlined in the documentation under "Integrate the SDK" section, starting from the step of installing the plugin using npm or yarn.
204
-
205
- #### Android Migration Steps
206
- If you've been using the old method of integrating the React Native bridge code for the Shield Full SDK on Android, follow these steps to migrate to our plugin.
207
-
208
- **1. Remove Old Dependencies:**
209
- In your `app/build.gradle` file, locate and remove the line:
210
- ```
211
- implementation 'com.shield.android:shield-fraud:1.5.+'
212
- ```
213
-
214
- **2. Update Android Settings:**
215
- In your `settings.gradle` or project level `build.gradle` file from the `repositories` block, locate and remove the `maven url`:
216
- ```
217
- allprojects {
218
- repositories {
219
- maven {
220
- url "https://cashshield-sdk.s3.amazonaws.com/release/"
221
- }
222
- ...
223
- }
224
- }
225
- ```
226
- This is the maven url that you no longer need with the new plugin approach.
227
-
228
- **3. Remove Old Bridge Code:**
229
- In your Android project, if you have a ShieldModule.java file as part of the old bridge code integration, you can safely remove it.
230
-
231
- **4. Update React Native Project:**
232
- In your React Native project, search for any code that references the old ShieldModule in Java code. Also remove ShieldModule from ReactPackage, Remove all these references as they are no longer needed.
233
-
234
- **5. Follow Plugin Integration Steps:**
235
- Now that you've cleaned up the old bridge code, follow the integration steps outlined in the documentation under "Integrate the SDK" section, starting from the step of installing the plugin using npm or yarn.
236
-
237
- By following these steps, you'll successfully migrate your React Native project from the old bridge code integration to the new Shield Full plugin. This migration will make your project more maintainable and allow you to take advantage of the new features and improvements offered by the plugin.
5
+ React Native Shield Full Plugin helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour. It collects device's fingerprint, social metrics and network information.
@@ -19,7 +19,7 @@ def packageJson = new groovy.json.JsonSlurper().parseText(
19
19
  new File("${project.projectDir}/../package.json").text
20
20
  )
21
21
  def isFullPlugin = packageJson.name == "react-native-shield-full-plugin"
22
- def shieldSdkArtifact = isFullPlugin ? "com.shield.android:shield:2.6.1" : "com.shield.android:shield-fraud:2.6.1"
22
+ def shieldSdkArtifact = isFullPlugin ? "com.shield.android:shield:2.7.0" : "com.shield.android:shield-fraud:2.7.0"
23
23
 
24
24
  apply plugin: "com.android.library"
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-shield-full-plugin",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "React Native Shield Full Plugin helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour. It collects device's fingerprint, social metrics and network information.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",