react-native-trustdevice 1.1.3 → 1.1.5
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 +4 -4
- package/android/build/.transforms/34a3c3baa7ee620e604d2c62960577c0/transformed/classes/classes.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1961
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdevicePackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/trustdevice/utils/TDUniRiskUtils.class +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1453
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +9 -18
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +2 -12
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/trustdevice/TrustdevicePackage.java +1 -1
- package/android/src/main/java/com/trustdevice/TrustdeviceSeModule.java +126 -0
- package/android/src/main/java/com/trustdevice/utils/TDUniRiskUtils.java +202 -12
- package/ios/TrustDevice.m +16 -1
- package/ios/TrustDeviceSe.h +17 -0
- package/ios/TrustDeviceSe.m +180 -0
- package/package.json +6 -2
- package/react-native-trustdevice.podspec +2 -1
- package/android/.gradle/8.10/checksums/checksums.lock +0 -0
- package/android/.gradle/8.10/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.10/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.10/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/nb-cache/trust/6BEC0066B99297FC163AB3C2D5CC7668CDC2525F18622C2FFD1FE9D77756146A +0 -1
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build/.transforms/41053347d20d0a776c1e1d56e9cc047e/transformed/classes/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/com/trustdevice/BuildConfig.java +0 -10
- package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/javac/debug/classes/com/trustdevice/BuildConfig.class +0 -0
- package/android/build/intermediates/merged_java_res/debug/feature-react-native-trustdevice.jar +0 -0
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
- package/android/build/outputs/aar/react-native-trustdevice-debug.aar +0 -0
- /package/android/build/.transforms/{41053347d20d0a776c1e1d56e9cc047e → 34a3c3baa7ee620e604d2c62960577c0}/results.bin +0 -0
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
-- Merging decision tree log ---
|
|
2
2
|
manifest
|
|
3
|
-
ADDED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:1-
|
|
4
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:1-
|
|
5
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:1-5:12
|
|
3
|
+
ADDED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:1-4:12
|
|
4
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:1-4:12
|
|
6
5
|
package
|
|
7
|
-
|
|
8
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
9
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
6
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
10
7
|
xmlns:android
|
|
11
|
-
ADDED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:11-69
|
|
8
|
+
ADDED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml:2:11-69
|
|
12
9
|
uses-sdk
|
|
13
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
|
14
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
15
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
16
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
17
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
10
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
|
|
11
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
12
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
18
13
|
android:targetSdkVersion
|
|
19
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
20
|
-
ADDED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
21
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
14
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
22
15
|
android:minSdkVersion
|
|
23
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
24
|
-
ADDED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
25
|
-
INJECTED from /Users/rhett/Code/dun/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
16
|
+
INJECTED from /Users/rhett/Code/dun/reactnew/TrustDeviceReactNative/node_modules/react-native-trustdevice/android/src/main/AndroidManifest.xml
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
buildscript {
|
|
3
|
-
repositories {
|
|
4
|
-
google()
|
|
5
|
-
mavenCentral()
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
dependencies {
|
|
9
|
-
classpath("com.android.tools.build:gradle:4.1.3")
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
1
|
apply plugin: 'com.android.library'
|
|
14
2
|
|
|
15
3
|
android {
|
|
4
|
+
namespace 'com.trustdevice' // 添加这一行,AGP8.0+需要namespace
|
|
5
|
+
|
|
16
6
|
compileSdkVersion 34
|
|
17
7
|
|
|
18
8
|
defaultConfig {
|
|
@@ -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,13 @@ 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_DATACENTER = "dataCenter";
|
|
17
|
+
static final String KEY_CHANNEL = "channel";
|
|
15
18
|
static final String KEY_DEBUG = "debug";
|
|
16
19
|
static final String KEY_TIME_LIMIT = "timeLimit";
|
|
17
20
|
static final String KEY_LOCATION = "location";
|
|
18
21
|
static final String KEY_COLLECT_LEVEL = "collectLevel";
|
|
22
|
+
static final String KEY_CUSTOM_MESSAGE = "customMessage";
|
|
19
23
|
|
|
20
24
|
///Android device fingerprint configuration
|
|
21
25
|
static final String KEY_FP_ANDROID_RUNNING_TASKS = "runningTasks";
|
|
@@ -25,6 +29,9 @@ public class TDUniRiskUtils {
|
|
|
25
29
|
static final String KEY_FP_ANDROID_WIFIMAC = "wifiMac";
|
|
26
30
|
|
|
27
31
|
static final String KEY_FP_ANDROID_GOOGLE_AID = "googleAid";
|
|
32
|
+
static final String KEY_FP_ANDROID_OAID = "OAID";
|
|
33
|
+
static final String KEY_FP_ANDROID_AID = "AID";
|
|
34
|
+
static final String KEY_FP_ANDROID_ANDROID_ID = "ANDROID_ID";
|
|
28
35
|
|
|
29
36
|
///Android device Captcha configuration
|
|
30
37
|
static final String KEY_CAPTCHA_LANGUAGE = "language";
|
|
@@ -36,6 +43,170 @@ public class TDUniRiskUtils {
|
|
|
36
43
|
static final String KEY_CAPTCHA_SKIP_CAPTCHA = "skipCaptcha";
|
|
37
44
|
static final String KEY_CAPTCHA_MFAID = "mfaId";
|
|
38
45
|
|
|
46
|
+
public static TDDeviceManager.Builder mapToBuilderSe(Map<String, Object> configMap) {
|
|
47
|
+
TDDeviceManager.Builder builder = null;
|
|
48
|
+
if (configMap == null) {
|
|
49
|
+
return builder;
|
|
50
|
+
}
|
|
51
|
+
builder = new TDDeviceManager.Builder();
|
|
52
|
+
if (configMap.containsKey(KEY_PARTNER)) {
|
|
53
|
+
builder.partner((String) configMap.get(KEY_PARTNER));
|
|
54
|
+
}
|
|
55
|
+
if (configMap.containsKey(KEY_APPKEY)) {
|
|
56
|
+
builder.appKey((String) configMap.get(KEY_APPKEY));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// if (configMap.containsKey(KEY_APPNAME)) {
|
|
60
|
+
// builder.appName((String) configMap.get(KEY_APPNAME));
|
|
61
|
+
// }
|
|
62
|
+
|
|
63
|
+
if (configMap.containsKey(KEY_APPNAME)) {
|
|
64
|
+
builder.channel((String) configMap.get(KEY_APPNAME));
|
|
65
|
+
}
|
|
66
|
+
if (configMap.containsKey(KEY_CHANNEL)) {
|
|
67
|
+
builder.channel((String) configMap.get(KEY_CHANNEL));
|
|
68
|
+
}
|
|
69
|
+
if (configMap.containsKey(KEY_COUNTRY)) {
|
|
70
|
+
String country = (String) configMap.get(KEY_COUNTRY);
|
|
71
|
+
if (!TextUtils.isEmpty(country)) {
|
|
72
|
+
builder.country(country.toUpperCase());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (configMap.containsKey(KEY_DATACENTER)) {
|
|
76
|
+
String dataCenter = (String) configMap.get(KEY_DATACENTER);
|
|
77
|
+
if (!TextUtils.isEmpty(dataCenter)) {
|
|
78
|
+
builder.country(dataCenter.toUpperCase());
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// if (configMap.containsKey(KEY_URL)) {
|
|
82
|
+
// String url = (String) configMap.get(KEY_URL);
|
|
83
|
+
// if (!TextUtils.isEmpty(url)) {
|
|
84
|
+
// builder.url(url);
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// if (configMap.containsKey(KEY_PROFILE_URL)) {
|
|
88
|
+
// String url = (String) configMap.get(KEY_PROFILE_URL);
|
|
89
|
+
// if (!TextUtils.isEmpty(url)) {
|
|
90
|
+
// builder.url(url);
|
|
91
|
+
// }
|
|
92
|
+
// }
|
|
93
|
+
if (configMap.containsKey(KEY_DEBUG)) {
|
|
94
|
+
Object debug = configMap.get(KEY_DEBUG);
|
|
95
|
+
if (debug != null) {
|
|
96
|
+
if (!(boolean) debug)
|
|
97
|
+
builder.disableDebugger();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (configMap.containsKey(KEY_TIME_LIMIT)) {
|
|
101
|
+
Object timeLimit = configMap.get(KEY_TIME_LIMIT);
|
|
102
|
+
if (timeLimit != null) {
|
|
103
|
+
builder.httpTimeOut(((int) timeLimit) * 1000);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (configMap.containsKey(KEY_LOCATION)) {
|
|
108
|
+
Object location = configMap.get(KEY_LOCATION);
|
|
109
|
+
if (location != null) {
|
|
110
|
+
if (!(boolean) location)
|
|
111
|
+
builder.disableGPS();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// if (configMap.containsKey(KEY_COLLECT_LEVEL)) {
|
|
116
|
+
// String collectLevel = (String) configMap.get(KEY_COLLECT_LEVEL);
|
|
117
|
+
// if ("M".equals(collectLevel)) {
|
|
118
|
+
// builder.collectLevel(TDRisk.COLLECT_LEVEL_M);
|
|
119
|
+
// } else if ("L".equals(collectLevel)) {
|
|
120
|
+
// builder.collectLevel(TDRisk.COLLECT_LEVEL_L);
|
|
121
|
+
// }
|
|
122
|
+
// }
|
|
123
|
+
|
|
124
|
+
if (configMap.containsKey(KEY_CUSTOM_MESSAGE)) {
|
|
125
|
+
String customMessage = (String) configMap.get(KEY_CUSTOM_MESSAGE);
|
|
126
|
+
if (customMessage != null) {
|
|
127
|
+
builder.customMessage(customMessage);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
///Android device fingerprint configuration
|
|
133
|
+
if (configMap.containsKey(KEY_FP_ANDROID_RUNNING_TASKS)) {
|
|
134
|
+
Object runningTasks = configMap.get(KEY_FP_ANDROID_RUNNING_TASKS);
|
|
135
|
+
if (runningTasks != null) {
|
|
136
|
+
if (!(boolean) runningTasks)
|
|
137
|
+
builder.disableRunningTasks();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (configMap.containsKey(KEY_FP_ANDROID_SENSOR)) {
|
|
141
|
+
Object sensor = configMap.get(KEY_FP_ANDROID_SENSOR);
|
|
142
|
+
if (sensor != null) {
|
|
143
|
+
if (!(boolean) sensor)
|
|
144
|
+
builder.disableSensor();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (configMap.containsKey(KEY_FP_ANDROID_READ_PHONE)) {
|
|
148
|
+
Object readPhone = configMap.get(KEY_FP_ANDROID_READ_PHONE);
|
|
149
|
+
if (readPhone != null) {
|
|
150
|
+
if (!(boolean) readPhone)
|
|
151
|
+
builder.disableReadPhone();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (configMap.containsKey(KEY_FP_ANDROID_INSTALLPACKAGE_LIST)) {
|
|
155
|
+
Object installPackageList = configMap.get(KEY_FP_ANDROID_INSTALLPACKAGE_LIST);
|
|
156
|
+
if (installPackageList != null) {
|
|
157
|
+
if (!(boolean) installPackageList)
|
|
158
|
+
builder.disableInstallPackageList();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// if (configMap.containsKey(KEY_FP_ANDROID_WIFIMAC)) {
|
|
163
|
+
// Object wifiMac = configMap.get(KEY_FP_ANDROID_WIFIMAC);
|
|
164
|
+
// if (wifiMac != null) {
|
|
165
|
+
// if (!(boolean) wifiMac) {
|
|
166
|
+
// builder.disableWifiMac();
|
|
167
|
+
// } else {
|
|
168
|
+
// builder.enableWifiMac();
|
|
169
|
+
// }
|
|
170
|
+
// }
|
|
171
|
+
// }
|
|
172
|
+
|
|
173
|
+
if (configMap.containsKey(KEY_FP_ANDROID_GOOGLE_AID)) {
|
|
174
|
+
Object enableGoogleAid = configMap.get(KEY_FP_ANDROID_GOOGLE_AID);
|
|
175
|
+
if (enableGoogleAid != null) {
|
|
176
|
+
if (!(boolean) enableGoogleAid)
|
|
177
|
+
builder.disableGoogleAid();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (configMap.containsKey(KEY_FP_ANDROID_OAID)) {
|
|
182
|
+
Object oaid = configMap.get(KEY_FP_ANDROID_OAID);
|
|
183
|
+
if (oaid != null) {
|
|
184
|
+
if (!(boolean) oaid )
|
|
185
|
+
builder.disableOptions(TDDeviceManager.OPTION_OAID);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (configMap.containsKey(KEY_FP_ANDROID_AID)) {
|
|
189
|
+
Object aid = configMap.get(KEY_FP_ANDROID_AID);
|
|
190
|
+
if (aid != null) {
|
|
191
|
+
if (!(boolean) aid)
|
|
192
|
+
builder.disableOptions(TDDeviceManager.OPTION_AID);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (configMap.containsKey(KEY_FP_ANDROID_ANDROID_ID)) {
|
|
196
|
+
Object androidID = configMap.get(KEY_FP_ANDROID_ANDROID_ID);
|
|
197
|
+
if (androidID != null) {
|
|
198
|
+
if (!(boolean) androidID)
|
|
199
|
+
builder.disableOptions(TDDeviceManager.OPTION_ANDROID_ID);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
return builder;
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
39
210
|
/**
|
|
40
211
|
* 转换configMap成builder
|
|
41
212
|
*
|
|
@@ -48,13 +219,19 @@ public class TDUniRiskUtils {
|
|
|
48
219
|
return builder;
|
|
49
220
|
builder = new TDRisk.Builder();
|
|
50
221
|
if (configMap.containsKey(KEY_PARTNER)) {
|
|
51
|
-
builder.
|
|
222
|
+
builder.partner((String) configMap.get(KEY_PARTNER));
|
|
52
223
|
}
|
|
53
224
|
if (configMap.containsKey(KEY_APPKEY)) {
|
|
54
225
|
builder.appKey((String) configMap.get(KEY_APPKEY));
|
|
55
226
|
}
|
|
227
|
+
// if (configMap.containsKey(KEY_APPNAME)) {
|
|
228
|
+
// builder.appName((String) configMap.get(KEY_APPNAME));
|
|
229
|
+
// }
|
|
56
230
|
if (configMap.containsKey(KEY_APPNAME)) {
|
|
57
|
-
builder.
|
|
231
|
+
builder.channel((String) configMap.get(KEY_APPNAME));
|
|
232
|
+
}
|
|
233
|
+
if (configMap.containsKey(KEY_CHANNEL)) {
|
|
234
|
+
builder.channel((String) configMap.get(KEY_CHANNEL));
|
|
58
235
|
}
|
|
59
236
|
if (configMap.containsKey(KEY_COUNTRY)) {
|
|
60
237
|
String country = (String) configMap.get(KEY_COUNTRY);
|
|
@@ -62,6 +239,12 @@ public class TDUniRiskUtils {
|
|
|
62
239
|
builder.country(country.toUpperCase());
|
|
63
240
|
}
|
|
64
241
|
}
|
|
242
|
+
if (configMap.containsKey(KEY_DATACENTER)) {
|
|
243
|
+
String dataCenter = (String) configMap.get(KEY_DATACENTER);
|
|
244
|
+
if (!TextUtils.isEmpty(dataCenter)) {
|
|
245
|
+
builder.country(dataCenter.toUpperCase());
|
|
246
|
+
}
|
|
247
|
+
}
|
|
65
248
|
if (configMap.containsKey(KEY_DEBUG)) {
|
|
66
249
|
Object debug = configMap.get(KEY_DEBUG);
|
|
67
250
|
if (debug != null) {
|
|
@@ -119,16 +302,16 @@ public class TDUniRiskUtils {
|
|
|
119
302
|
builder.disableInstallPackageList();
|
|
120
303
|
}
|
|
121
304
|
}
|
|
122
|
-
if (configMap.containsKey(KEY_FP_ANDROID_WIFIMAC)) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
305
|
+
// if (configMap.containsKey(KEY_FP_ANDROID_WIFIMAC)) {
|
|
306
|
+
// Object wifiMac = configMap.get(KEY_FP_ANDROID_WIFIMAC);
|
|
307
|
+
// if (wifiMac != null) {
|
|
308
|
+
// if (!(boolean) wifiMac) {
|
|
309
|
+
// builder.disableWifiMac();
|
|
310
|
+
// } else {
|
|
311
|
+
// builder.enableWifiMac();
|
|
312
|
+
// }
|
|
313
|
+
// }
|
|
314
|
+
// }
|
|
132
315
|
if (configMap.containsKey(KEY_FP_ANDROID_GOOGLE_AID)) {
|
|
133
316
|
Object googleAid = configMap.get(KEY_FP_ANDROID_GOOGLE_AID);
|
|
134
317
|
if (googleAid != null) {
|
|
@@ -190,6 +373,13 @@ public class TDUniRiskUtils {
|
|
|
190
373
|
builder.mfaId((String) mfaIdObj);
|
|
191
374
|
}
|
|
192
375
|
}
|
|
376
|
+
// 补充
|
|
377
|
+
if (configMap.containsKey(KEY_CUSTOM_MESSAGE)) {
|
|
378
|
+
String customMessage = (String) configMap.get(KEY_CUSTOM_MESSAGE);
|
|
379
|
+
if (customMessage != null) {
|
|
380
|
+
builder.customMessage(customMessage);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
193
383
|
return builder;
|
|
194
384
|
}
|
|
195
385
|
}
|
package/ios/TrustDevice.m
CHANGED
|
@@ -27,7 +27,22 @@ RCT_REMAP_METHOD(getSDKVersion,
|
|
|
27
27
|
RCT_EXPORT_METHOD(initWithOptions:(NSDictionary*)options)
|
|
28
28
|
{
|
|
29
29
|
NSMutableDictionary* mutableOptions = [options mutableCopy];
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
// 1. 判断 debug 是否为空(nil 或 NSNull)
|
|
32
|
+
id debugValue = options[@"debug"];
|
|
33
|
+
if (debugValue && debugValue != [NSNull null]) {
|
|
34
|
+
mutableOptions[@"allowd"] = debugValue; // 原逻辑保留
|
|
35
|
+
} else {
|
|
36
|
+
// debug 为空时,可能设置默认值或不设置
|
|
37
|
+
mutableOptions[@"allowd"] = @(NO); // 示例默认 false
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 2. 增加 dataCenter 赋值给 country
|
|
41
|
+
id dataCenter = options[@"dataCenter"];
|
|
42
|
+
if (dataCenter && dataCenter != [NSNull null]) {
|
|
43
|
+
mutableOptions[@"country"] = dataCenter;
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
|
|
32
47
|
manager->initWithOptions([mutableOptions copy]);
|
|
33
48
|
}
|
|
@@ -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
|