react-native-trustdevice 1.1.3 → 1.1.4

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 (26) hide show
  1. package/android/build/.transforms/5932fa5b98f0003ce689cad35520f6df/results.bin +1 -0
  2. package/android/build/.transforms/5932fa5b98f0003ce689cad35520f6df/transformed/classes/classes.dex +0 -0
  3. package/android/build/.transforms/ff2232c43c8cccbad5f33e76433cddb2/results.bin +1 -0
  4. package/android/build/.transforms/ff2232c43c8cccbad5f33e76433cddb2/transformed/classes/classes.dex +0 -0
  5. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  6. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  7. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -7
  8. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdevicePackage.class +0 -0
  9. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule$1.class +0 -0
  10. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule$2.class +0 -0
  11. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule.class +0 -0
  12. package/android/build/intermediates/javac/debug/classes/com/trustdevice/utils/TDUniRiskUtils.class +0 -0
  13. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  14. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -7
  15. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdevicePackage.class.uniqueId1 +0 -0
  16. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdeviceSeModule$1.class.uniqueId0 +0 -0
  17. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdeviceSeModule$2.class.uniqueId3 +0 -0
  18. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdeviceSeModule.class.uniqueId2 +0 -0
  19. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  20. package/android/src/main/java/com/trustdevice/TrustdevicePackage.java +1 -1
  21. package/android/src/main/java/com/trustdevice/TrustdeviceSeModule.java +126 -0
  22. package/android/src/main/java/com/trustdevice/utils/TDUniRiskUtils.java +189 -12
  23. package/ios/TrustDeviceSe.h +17 -0
  24. package/ios/TrustDeviceSe.m +165 -0
  25. package/package.json +1 -1
  26. package/react-native-trustdevice.podspec +2 -1
@@ -29,8 +29,6 @@ int anim catalyst_push_up_out 0x0
29
29
  int anim catalyst_slide_down 0x0
30
30
  int anim catalyst_slide_up 0x0
31
31
  int anim fragment_fast_out_extra_slow_in 0x0
32
- int anim td_dialog_enter 0x0
33
- int anim td_dialog_exit 0x0
34
32
  int animator fragment_close_enter 0x0
35
33
  int animator fragment_close_exit 0x0
36
34
  int animator fragment_fade_enter 0x0
@@ -676,7 +674,6 @@ int drawable notification_template_icon_low_bg 0x0
676
674
  int drawable notification_tile_bg 0x0
677
675
  int drawable notify_panel_notification_icon_bg 0x0
678
676
  int drawable redbox_top_border_background 0x0
679
- int drawable td_loading 0x0
680
677
  int drawable test_level_drawable 0x0
681
678
  int drawable tooltip_frame_dark 0x0
682
679
  int drawable tooltip_frame_light 0x0
@@ -782,7 +779,6 @@ int id home 0x0
782
779
  int id icon 0x0
783
780
  int id icon_group 0x0
784
781
  int id image 0x0
785
- int id img 0x0
786
782
  int id info 0x0
787
783
  int id italic 0x0
788
784
  int id item1 0x0
@@ -936,7 +932,6 @@ int layout select_dialog_item_material 0x0
936
932
  int layout select_dialog_multichoice_material 0x0
937
933
  int layout select_dialog_singlechoice_material 0x0
938
934
  int layout support_simple_spinner_dropdown_item 0x0
939
- int layout td_simpledialog 0x0
940
935
  int menu example_menu 0x0
941
936
  int menu example_menu2 0x0
942
937
  int string abc_action_bar_home_description 0x0
@@ -1398,8 +1393,6 @@ int style Widget_Autofill_InlineSuggestionTitle 0x0
1398
1393
  int style Widget_Compat_NotificationActionContainer 0x0
1399
1394
  int style Widget_Compat_NotificationActionText 0x0
1400
1395
  int style redboxButton 0x0
1401
- int style td_dialog_animation 0x0
1402
- int style td_dialog_style 0x0
1403
1396
  int[] styleable ActionBar { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }
1404
1397
  int styleable ActionBar_background 0
1405
1398
  int styleable ActionBar_backgroundSplit 1
@@ -30,8 +30,6 @@ anim catalyst_push_up_out
30
30
  anim catalyst_slide_down
31
31
  anim catalyst_slide_up
32
32
  anim fragment_fast_out_extra_slow_in
33
- anim td_dialog_enter
34
- anim td_dialog_exit
35
33
  animator fragment_close_enter
36
34
  animator fragment_close_exit
37
35
  animator fragment_fade_enter
@@ -677,7 +675,6 @@ drawable notification_template_icon_low_bg
677
675
  drawable notification_tile_bg
678
676
  drawable notify_panel_notification_icon_bg
679
677
  drawable redbox_top_border_background
680
- drawable td_loading
681
678
  drawable test_level_drawable
682
679
  drawable tooltip_frame_dark
683
680
  drawable tooltip_frame_light
@@ -783,7 +780,6 @@ id home
783
780
  id icon
784
781
  id icon_group
785
782
  id image
786
- id img
787
783
  id info
788
784
  id italic
789
785
  id item1
@@ -937,7 +933,6 @@ layout select_dialog_item_material
937
933
  layout select_dialog_multichoice_material
938
934
  layout select_dialog_singlechoice_material
939
935
  layout support_simple_spinner_dropdown_item
940
- layout td_simpledialog
941
936
  menu example_menu
942
937
  menu example_menu2
943
938
  string abc_action_bar_home_description
@@ -1399,8 +1394,6 @@ style Widget_Autofill_InlineSuggestionTitle
1399
1394
  style Widget_Compat_NotificationActionContainer
1400
1395
  style Widget_Compat_NotificationActionText
1401
1396
  style redboxButton
1402
- style td_dialog_animation
1403
- style td_dialog_style
1404
1397
  styleable ActionBar background backgroundSplit backgroundStacked contentInsetEnd contentInsetEndWithActions contentInsetLeft contentInsetRight contentInsetStart contentInsetStartWithNavigation customNavigationLayout displayOptions divider elevation height hideOnContentScroll homeAsUpIndicator homeLayout icon indeterminateProgressStyle itemPadding logo navigationMode popupTheme progressBarPadding progressBarStyle subtitle subtitleTextStyle title titleTextStyle
1405
1398
  styleable ActionBarLayout android_layout_gravity
1406
1399
  styleable ActionMenuItemView android_minWidth
@@ -15,7 +15,7 @@ public class TrustdevicePackage implements ReactPackage {
15
15
  @NonNull
16
16
  @Override
17
17
  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
18
- return List.<NativeModule>of(new TrustdeviceModule(reactContext));
18
+ return List.<NativeModule>of(new TrustdeviceModule(reactContext), new TrustdeviceSeModule(reactContext));
19
19
  }
20
20
 
21
21
  // Deprecated from RN 0.47
@@ -0,0 +1,126 @@
1
+
2
+ package com.trustdevice;
3
+
4
+ import androidx.annotation.NonNull;
5
+
6
+ import com.facebook.react.bridge.Promise;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
9
+ import com.facebook.react.bridge.ReactMethod;
10
+ import com.facebook.react.bridge.ReadableMap;
11
+ import com.facebook.react.bridge.WritableMap;
12
+ import com.facebook.react.bridge.Arguments;
13
+ import com.trustdevice.utils.TDUniRiskUtils;
14
+
15
+ import java.util.HashMap;
16
+
17
+ import com.trustdecision.mobrisk.TDRisk;
18
+ import com.trustdecision.mobrisk.TDRiskCallback;
19
+ import com.trustdecision.mobrisk.TDAPISignResult;
20
+
21
+ import com.trustdecision.mobrisk.TDDeviceManager;
22
+ import com.trustdecision.mobrisk.TDDeviceInfoCallback;
23
+ import com.trustdecision.mobrisk.TDDeviceAPIStatus;
24
+
25
+ public class TrustdeviceSeModule extends ReactContextBaseJavaModule {
26
+ private final ReactApplicationContext reactContext;
27
+
28
+ public TrustdeviceSeModule(ReactApplicationContext reactContext) {
29
+ super(reactContext);
30
+ this.reactContext = reactContext;
31
+ }
32
+
33
+ @NonNull
34
+ @Override
35
+ public String getName() {
36
+ return "TrustDeviceSe";
37
+ }
38
+
39
+ @ReactMethod
40
+ public void initWithOptions(ReadableMap readableMap, Promise promise) {
41
+ if (readableMap != null) {
42
+ HashMap<String, Object> options = readableMap.toHashMap();
43
+ TDDeviceManager.Builder builder = TDUniRiskUtils.mapToBuilderSe(options);
44
+ TDDeviceManager.initWithOptions(this.reactContext.getApplicationContext(), builder);
45
+ promise.resolve(null);
46
+ }
47
+ }
48
+
49
+ @ReactMethod
50
+ public void getBlackBoxAsync(Promise promise) {
51
+ try {
52
+ TDRisk.getBlackBoxAsync(new TDRiskCallback() {
53
+ @Override
54
+ public void onEvent(String blackbox) {
55
+ promise.resolve(blackbox);
56
+ }
57
+ });
58
+ } catch (Exception e) {
59
+ promise.reject("getBlackBoxAsync Error", e);
60
+ }
61
+ }
62
+
63
+ @ReactMethod
64
+ public void getDeviceInfo(Promise promise) {
65
+ try {
66
+
67
+ TDDeviceManager.getDeviceInfo(new TDDeviceInfoCallback() {
68
+ @Override
69
+ public void onResult(String fpVersion,
70
+ String blackBox,
71
+ String anonymousId,
72
+ int deviceRiskScore,
73
+ TDDeviceAPIStatus apiStatus,
74
+ String sealedResult) {
75
+ // 注:回调在子线程中执行,请不要在此处操作UI
76
+ // fpVersion: SDK版本号
77
+ // blackBox: 本次采集的blackBox
78
+ // anonymousId: 当前设备的匿名ID
79
+ // deviceRiskScore: 设备风险分数
80
+ // apiStatus: API状态信息
81
+ // sealedResult: 密封结果
82
+ int code = apiStatus.getCode();
83
+
84
+ // 创建 WritableMap 来返回结构化数据
85
+ WritableMap resultMap = Arguments.createMap();
86
+
87
+ resultMap.putInt("code", apiStatus.getCode());
88
+ resultMap.putString("fpVersion", fpVersion);
89
+ resultMap.putString("blackBox", blackBox);
90
+ resultMap.putString("anonymousId", anonymousId);
91
+ resultMap.putInt("deviceRiskScore", deviceRiskScore);
92
+ resultMap.putString("sealedResult", sealedResult);
93
+ resultMap.putString("msg", apiStatus.getMessage());
94
+
95
+ promise.resolve(resultMap);
96
+ }
97
+ });
98
+
99
+ } catch (Exception e) {
100
+ promise.reject("getDeviceInfo Error", e);
101
+ }
102
+ }
103
+
104
+ @ReactMethod
105
+ public void sign(String path, Promise promise) {
106
+ try {
107
+ TDAPISignResult signResult = TDRisk.sign(this.reactContext.getApplicationContext(), path);
108
+ // 创建 WritableMap 来返回结构化数据
109
+ WritableMap resultMap = Arguments.createMap();
110
+ resultMap.putString("sign", signResult.signature());
111
+ resultMap.putInt("code", signResult.code());
112
+ resultMap.putString("msg", signResult.message());
113
+
114
+ promise.resolve(resultMap);
115
+
116
+ } catch (Exception e) {
117
+ promise.reject("sign Error", e);
118
+ }
119
+ }
120
+
121
+ @ReactMethod
122
+ public void getSDKVersion(Promise promise) {
123
+ String sdkVersion = TDRisk.getSDKVersion();
124
+ promise.resolve(sdkVersion);
125
+ }
126
+ }
@@ -5,6 +5,7 @@ import android.text.TextUtils;
5
5
  import java.util.Map;
6
6
 
7
7
  import com.trustdecision.mobrisk.TDRisk;
8
+ import com.trustdecision.mobrisk.TDDeviceManager;
8
9
 
9
10
  public class TDUniRiskUtils {
10
11
  ///Mandatory Shared Configuration
@@ -12,10 +13,12 @@ public class TDUniRiskUtils {
12
13
  static final String KEY_APPKEY = "appKey";
13
14
  static final String KEY_APPNAME = "appName";
14
15
  static final String KEY_COUNTRY = "country";
16
+ static final String KEY_CHANNEL = "channel";
15
17
  static final String KEY_DEBUG = "debug";
16
18
  static final String KEY_TIME_LIMIT = "timeLimit";
17
19
  static final String KEY_LOCATION = "location";
18
20
  static final String KEY_COLLECT_LEVEL = "collectLevel";
21
+ static final String KEY_CUSTOM_MESSAGE = "customMessage";
19
22
 
20
23
  ///Android device fingerprint configuration
21
24
  static final String KEY_FP_ANDROID_RUNNING_TASKS = "runningTasks";
@@ -25,6 +28,9 @@ public class TDUniRiskUtils {
25
28
  static final String KEY_FP_ANDROID_WIFIMAC = "wifiMac";
26
29
 
27
30
  static final String KEY_FP_ANDROID_GOOGLE_AID = "googleAid";
31
+ static final String KEY_FP_ANDROID_OAID = "OAID";
32
+ static final String KEY_FP_ANDROID_AID = "AID";
33
+ static final String KEY_FP_ANDROID_ANDROID_ID = "ANDROID_ID";
28
34
 
29
35
  ///Android device Captcha configuration
30
36
  static final String KEY_CAPTCHA_LANGUAGE = "language";
@@ -36,6 +42,164 @@ public class TDUniRiskUtils {
36
42
  static final String KEY_CAPTCHA_SKIP_CAPTCHA = "skipCaptcha";
37
43
  static final String KEY_CAPTCHA_MFAID = "mfaId";
38
44
 
45
+ public static TDDeviceManager.Builder mapToBuilderSe(Map<String, Object> configMap) {
46
+ TDDeviceManager.Builder builder = null;
47
+ if (configMap == null) {
48
+ return builder;
49
+ }
50
+ builder = new TDDeviceManager.Builder();
51
+ if (configMap.containsKey(KEY_PARTNER)) {
52
+ builder.partner((String) configMap.get(KEY_PARTNER));
53
+ }
54
+ if (configMap.containsKey(KEY_APPKEY)) {
55
+ builder.appKey((String) configMap.get(KEY_APPKEY));
56
+ }
57
+
58
+ // if (configMap.containsKey(KEY_APPNAME)) {
59
+ // builder.appName((String) configMap.get(KEY_APPNAME));
60
+ // }
61
+
62
+ if (configMap.containsKey(KEY_APPNAME)) {
63
+ builder.channel((String) configMap.get(KEY_APPNAME));
64
+ }
65
+ if (configMap.containsKey(KEY_CHANNEL)) {
66
+ builder.channel((String) configMap.get(KEY_CHANNEL));
67
+ }
68
+ if (configMap.containsKey(KEY_COUNTRY)) {
69
+ String country = (String) configMap.get(KEY_COUNTRY);
70
+ if (!TextUtils.isEmpty(country)) {
71
+ builder.country(country.toUpperCase());
72
+ }
73
+ }
74
+ // if (configMap.containsKey(KEY_URL)) {
75
+ // String url = (String) configMap.get(KEY_URL);
76
+ // if (!TextUtils.isEmpty(url)) {
77
+ // builder.url(url);
78
+ // }
79
+ // }
80
+ // if (configMap.containsKey(KEY_PROFILE_URL)) {
81
+ // String url = (String) configMap.get(KEY_PROFILE_URL);
82
+ // if (!TextUtils.isEmpty(url)) {
83
+ // builder.url(url);
84
+ // }
85
+ // }
86
+ if (configMap.containsKey(KEY_DEBUG)) {
87
+ Object debug = configMap.get(KEY_DEBUG);
88
+ if (debug != null) {
89
+ if (!(boolean) debug)
90
+ builder.disableDebugger();
91
+ }
92
+ }
93
+ if (configMap.containsKey(KEY_TIME_LIMIT)) {
94
+ Object timeLimit = configMap.get(KEY_TIME_LIMIT);
95
+ if (timeLimit != null) {
96
+ builder.httpTimeOut(((int) timeLimit) * 1000);
97
+ }
98
+ }
99
+
100
+ if (configMap.containsKey(KEY_LOCATION)) {
101
+ Object location = configMap.get(KEY_LOCATION);
102
+ if (location != null) {
103
+ if (!(boolean) location)
104
+ builder.disableGPS();
105
+ }
106
+ }
107
+
108
+ // if (configMap.containsKey(KEY_COLLECT_LEVEL)) {
109
+ // String collectLevel = (String) configMap.get(KEY_COLLECT_LEVEL);
110
+ // if ("M".equals(collectLevel)) {
111
+ // builder.collectLevel(TDRisk.COLLECT_LEVEL_M);
112
+ // } else if ("L".equals(collectLevel)) {
113
+ // builder.collectLevel(TDRisk.COLLECT_LEVEL_L);
114
+ // }
115
+ // }
116
+
117
+ if (configMap.containsKey(KEY_CUSTOM_MESSAGE)) {
118
+ String customMessage = (String) configMap.get(KEY_CUSTOM_MESSAGE);
119
+ if (customMessage != null) {
120
+ builder.customMessage(customMessage);
121
+ }
122
+ }
123
+
124
+
125
+ ///Android device fingerprint configuration
126
+ if (configMap.containsKey(KEY_FP_ANDROID_RUNNING_TASKS)) {
127
+ Object runningTasks = configMap.get(KEY_FP_ANDROID_RUNNING_TASKS);
128
+ if (runningTasks != null) {
129
+ if (!(boolean) runningTasks)
130
+ builder.disableRunningTasks();
131
+ }
132
+ }
133
+ if (configMap.containsKey(KEY_FP_ANDROID_SENSOR)) {
134
+ Object sensor = configMap.get(KEY_FP_ANDROID_SENSOR);
135
+ if (sensor != null) {
136
+ if (!(boolean) sensor)
137
+ builder.disableSensor();
138
+ }
139
+ }
140
+ if (configMap.containsKey(KEY_FP_ANDROID_READ_PHONE)) {
141
+ Object readPhone = configMap.get(KEY_FP_ANDROID_READ_PHONE);
142
+ if (readPhone != null) {
143
+ if (!(boolean) readPhone)
144
+ builder.disableReadPhone();
145
+ }
146
+ }
147
+ if (configMap.containsKey(KEY_FP_ANDROID_INSTALLPACKAGE_LIST)) {
148
+ Object installPackageList = configMap.get(KEY_FP_ANDROID_INSTALLPACKAGE_LIST);
149
+ if (installPackageList != null) {
150
+ if (!(boolean) installPackageList)
151
+ builder.disableInstallPackageList();
152
+ }
153
+ }
154
+
155
+ // if (configMap.containsKey(KEY_FP_ANDROID_WIFIMAC)) {
156
+ // Object wifiMac = configMap.get(KEY_FP_ANDROID_WIFIMAC);
157
+ // if (wifiMac != null) {
158
+ // if (!(boolean) wifiMac) {
159
+ // builder.disableWifiMac();
160
+ // } else {
161
+ // builder.enableWifiMac();
162
+ // }
163
+ // }
164
+ // }
165
+
166
+ if (configMap.containsKey(KEY_FP_ANDROID_GOOGLE_AID)) {
167
+ Object enableGoogleAid = configMap.get(KEY_FP_ANDROID_GOOGLE_AID);
168
+ if (enableGoogleAid != null) {
169
+ if (!(boolean) enableGoogleAid)
170
+ builder.disableGoogleAid();
171
+ }
172
+ }
173
+
174
+ if (configMap.containsKey(KEY_FP_ANDROID_OAID)) {
175
+ Object oaid = configMap.get(KEY_FP_ANDROID_OAID);
176
+ if (oaid != null) {
177
+ if (!(boolean) oaid )
178
+ builder.disableOptions(TDDeviceManager.OPTION_OAID);
179
+ }
180
+ }
181
+ if (configMap.containsKey(KEY_FP_ANDROID_AID)) {
182
+ Object aid = configMap.get(KEY_FP_ANDROID_AID);
183
+ if (aid != null) {
184
+ if (!(boolean) aid)
185
+ builder.disableOptions(TDDeviceManager.OPTION_AID);
186
+ }
187
+ }
188
+ if (configMap.containsKey(KEY_FP_ANDROID_ANDROID_ID)) {
189
+ Object androidID = configMap.get(KEY_FP_ANDROID_ANDROID_ID);
190
+ if (androidID != null) {
191
+ if (!(boolean) androidID)
192
+ builder.disableOptions(TDDeviceManager.OPTION_ANDROID_ID);
193
+ }
194
+ }
195
+
196
+
197
+
198
+ return builder;
199
+
200
+
201
+ }
202
+
39
203
  /**
40
204
  * 转换configMap成builder
41
205
  *
@@ -48,13 +212,19 @@ public class TDUniRiskUtils {
48
212
  return builder;
49
213
  builder = new TDRisk.Builder();
50
214
  if (configMap.containsKey(KEY_PARTNER)) {
51
- builder.partnerCode((String) configMap.get(KEY_PARTNER));
215
+ builder.partner((String) configMap.get(KEY_PARTNER));
52
216
  }
53
217
  if (configMap.containsKey(KEY_APPKEY)) {
54
218
  builder.appKey((String) configMap.get(KEY_APPKEY));
55
219
  }
220
+ // if (configMap.containsKey(KEY_APPNAME)) {
221
+ // builder.appName((String) configMap.get(KEY_APPNAME));
222
+ // }
56
223
  if (configMap.containsKey(KEY_APPNAME)) {
57
- builder.appName((String) configMap.get(KEY_APPNAME));
224
+ builder.channel((String) configMap.get(KEY_APPNAME));
225
+ }
226
+ if (configMap.containsKey(KEY_CHANNEL)) {
227
+ builder.channel((String) configMap.get(KEY_CHANNEL));
58
228
  }
59
229
  if (configMap.containsKey(KEY_COUNTRY)) {
60
230
  String country = (String) configMap.get(KEY_COUNTRY);
@@ -119,16 +289,16 @@ public class TDUniRiskUtils {
119
289
  builder.disableInstallPackageList();
120
290
  }
121
291
  }
122
- if (configMap.containsKey(KEY_FP_ANDROID_WIFIMAC)) {
123
- Object wifiMac = configMap.get(KEY_FP_ANDROID_WIFIMAC);
124
- if (wifiMac != null) {
125
- if (!(boolean) wifiMac) {
126
- builder.disableWifiMac();
127
- } else {
128
- builder.enableWifiMac();
129
- }
130
- }
131
- }
292
+ // if (configMap.containsKey(KEY_FP_ANDROID_WIFIMAC)) {
293
+ // Object wifiMac = configMap.get(KEY_FP_ANDROID_WIFIMAC);
294
+ // if (wifiMac != null) {
295
+ // if (!(boolean) wifiMac) {
296
+ // builder.disableWifiMac();
297
+ // } else {
298
+ // builder.enableWifiMac();
299
+ // }
300
+ // }
301
+ // }
132
302
  if (configMap.containsKey(KEY_FP_ANDROID_GOOGLE_AID)) {
133
303
  Object googleAid = configMap.get(KEY_FP_ANDROID_GOOGLE_AID);
134
304
  if (googleAid != null) {
@@ -190,6 +360,13 @@ public class TDUniRiskUtils {
190
360
  builder.mfaId((String) mfaIdObj);
191
361
  }
192
362
  }
363
+ // 补充
364
+ if (configMap.containsKey(KEY_CUSTOM_MESSAGE)) {
365
+ String customMessage = (String) configMap.get(KEY_CUSTOM_MESSAGE);
366
+ if (customMessage != null) {
367
+ builder.customMessage(customMessage);
368
+ }
369
+ }
193
370
  return builder;
194
371
  }
195
372
  }
@@ -0,0 +1,17 @@
1
+ //
2
+ // TrustDeviceSe.h
3
+ // TrustDeviceReactNative
4
+ //
5
+ // Created on 2025.11.12
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <React/RCTBridgeModule.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @interface TrustDeviceSe : NSObject <RCTBridgeModule>
14
+
15
+ @end
16
+
17
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,165 @@
1
+ //
2
+ // TrustDeviceSe.m
3
+ // TrustDeviceReactNative
4
+ //
5
+ // Created on 2025.11.12
6
+ //
7
+
8
+ #import "TrustDeviceSe.h"
9
+ #import <React/RCTLog.h>
10
+ #import <React/RCTConvert.h>
11
+ #import <TDMobRisk/TDMobRisk.h>
12
+
13
+ @implementation TrustDeviceSe
14
+
15
+ RCT_EXPORT_MODULE();
16
+
17
+
18
+ RCT_REMAP_METHOD(getSDKVersion,
19
+ getSDKVersionResolver:(RCTPromiseResolveBlock)resolve
20
+ rejecter:(RCTPromiseRejectBlock)reject)
21
+ {
22
+ TDDeviceManager_t *manager = [TDDeviceManager sharedManager];
23
+ NSString* version = manager->getSDKVersion();
24
+ resolve(version);
25
+ }
26
+
27
+ RCT_EXPORT_METHOD(initWithOptions:(NSDictionary*)options)
28
+ {
29
+ NSMutableDictionary* mutableOptions = [options mutableCopy];
30
+ mutableOptions[@"allowd"] = options[@"debug"];
31
+ TDDeviceManager_t *manager = [TDDeviceManager sharedManager];
32
+ manager->initWithOptions([mutableOptions copy]);
33
+ }
34
+
35
+ RCT_REMAP_METHOD(getDeviceInfo,
36
+ getDeviceInfoResolver:(RCTPromiseResolveBlock)resolve
37
+ rejecter:(RCTPromiseRejectBlock)reject)
38
+ {
39
+ TDDeviceManager_t *manager = [TDDeviceManager sharedManager];
40
+ manager->getDeviceInfo(^(TDDeviceResponse response){
41
+ int code = response.apiStatus.code;
42
+ int deviceRiskScore = response.deviceRiskScore;
43
+
44
+
45
+ NSString* fpVersion = @"";
46
+ NSString* blackBox = @"";
47
+ NSString* anonymousId = @"";
48
+ NSString* message = @"";
49
+ NSString* sealedResult = @"";
50
+
51
+ if(code == 0) {
52
+
53
+ fpVersion = response.fpVersion ? [NSString stringWithUTF8String:response.fpVersion] : @"";
54
+ blackBox = response.blackBox ? [NSString stringWithUTF8String:response.blackBox] : @"";
55
+ anonymousId = response.anonymousId ? [NSString stringWithUTF8String:response.anonymousId] : @"";
56
+ sealedResult = response.sealedResult ? [NSString stringWithUTF8String:response.sealedResult] : @"";
57
+ message = response.apiStatus.message ? [NSString stringWithUTF8String:response.apiStatus.message] : @"";
58
+ } else {
59
+ message = response.apiStatus.message ? [NSString stringWithUTF8String:response.apiStatus.message] : @"";
60
+ }
61
+
62
+ // 创建结果字典
63
+ NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];
64
+ resultDict[@"code"] = @(code);
65
+ resultDict[@"blackBox"] = blackBox;
66
+ resultDict[@"fpVersion"] = fpVersion;
67
+ resultDict[@"anonymousId"] = anonymousId;
68
+ resultDict[@"sealedResult"] = sealedResult;
69
+ resultDict[@"deviceRiskScore"] = @(deviceRiskScore);
70
+ resultDict[@"msg"] = message;
71
+
72
+ resolve(resultDict);
73
+ });
74
+ }
75
+
76
+ RCT_EXPORT_METHOD(sign:(NSString*)path
77
+ resolver:(RCTPromiseResolveBlock)resolve
78
+ rejecter:(RCTPromiseRejectBlock)reject)
79
+ {
80
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
81
+
82
+ TDAPISignResult signResult = manager->sign(path);
83
+
84
+ // 获取签名并使用
85
+ NSString* signString = signResult.sign ? [NSString stringWithUTF8String:signResult.sign] : @"";
86
+ // 获取状态码
87
+ int code = signResult.code;
88
+
89
+ // 获取错误信息
90
+ NSString* errMsgString = signResult.msg ? [NSString stringWithUTF8String:signResult.msg] : @"";
91
+
92
+ // 创建结果字典
93
+ NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];
94
+
95
+ // 添加所有字段
96
+ resultDict[@"code"] = @(code);
97
+ resultDict[@"sign"] = signString;
98
+ resultDict[@"msg"] = errMsgString;
99
+
100
+ resolve(resultDict);
101
+ }
102
+
103
+ - (UIWindow *)getKeyWindow
104
+ {
105
+ if (@available(iOS 13.0, *))
106
+ {
107
+ for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
108
+ if (windowScene.activationState == UISceneActivationStateForegroundActive)
109
+ {
110
+ for (UIWindow *window in windowScene.windows)
111
+ {
112
+ if (window.isKeyWindow)
113
+ {
114
+ return window;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ else
121
+ {
122
+ return [UIApplication sharedApplication].keyWindow;
123
+ }
124
+ return nil;
125
+ }
126
+
127
+ RCT_REMAP_METHOD(showCaptcha,
128
+ showCaptchaResolver:(RCTPromiseResolveBlock)resolve
129
+ rejecter:(RCTPromiseRejectBlock)reject)
130
+ {
131
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
132
+
133
+ dispatch_async(dispatch_get_main_queue(), ^{
134
+ UIWindow *keyWindow = [self getKeyWindow];
135
+ manager->showCaptcha(keyWindow,^(TDShowCaptchaResultStruct resultStruct) {
136
+ NSMutableDictionary *resultDictionary = [NSMutableDictionary dictionary];
137
+ switch (resultStruct.resultType) {
138
+ case TDShowCaptchaResultTypeSuccess:
139
+ resultDictionary[@"function"] = @"onSuccess";
140
+ resultDictionary[@"token"] = @(resultStruct.validateToken);
141
+ break;
142
+ case TDShowCaptchaResultTypeFailed:
143
+ resultDictionary[@"function"] = @"onFailed";
144
+ resultDictionary[@"errorCode"] = @(resultStruct.errorCode);
145
+ resultDictionary[@"errorMsg"] = @(resultStruct.errorMsg);
146
+ break;
147
+ case TDShowCaptchaResultTypeReady:
148
+ resultDictionary[@"function"] = @"onReady";
149
+ break;
150
+ default:
151
+ break;
152
+ }
153
+ resolve(resultDictionary);
154
+ });
155
+ });
156
+ }
157
+
158
+
159
+
160
+
161
+
162
+
163
+ @end
164
+
165
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-trustdevice",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "React Native TrustDevice component",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",
@@ -14,7 +14,8 @@ Pod::Spec.new do |s|
14
14
  s.authors = package['author']
15
15
  s.homepage = package['homepage']
16
16
  s.platforms = { :ios => ios_platform, :osx => "10.13", :visionos => "1.0" }
17
- s.source = { :http => ''}
17
+ # s.source = { :http => ''}
18
+ s.source = { :path => '.' }
18
19
 
19
20
  s.source_files = "ios/*.{h,m,a,xcframework}"
20
21
  s.requires_arc = true