react-native-trustdevice 0.0.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.
Files changed (47) hide show
  1. package/README.md +118 -0
  2. package/index.js +3 -0
  3. package/ios/FMDeviceManagerFramework.xcframework/Info.plist +41 -0
  4. package/ios/FMDeviceManagerFramework.xcframework/ios-arm64_armv7/FMDeviceManagerFramework.framework/FMDeviceManagerFramework +0 -0
  5. package/ios/FMDeviceManagerFramework.xcframework/ios-arm64_armv7/FMDeviceManagerFramework.framework/Headers/FMDeviceManager.h +49 -0
  6. package/ios/FMDeviceManagerFramework.xcframework/ios-arm64_armv7/FMDeviceManagerFramework.framework/Modules/module.modulemap +6 -0
  7. package/ios/FMDeviceManagerFramework.xcframework/ios-arm64_x86_64-simulator/FMDeviceManagerFramework.framework/FMDeviceManagerFramework +0 -0
  8. package/ios/FMDeviceManagerFramework.xcframework/ios-arm64_x86_64-simulator/FMDeviceManagerFramework.framework/Headers/FMDeviceManager.h +49 -0
  9. package/ios/FMDeviceManagerFramework.xcframework/ios-arm64_x86_64-simulator/FMDeviceManagerFramework.framework/Modules/module.modulemap +6 -0
  10. package/ios/TDCaptchaManager.h +63 -0
  11. package/ios/TDCaptchaResource.bundle/icon_tongdun_loading@2x.png +0 -0
  12. package/ios/TDCaptchaResource.bundle/icon_tongdun_loading@3x.png +0 -0
  13. package/ios/TDCaptchaResource.bundle/icon_tongdun_logo@2x.png +0 -0
  14. package/ios/TDCaptchaResource.bundle/icon_tongdun_logo@3x.png +0 -0
  15. package/ios/TDCaptchaResource.bundle/webview2.html +1 -0
  16. package/ios/TDMobRisk.xcframework/Info.plist +41 -0
  17. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/Headers/TDMobRisk.h +17 -0
  18. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/Headers/TDMobRiskManager.h +196 -0
  19. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/Info.plist +0 -0
  20. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/Modules/module.modulemap +6 -0
  21. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/TDMobRisk +0 -0
  22. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/_CodeSignature/CodeDirectory +0 -0
  23. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/_CodeSignature/CodeRequirements +0 -0
  24. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/_CodeSignature/CodeRequirements-1 +0 -0
  25. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/_CodeSignature/CodeResources +147 -0
  26. package/ios/TDMobRisk.xcframework/ios-arm64_armv7/TDMobRisk.framework/_CodeSignature/CodeSignature +0 -0
  27. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/Headers/TDMobRisk.h +17 -0
  28. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/Headers/TDMobRiskManager.h +196 -0
  29. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/Info.plist +0 -0
  30. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/Modules/module.modulemap +6 -0
  31. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/TDMobRisk +0 -0
  32. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/_CodeSignature/CodeDirectory +0 -0
  33. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/_CodeSignature/CodeRequirements +0 -0
  34. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/_CodeSignature/CodeRequirements-1 +0 -0
  35. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/_CodeSignature/CodeResources +147 -0
  36. package/ios/TDMobRisk.xcframework/ios-arm64_x86_64-simulator/TDMobRisk.framework/_CodeSignature/CodeSignature +0 -0
  37. package/ios/TrustDevice.h +17 -0
  38. package/ios/TrustDevice.m +114 -0
  39. package/ios/TrustDevice.xcodeproj/project.pbxproj +282 -0
  40. package/ios/TrustDevice.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  41. package/ios/TrustDevice.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  42. package/ios/TrustDevice.xcodeproj/project.xcworkspace/xcuserdata/lee.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  43. package/ios/TrustDevice.xcodeproj/xcuserdata/lee.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  44. package/ios/libTDCaptcha.a +0 -0
  45. package/package.json +26 -0
  46. package/src/TrustDevice.android.js +37 -0
  47. package/src/TrustDevice.ios.js +9 -0
@@ -0,0 +1,147 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>files</key>
6
+ <dict>
7
+ <key>Headers/TDMobRisk.h</key>
8
+ <data>
9
+ sSRrCMY5/NMMdvlTKYIsAMztlBI=
10
+ </data>
11
+ <key>Headers/TDMobRiskManager.h</key>
12
+ <data>
13
+ n+cBROcezRbuALQK06OdoJ8Kzm4=
14
+ </data>
15
+ <key>Info.plist</key>
16
+ <data>
17
+ 3mwqibX7Fcn691ZiQFDiCeWV9Eg=
18
+ </data>
19
+ <key>Modules/module.modulemap</key>
20
+ <data>
21
+ 2pOK0yhRQfLkUGWUpdmfO74W/Mg=
22
+ </data>
23
+ </dict>
24
+ <key>files2</key>
25
+ <dict>
26
+ <key>Headers/TDMobRisk.h</key>
27
+ <dict>
28
+ <key>hash</key>
29
+ <data>
30
+ sSRrCMY5/NMMdvlTKYIsAMztlBI=
31
+ </data>
32
+ <key>hash2</key>
33
+ <data>
34
+ Rc9QPI64hvt8G4XXjgmBkAk75omUsnJrPBU3rH99ZZ0=
35
+ </data>
36
+ </dict>
37
+ <key>Headers/TDMobRiskManager.h</key>
38
+ <dict>
39
+ <key>hash</key>
40
+ <data>
41
+ n+cBROcezRbuALQK06OdoJ8Kzm4=
42
+ </data>
43
+ <key>hash2</key>
44
+ <data>
45
+ BWDwNeBbI81MbRf49A+cwIhQPJsAexqnJlvT7ceMH0s=
46
+ </data>
47
+ </dict>
48
+ <key>Modules/module.modulemap</key>
49
+ <dict>
50
+ <key>hash</key>
51
+ <data>
52
+ 2pOK0yhRQfLkUGWUpdmfO74W/Mg=
53
+ </data>
54
+ <key>hash2</key>
55
+ <data>
56
+ k/1YNqeHdxf7mUj/2XA+HzTxymMVND//YA1OmiAzjeM=
57
+ </data>
58
+ </dict>
59
+ </dict>
60
+ <key>rules</key>
61
+ <dict>
62
+ <key>^.*</key>
63
+ <true/>
64
+ <key>^.*\.lproj/</key>
65
+ <dict>
66
+ <key>optional</key>
67
+ <true/>
68
+ <key>weight</key>
69
+ <real>1000</real>
70
+ </dict>
71
+ <key>^.*\.lproj/locversion.plist$</key>
72
+ <dict>
73
+ <key>omit</key>
74
+ <true/>
75
+ <key>weight</key>
76
+ <real>1100</real>
77
+ </dict>
78
+ <key>^Base\.lproj/</key>
79
+ <dict>
80
+ <key>weight</key>
81
+ <real>1010</real>
82
+ </dict>
83
+ <key>^version.plist$</key>
84
+ <true/>
85
+ </dict>
86
+ <key>rules2</key>
87
+ <dict>
88
+ <key>.*\.dSYM($|/)</key>
89
+ <dict>
90
+ <key>weight</key>
91
+ <real>11</real>
92
+ </dict>
93
+ <key>^(.*/)?\.DS_Store$</key>
94
+ <dict>
95
+ <key>omit</key>
96
+ <true/>
97
+ <key>weight</key>
98
+ <real>2000</real>
99
+ </dict>
100
+ <key>^.*</key>
101
+ <true/>
102
+ <key>^.*\.lproj/</key>
103
+ <dict>
104
+ <key>optional</key>
105
+ <true/>
106
+ <key>weight</key>
107
+ <real>1000</real>
108
+ </dict>
109
+ <key>^.*\.lproj/locversion.plist$</key>
110
+ <dict>
111
+ <key>omit</key>
112
+ <true/>
113
+ <key>weight</key>
114
+ <real>1100</real>
115
+ </dict>
116
+ <key>^Base\.lproj/</key>
117
+ <dict>
118
+ <key>weight</key>
119
+ <real>1010</real>
120
+ </dict>
121
+ <key>^Info\.plist$</key>
122
+ <dict>
123
+ <key>omit</key>
124
+ <true/>
125
+ <key>weight</key>
126
+ <real>20</real>
127
+ </dict>
128
+ <key>^PkgInfo$</key>
129
+ <dict>
130
+ <key>omit</key>
131
+ <true/>
132
+ <key>weight</key>
133
+ <real>20</real>
134
+ </dict>
135
+ <key>^embedded\.provisionprofile$</key>
136
+ <dict>
137
+ <key>weight</key>
138
+ <real>20</real>
139
+ </dict>
140
+ <key>^version\.plist$</key>
141
+ <dict>
142
+ <key>weight</key>
143
+ <real>20</real>
144
+ </dict>
145
+ </dict>
146
+ </dict>
147
+ </plist>
@@ -0,0 +1,17 @@
1
+ //
2
+ // TDMobRisk.h
3
+ // TDMobRisk
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+
8
+ //! Project version number for TDMobRisk.
9
+ FOUNDATION_EXPORT double TDMobRiskVersionNumber;
10
+
11
+ //! Project version string for TDMobRisk.
12
+ FOUNDATION_EXPORT const unsigned char TDMobRiskVersionString[];
13
+
14
+ #import "TDMobRiskManager.h"
15
+
16
+
17
+
@@ -0,0 +1,196 @@
1
+ //
2
+ // TDMobRiskManager.h
3
+ // TDMobRisk
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+
8
+ #define TDMOBRISK_SDK_VERSION @"4.2.7.1"
9
+
10
+ typedef enum {
11
+
12
+ TDLivenessShowStylePush,
13
+
14
+ TDLivenessShowStylePresent,
15
+
16
+ } TDLivenessShowStyle;
17
+
18
+ typedef enum {
19
+
20
+ // The Captcha is verified successfully, and a valid validateToken can be obtained at this time;
21
+ TDShowCaptchaResultTypeSuccess,
22
+ // If the Captcha fails, you can get the error code errorCode and errorMsg, and check the cause according to the `Error code` in the document;
23
+ TDShowCaptchaResultTypeFailed,
24
+ // The Captcha window pop-up is successful, waiting to be verified;
25
+ TDShowCaptchaResultTypeReady,
26
+
27
+ } TDShowCaptchaResultType;
28
+
29
+ typedef void(^TDGetBlackBoxAsyncBlock)(NSString* blackBox);
30
+
31
+ typedef void(^TDErrorCodeBlock)(int errorCode, const char*errorMsg);
32
+
33
+ typedef struct _TDShowCaptchaResultStruct{
34
+
35
+ // return result type
36
+ const TDShowCaptchaResultType resultType;
37
+ // After returning successfully, the token of the Captcha returned
38
+ char* const validateToken;
39
+ // After the return fails, the returned error code can be checked according to the document
40
+ const NSInteger errorCode;
41
+ // Return error message after failure
42
+ char* const errorMsg;
43
+
44
+ }TDShowCaptchaResultStruct;
45
+
46
+ typedef void(^TDShowCaptchaBlock)(TDShowCaptchaResultStruct resultStruct);
47
+
48
+ typedef enum {
49
+
50
+ // The Liveness is verified successfully;
51
+ TDLivenessResultTypeSuccess,
52
+ // If the Liveness fails, you can get the error code errorCode and errorMsg, and check the cause according to the `Error code` in the document;
53
+ TDLivenessResultTypeFailed,
54
+ // The Liveness window pop-up is successful, waiting to be verified;
55
+ TDLivenessResultTypeReady,
56
+
57
+ } TDLivenessResultType;
58
+
59
+ typedef struct _TDLivenessResultStruct{
60
+ // return result type
61
+ const TDLivenessResultType resultType;
62
+ // the seqId of the Liveness returned
63
+ char* const seqId;
64
+ // After the return fails, the returned error code can be checked according to the document
65
+ const NSInteger errorCode;
66
+ // Return error message after failure
67
+ char* const errorMsg;
68
+ // liveness score when success
69
+ double score;
70
+ // best image string
71
+ char* const bestImageString;
72
+
73
+ }TDLivenessResultStruct;
74
+
75
+ typedef void(^TDShowLivenessBlock)(TDLivenessResultStruct resultStruct);
76
+
77
+ typedef struct _TDAPISignResult{
78
+ // sign
79
+ char* sign;
80
+ // After the return fails, the returned error code can be checked according to the document
81
+ int code;
82
+ // Return error message after failure
83
+ char* msg;
84
+ }TDAPISignResult;
85
+
86
+
87
+ typedef struct _tdMobRiskVoid {
88
+ /**
89
+ * Initialization method
90
+ * @param options Initialization parameters,please see the document for details.
91
+ */
92
+ void (*initWithOptions)(NSDictionary *);
93
+ /**
94
+ * get blackBox sync, you should make sure that method calls after initWithOptions.
95
+ */
96
+ NSString *(*getBlackBox)(void);
97
+ /**
98
+ * get blackBox async, you should make sure that method calls after initWithOptions.
99
+ @usage: manager->getBlackBoxAsync(^(NSString* blackBox){});
100
+ */
101
+ void (*getBlackBoxAsync)(TDGetBlackBoxAsyncBlock block);
102
+ /**
103
+ * listen error code, use it before initWithOptions
104
+ @usage: manager->setOnErrorCodeListener(^(int errorCode,const char* errorMsg){})
105
+ */
106
+ void (*setOnErrorCodeListener)(TDErrorCodeBlock block);
107
+ /**
108
+ * Display Captcha window
109
+ * @usage: manager->showCaptcha(self.view,^(TDShowCaptchaResultStruct resultStruct) {
110
+ * });
111
+ * @param superView The parent view where the popup is displayed, UIView type
112
+ * @param block result callback block
113
+ */
114
+ void (*showCaptcha)(id superView,TDShowCaptchaBlock block);
115
+
116
+ /**
117
+ * Display Captcha window
118
+ * @usage: manager->showCaptcha(self.view,^(TDShowCaptchaResultStruct resultStruct) {
119
+ * });
120
+ * @param superView The parent view where the popup is displayed, UIView type
121
+ * @param sceneToken scene token
122
+ * @param block result callback block
123
+ */
124
+ void (*showCaptchaWithToken)(id superView,NSString* sceneToken,TDShowCaptchaBlock block);
125
+
126
+ /**
127
+ * Display Liveness window, will use [targetVC.navigationController pushViewController:lvctl animated:YES]; to show
128
+ * @usage: manager->showLivenessWithShowStyle(self,TDLivenessShowStylePresent,^(TDLivenessResultStruct resultStruct) {
129
+ * });
130
+ * @param targetVC The parent view where the popup is displayed, UIViewController type
131
+ * @param block result callback block
132
+ */
133
+ void (*showLiveness)(id targetVC,TDShowLivenessBlock block);
134
+
135
+ /**
136
+ * Display Liveness window
137
+ * @usage: manager->showLivenessWithShowStyle(self,nil,TDLivenessShowStylePresent,^(TDLivenessResultStruct resultStruct) {
138
+ * });
139
+ * @param targetVC The parent view where the popup is displayed, UIViewController type
140
+ * @param license auth license,can be nil
141
+ * @param showStyle TDLivenessShowStylePush or TDLivenessShowStylePresent
142
+ * @param block result callback block
143
+ */
144
+ void (*showLivenessWithShowStyle)(id targetVC,NSString* _Nullable license,TDLivenessShowStyle showStyle,TDShowLivenessBlock block);
145
+
146
+ /**
147
+ * upload probe data
148
+ */
149
+ void (*upload)(void);
150
+
151
+ /**
152
+ * start
153
+ */
154
+ NSString* (*start)(void);
155
+
156
+ /**
157
+ * stop
158
+ */
159
+ BOOL (*stop)(void);
160
+
161
+ /**
162
+ * getEid
163
+ */
164
+ NSString* (*getEid)(void);
165
+
166
+ /**
167
+ * Sign the queryDictionary parameter dictionary under the path
168
+ * @usage: const char* sign = manager->signWithQuery(@"login",@{@"name" : @"xiaoming"});
169
+ * @param path: network request path, such as: @"login"
170
+ * @param queryDictionary: network request parameter dictionary, such as: @{@"name" : @"xiaoming"}
171
+ */
172
+ TDAPISignResult (*signWithQuery)(NSString *path, NSDictionary<NSString*,NSString*> *queryDictionary);
173
+
174
+ /**
175
+ * Sign the queryDictionary parameter dictionary under the path
176
+ * @usage: const char* sign = manager->signWithQuery(@"login",@{@"name" : @"xiaoming"});
177
+ * @param path: network request path, such as: @"login"
178
+ * @param body: network request body string, such as: @"name=xiaoming"
179
+ */
180
+
181
+ TDAPISignResult (*signWithBody)(NSString *path, NSString *body);
182
+
183
+ /**
184
+ * get sdkVersion
185
+ */
186
+ NSString *(*getSDKVersion)(void);
187
+
188
+ } TDMobRiskManager_t;
189
+
190
+ @interface TDMobRiskManager : NSObject
191
+ /**
192
+ * get a singleton object
193
+ */
194
+ + (TDMobRiskManager_t *)sharedManager;
195
+
196
+ @end
@@ -0,0 +1,6 @@
1
+ framework module TDMobRisk {
2
+ umbrella header "TDMobRisk.h"
3
+
4
+ export *
5
+ module * { export * }
6
+ }
@@ -0,0 +1,147 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>files</key>
6
+ <dict>
7
+ <key>Headers/TDMobRisk.h</key>
8
+ <data>
9
+ sSRrCMY5/NMMdvlTKYIsAMztlBI=
10
+ </data>
11
+ <key>Headers/TDMobRiskManager.h</key>
12
+ <data>
13
+ n+cBROcezRbuALQK06OdoJ8Kzm4=
14
+ </data>
15
+ <key>Info.plist</key>
16
+ <data>
17
+ 3mwqibX7Fcn691ZiQFDiCeWV9Eg=
18
+ </data>
19
+ <key>Modules/module.modulemap</key>
20
+ <data>
21
+ 2pOK0yhRQfLkUGWUpdmfO74W/Mg=
22
+ </data>
23
+ </dict>
24
+ <key>files2</key>
25
+ <dict>
26
+ <key>Headers/TDMobRisk.h</key>
27
+ <dict>
28
+ <key>hash</key>
29
+ <data>
30
+ sSRrCMY5/NMMdvlTKYIsAMztlBI=
31
+ </data>
32
+ <key>hash2</key>
33
+ <data>
34
+ Rc9QPI64hvt8G4XXjgmBkAk75omUsnJrPBU3rH99ZZ0=
35
+ </data>
36
+ </dict>
37
+ <key>Headers/TDMobRiskManager.h</key>
38
+ <dict>
39
+ <key>hash</key>
40
+ <data>
41
+ n+cBROcezRbuALQK06OdoJ8Kzm4=
42
+ </data>
43
+ <key>hash2</key>
44
+ <data>
45
+ BWDwNeBbI81MbRf49A+cwIhQPJsAexqnJlvT7ceMH0s=
46
+ </data>
47
+ </dict>
48
+ <key>Modules/module.modulemap</key>
49
+ <dict>
50
+ <key>hash</key>
51
+ <data>
52
+ 2pOK0yhRQfLkUGWUpdmfO74W/Mg=
53
+ </data>
54
+ <key>hash2</key>
55
+ <data>
56
+ k/1YNqeHdxf7mUj/2XA+HzTxymMVND//YA1OmiAzjeM=
57
+ </data>
58
+ </dict>
59
+ </dict>
60
+ <key>rules</key>
61
+ <dict>
62
+ <key>^.*</key>
63
+ <true/>
64
+ <key>^.*\.lproj/</key>
65
+ <dict>
66
+ <key>optional</key>
67
+ <true/>
68
+ <key>weight</key>
69
+ <real>1000</real>
70
+ </dict>
71
+ <key>^.*\.lproj/locversion.plist$</key>
72
+ <dict>
73
+ <key>omit</key>
74
+ <true/>
75
+ <key>weight</key>
76
+ <real>1100</real>
77
+ </dict>
78
+ <key>^Base\.lproj/</key>
79
+ <dict>
80
+ <key>weight</key>
81
+ <real>1010</real>
82
+ </dict>
83
+ <key>^version.plist$</key>
84
+ <true/>
85
+ </dict>
86
+ <key>rules2</key>
87
+ <dict>
88
+ <key>.*\.dSYM($|/)</key>
89
+ <dict>
90
+ <key>weight</key>
91
+ <real>11</real>
92
+ </dict>
93
+ <key>^(.*/)?\.DS_Store$</key>
94
+ <dict>
95
+ <key>omit</key>
96
+ <true/>
97
+ <key>weight</key>
98
+ <real>2000</real>
99
+ </dict>
100
+ <key>^.*</key>
101
+ <true/>
102
+ <key>^.*\.lproj/</key>
103
+ <dict>
104
+ <key>optional</key>
105
+ <true/>
106
+ <key>weight</key>
107
+ <real>1000</real>
108
+ </dict>
109
+ <key>^.*\.lproj/locversion.plist$</key>
110
+ <dict>
111
+ <key>omit</key>
112
+ <true/>
113
+ <key>weight</key>
114
+ <real>1100</real>
115
+ </dict>
116
+ <key>^Base\.lproj/</key>
117
+ <dict>
118
+ <key>weight</key>
119
+ <real>1010</real>
120
+ </dict>
121
+ <key>^Info\.plist$</key>
122
+ <dict>
123
+ <key>omit</key>
124
+ <true/>
125
+ <key>weight</key>
126
+ <real>20</real>
127
+ </dict>
128
+ <key>^PkgInfo$</key>
129
+ <dict>
130
+ <key>omit</key>
131
+ <true/>
132
+ <key>weight</key>
133
+ <real>20</real>
134
+ </dict>
135
+ <key>^embedded\.provisionprofile$</key>
136
+ <dict>
137
+ <key>weight</key>
138
+ <real>20</real>
139
+ </dict>
140
+ <key>^version\.plist$</key>
141
+ <dict>
142
+ <key>weight</key>
143
+ <real>20</real>
144
+ </dict>
145
+ </dict>
146
+ </dict>
147
+ </plist>
@@ -0,0 +1,17 @@
1
+ //
2
+ // TrustDevice.h
3
+ // TrustDeviceReactNative
4
+ //
5
+ // Created by LEE on 7/12/24.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <React/RCTBridgeModule.h>
10
+
11
+ NS_ASSUME_NONNULL_BEGIN
12
+
13
+ @interface TrustDevice : NSObject <RCTBridgeModule>
14
+
15
+ @end
16
+
17
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,114 @@
1
+ //
2
+ // TrustDevice.m
3
+ // TrustDeviceReactNative
4
+ //
5
+ // Created by LEE on 7/12/24.
6
+ //
7
+
8
+ #import "TrustDevice.h"
9
+ #import <React/RCTLog.h>
10
+ #import <React/RCTConvert.h>
11
+ #import <TDMobRisk/TDMobRisk.h>
12
+
13
+ @implementation TrustDevice
14
+
15
+ RCT_EXPORT_MODULE();
16
+
17
+
18
+ RCT_REMAP_METHOD(getSDKVersion,
19
+ getSDKVersionResolver:(RCTPromiseResolveBlock)resolve
20
+ rejecter:(RCTPromiseRejectBlock)reject)
21
+ {
22
+ TDMobRiskManager_t *manager = [TDMobRiskManager 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
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
32
+ manager->initWithOptions([mutableOptions copy]);
33
+ }
34
+
35
+ RCT_REMAP_METHOD(getBlackBox,
36
+ getBlackBoxResolver:(RCTPromiseResolveBlock)resolve
37
+ rejecter:(RCTPromiseRejectBlock)reject)
38
+ {
39
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
40
+ NSString* blackBox = manager->getBlackBox();
41
+ resolve(blackBox);
42
+ }
43
+
44
+ RCT_REMAP_METHOD(getBlackBoxAsync,
45
+ getBlackBoxAsyncResolver:(RCTPromiseResolveBlock)resolve
46
+ rejecter:(RCTPromiseRejectBlock)reject)
47
+ {
48
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
49
+ manager->getBlackBoxAsync(^(NSString* blackBox){
50
+ resolve(blackBox);
51
+ });
52
+ }
53
+
54
+ - (UIWindow *)getKeyWindow
55
+ {
56
+ if (@available(iOS 13.0, *))
57
+ {
58
+ for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
59
+ if (windowScene.activationState == UISceneActivationStateForegroundActive)
60
+ {
61
+ for (UIWindow *window in windowScene.windows)
62
+ {
63
+ if (window.isKeyWindow)
64
+ {
65
+ return window;
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ else
72
+ {
73
+ return [UIApplication sharedApplication].keyWindow;
74
+ }
75
+ return nil;
76
+ }
77
+
78
+ RCT_REMAP_METHOD(showCaptcha,
79
+ showCaptchaResolver:(RCTPromiseResolveBlock)resolve
80
+ rejecter:(RCTPromiseRejectBlock)reject)
81
+ {
82
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
83
+
84
+ dispatch_async(dispatch_get_main_queue(), ^{
85
+ UIWindow *keyWindow = [self getKeyWindow];
86
+ manager->showCaptcha(keyWindow,^(TDShowCaptchaResultStruct resultStruct) {
87
+ NSMutableDictionary *resultDictionary = [NSMutableDictionary dictionary];
88
+ switch (resultStruct.resultType) {
89
+ case TDShowCaptchaResultTypeSuccess:
90
+ resultDictionary[@"function"] = @"onSuccess";
91
+ resultDictionary[@"token"] = @(resultStruct.validateToken);
92
+ break;
93
+ case TDShowCaptchaResultTypeFailed:
94
+ resultDictionary[@"function"] = @"onFailed";
95
+ resultDictionary[@"errorCode"] = @(resultStruct.errorCode);
96
+ resultDictionary[@"errorMsg"] = @(resultStruct.errorMsg);
97
+ break;
98
+ case TDShowCaptchaResultTypeReady:
99
+ resultDictionary[@"function"] = @"onReady";
100
+ break;
101
+ default:
102
+ break;
103
+ }
104
+ resolve(resultDictionary);
105
+ });
106
+ });
107
+ }
108
+
109
+
110
+
111
+
112
+
113
+
114
+ @end