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
|
@@ -0,0 +1,180 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
46
|
+
TDDeviceManager_t *manager = [TDDeviceManager sharedManager];
|
|
47
|
+
manager->initWithOptions([mutableOptions copy]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
RCT_REMAP_METHOD(getDeviceInfo,
|
|
51
|
+
getDeviceInfoResolver:(RCTPromiseResolveBlock)resolve
|
|
52
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
53
|
+
{
|
|
54
|
+
TDDeviceManager_t *manager = [TDDeviceManager sharedManager];
|
|
55
|
+
manager->getDeviceInfo(^(TDDeviceResponse response){
|
|
56
|
+
int code = response.apiStatus.code;
|
|
57
|
+
int deviceRiskScore = response.deviceRiskScore;
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
NSString* fpVersion = @"";
|
|
61
|
+
NSString* blackBox = @"";
|
|
62
|
+
NSString* anonymousId = @"";
|
|
63
|
+
NSString* message = @"";
|
|
64
|
+
NSString* sealedResult = @"";
|
|
65
|
+
|
|
66
|
+
if(code == 0) {
|
|
67
|
+
|
|
68
|
+
fpVersion = response.fpVersion ? [NSString stringWithUTF8String:response.fpVersion] : @"";
|
|
69
|
+
blackBox = response.blackBox ? [NSString stringWithUTF8String:response.blackBox] : @"";
|
|
70
|
+
anonymousId = response.anonymousId ? [NSString stringWithUTF8String:response.anonymousId] : @"";
|
|
71
|
+
sealedResult = response.sealedResult ? [NSString stringWithUTF8String:response.sealedResult] : @"";
|
|
72
|
+
message = response.apiStatus.message ? [NSString stringWithUTF8String:response.apiStatus.message] : @"";
|
|
73
|
+
} else {
|
|
74
|
+
message = response.apiStatus.message ? [NSString stringWithUTF8String:response.apiStatus.message] : @"";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 创建结果字典
|
|
78
|
+
NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];
|
|
79
|
+
resultDict[@"code"] = @(code);
|
|
80
|
+
resultDict[@"blackBox"] = blackBox;
|
|
81
|
+
resultDict[@"fpVersion"] = fpVersion;
|
|
82
|
+
resultDict[@"anonymousId"] = anonymousId;
|
|
83
|
+
resultDict[@"sealedResult"] = sealedResult;
|
|
84
|
+
resultDict[@"deviceRiskScore"] = @(deviceRiskScore);
|
|
85
|
+
resultDict[@"msg"] = message;
|
|
86
|
+
|
|
87
|
+
resolve(resultDict);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
RCT_EXPORT_METHOD(sign:(NSString*)path
|
|
92
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
93
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
94
|
+
{
|
|
95
|
+
TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
|
|
96
|
+
|
|
97
|
+
TDAPISignResult signResult = manager->sign(path);
|
|
98
|
+
|
|
99
|
+
// 获取签名并使用
|
|
100
|
+
NSString* signString = signResult.sign ? [NSString stringWithUTF8String:signResult.sign] : @"";
|
|
101
|
+
// 获取状态码
|
|
102
|
+
int code = signResult.code;
|
|
103
|
+
|
|
104
|
+
// 获取错误信息
|
|
105
|
+
NSString* errMsgString = signResult.msg ? [NSString stringWithUTF8String:signResult.msg] : @"";
|
|
106
|
+
|
|
107
|
+
// 创建结果字典
|
|
108
|
+
NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];
|
|
109
|
+
|
|
110
|
+
// 添加所有字段
|
|
111
|
+
resultDict[@"code"] = @(code);
|
|
112
|
+
resultDict[@"sign"] = signString;
|
|
113
|
+
resultDict[@"msg"] = errMsgString;
|
|
114
|
+
|
|
115
|
+
resolve(resultDict);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
- (UIWindow *)getKeyWindow
|
|
119
|
+
{
|
|
120
|
+
if (@available(iOS 13.0, *))
|
|
121
|
+
{
|
|
122
|
+
for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
|
|
123
|
+
if (windowScene.activationState == UISceneActivationStateForegroundActive)
|
|
124
|
+
{
|
|
125
|
+
for (UIWindow *window in windowScene.windows)
|
|
126
|
+
{
|
|
127
|
+
if (window.isKeyWindow)
|
|
128
|
+
{
|
|
129
|
+
return window;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else
|
|
136
|
+
{
|
|
137
|
+
return [UIApplication sharedApplication].keyWindow;
|
|
138
|
+
}
|
|
139
|
+
return nil;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
RCT_REMAP_METHOD(showCaptcha,
|
|
143
|
+
showCaptchaResolver:(RCTPromiseResolveBlock)resolve
|
|
144
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
145
|
+
{
|
|
146
|
+
TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
|
|
147
|
+
|
|
148
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
149
|
+
UIWindow *keyWindow = [self getKeyWindow];
|
|
150
|
+
manager->showCaptcha(keyWindow,^(TDShowCaptchaResultStruct resultStruct) {
|
|
151
|
+
NSMutableDictionary *resultDictionary = [NSMutableDictionary dictionary];
|
|
152
|
+
switch (resultStruct.resultType) {
|
|
153
|
+
case TDShowCaptchaResultTypeSuccess:
|
|
154
|
+
resultDictionary[@"function"] = @"onSuccess";
|
|
155
|
+
resultDictionary[@"token"] = @(resultStruct.validateToken);
|
|
156
|
+
break;
|
|
157
|
+
case TDShowCaptchaResultTypeFailed:
|
|
158
|
+
resultDictionary[@"function"] = @"onFailed";
|
|
159
|
+
resultDictionary[@"errorCode"] = @(resultStruct.errorCode);
|
|
160
|
+
resultDictionary[@"errorMsg"] = @(resultStruct.errorMsg);
|
|
161
|
+
break;
|
|
162
|
+
case TDShowCaptchaResultTypeReady:
|
|
163
|
+
resultDictionary[@"function"] = @"onReady";
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
resolve(resultDictionary);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@end
|
|
179
|
+
|
|
180
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-trustdevice",
|
|
3
|
-
"
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "1.1.5",
|
|
4
7
|
"description": "React Native TrustDevice component",
|
|
5
8
|
"main": "index.js",
|
|
6
9
|
"react-native": "index.js",
|
|
@@ -25,9 +28,10 @@
|
|
|
25
28
|
"index.d.ts",
|
|
26
29
|
"react-native-trustdevice.podspec"
|
|
27
30
|
],
|
|
31
|
+
|
|
28
32
|
"homepage": "https://trustdecision.com",
|
|
29
33
|
"peerDependencies": {
|
|
30
34
|
"react": "*",
|
|
31
35
|
"react-native": "*"
|
|
32
36
|
}
|
|
33
|
-
}
|
|
37
|
+
}
|
|
@@ -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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
78098113B327001A7ADBB2DD53260281F0DC0024D59151B959C636AEF9B80944
|
|
File without changes
|
package/android/build/.transforms/41053347d20d0a776c1e1d56e9cc047e/transformed/classes/classes.dex
DELETED
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Automatically generated file. DO NOT MODIFY
|
|
3
|
-
*/
|
|
4
|
-
package com.trustdevice;
|
|
5
|
-
|
|
6
|
-
public final class BuildConfig {
|
|
7
|
-
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
|
8
|
-
public static final String LIBRARY_PACKAGE_NAME = "com.trustdevice";
|
|
9
|
-
public static final String BUILD_TYPE = "debug";
|
|
10
|
-
}
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
package/android/build/intermediates/merged_java_res/debug/feature-react-native-trustdevice.jar
DELETED
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"artifactType": {
|
|
4
|
-
"type": "PACKAGED_MANIFESTS",
|
|
5
|
-
"kind": "Directory"
|
|
6
|
-
},
|
|
7
|
-
"applicationId": "com.trustdevice",
|
|
8
|
-
"variantName": "debug",
|
|
9
|
-
"elements": [
|
|
10
|
-
{
|
|
11
|
-
"type": "SINGLE",
|
|
12
|
-
"filters": [],
|
|
13
|
-
"attributes": [],
|
|
14
|
-
"outputFile": "../../merged_manifest/debug/AndroidManifest.xml"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"elementType": "File"
|
|
18
|
-
}
|
|
Binary file
|
|
File without changes
|