@reclaimprotocol/inapp-rn-sdk 0.2.1 → 0.3.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/InappRnSdk.podspec +1 -1
- package/README.md +8 -6
- package/android/build.gradle +3 -3
- package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +13 -5
- package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +11 -4
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +10 -3
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +168 -12
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +49 -8
- package/ios/InappRnSdk.mm +33 -6
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +32 -8
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +53 -3
- package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +10 -3
- package/ios/generated/RNInappRnSdkSpecJSI.h +168 -12
- package/ios/inapp_rn_sdk/Api.swift +71 -20
- package/lib/commonjs/index.js +126 -30
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/{ReclaimVerificationPlatformChannel.js → platform.js} +48 -106
- package/lib/commonjs/platform.js.map +1 -0
- package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/module/index.js +127 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/{ReclaimVerificationPlatformChannel.js → platform.js} +46 -103
- package/lib/module/platform.js.map +1 -0
- package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +140 -8
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/platform.d.ts +18 -0
- package/lib/typescript/commonjs/src/platform.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +18 -2
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +140 -8
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/platform.d.ts +18 -0
- package/lib/typescript/module/src/platform.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +18 -2
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +260 -18
- package/src/platform.ts +218 -0
- package/src/specs/NativeInappRnSdk.ts +21 -2
- package/lib/commonjs/ReclaimVerificationPlatformChannel.js.map +0 -1
- package/lib/commonjs/types/proof.js +0 -16
- package/lib/commonjs/types/proof.js.map +0 -1
- package/lib/module/ReclaimVerificationPlatformChannel.js.map +0 -1
- package/lib/module/types/proof.js +0 -12
- package/lib/module/types/proof.js.map +0 -1
- package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts +0 -107
- package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/proof.d.ts +0 -33
- package/lib/typescript/commonjs/src/types/proof.d.ts.map +0 -1
- package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts +0 -107
- package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts.map +0 -1
- package/lib/typescript/module/src/types/proof.d.ts +0 -33
- package/lib/typescript/module/src/types/proof.d.ts.map +0 -1
- package/src/ReclaimVerificationPlatformChannel.ts +0 -363
- package/src/types/proof.ts +0 -44
|
@@ -31,14 +31,18 @@
|
|
|
31
31
|
{
|
|
32
32
|
_eventEmitterCallback("onSessionUpdateRequest", value);
|
|
33
33
|
}
|
|
34
|
-
- (void)emitOnSessionIdentityUpdate:(NSDictionary *)value
|
|
35
|
-
{
|
|
36
|
-
_eventEmitterCallback("onSessionIdentityUpdate", value);
|
|
37
|
-
}
|
|
38
34
|
- (void)emitOnProviderInformationRequest:(NSDictionary *)value
|
|
39
35
|
{
|
|
40
36
|
_eventEmitterCallback("onProviderInformationRequest", value);
|
|
41
37
|
}
|
|
38
|
+
- (void)emitOnReclaimAttestorAuthRequest:(NSDictionary *)value
|
|
39
|
+
{
|
|
40
|
+
_eventEmitterCallback("onReclaimAttestorAuthRequest", value);
|
|
41
|
+
}
|
|
42
|
+
- (void)emitOnSessionIdentityUpdate:(NSDictionary *)value
|
|
43
|
+
{
|
|
44
|
+
_eventEmitterCallback("onSessionIdentityUpdate", value);
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
44
48
|
{
|
|
@@ -94,6 +98,18 @@
|
|
|
94
98
|
return facebook::react::managedPointer<JS::NativeInappRnSdk::Overrides>(json);
|
|
95
99
|
}
|
|
96
100
|
@end
|
|
101
|
+
@implementation RCTCxxConvert (NativeInappRnSdk_VerificationOptions)
|
|
102
|
+
+ (RCTManagedPointer *)JS_NativeInappRnSdk_VerificationOptions:(id)json
|
|
103
|
+
{
|
|
104
|
+
return facebook::react::managedPointer<JS::NativeInappRnSdk::VerificationOptions>(json);
|
|
105
|
+
}
|
|
106
|
+
@end
|
|
107
|
+
@implementation RCTCxxConvert (NativeInappRnSdk_VerificationOptionsOptional)
|
|
108
|
+
+ (RCTManagedPointer *)JS_NativeInappRnSdk_VerificationOptionsOptional:(id)json
|
|
109
|
+
{
|
|
110
|
+
return facebook::react::managedPointer<JS::NativeInappRnSdk::VerificationOptionsOptional>(json);
|
|
111
|
+
}
|
|
112
|
+
@end
|
|
97
113
|
namespace facebook::react {
|
|
98
114
|
|
|
99
115
|
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_startVerification(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
@@ -112,12 +128,16 @@ namespace facebook::react {
|
|
|
112
128
|
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "clearAllOverrides", @selector(clearAllOverrides:reject:), args, count);
|
|
113
129
|
}
|
|
114
130
|
|
|
131
|
+
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_setVerificationOptions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
132
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "setVerificationOptions", @selector(setVerificationOptions:resolve:reject:), args, count);
|
|
133
|
+
}
|
|
134
|
+
|
|
115
135
|
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_reply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
116
136
|
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "reply", @selector(reply:reply:), args, count);
|
|
117
137
|
}
|
|
118
138
|
|
|
119
|
-
static facebook::jsi::Value
|
|
120
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "
|
|
139
|
+
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_replyWithString(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
140
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "replyWithString", @selector(replyWithString:value:), args, count);
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_ping(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
@@ -139,10 +159,13 @@ namespace facebook::react {
|
|
|
139
159
|
methodMap_["clearAllOverrides"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkSpecJSI_clearAllOverrides};
|
|
140
160
|
|
|
141
161
|
|
|
162
|
+
methodMap_["setVerificationOptions"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setVerificationOptions};
|
|
163
|
+
setMethodArgConversionSelector(@"setVerificationOptions", 0, @"JS_NativeInappRnSdk_VerificationOptionsOptional:");
|
|
164
|
+
|
|
142
165
|
methodMap_["reply"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkSpecJSI_reply};
|
|
143
166
|
|
|
144
167
|
|
|
145
|
-
methodMap_["
|
|
168
|
+
methodMap_["replyWithString"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkSpecJSI_replyWithString};
|
|
146
169
|
|
|
147
170
|
|
|
148
171
|
methodMap_["ping"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkSpecJSI_ping};
|
|
@@ -151,8 +174,9 @@ namespace facebook::react {
|
|
|
151
174
|
eventEmitterMap_["onSessionLogs"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
152
175
|
eventEmitterMap_["onSessionCreateRequest"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
153
176
|
eventEmitterMap_["onSessionUpdateRequest"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
154
|
-
eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
155
177
|
eventEmitterMap_["onProviderInformationRequest"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
178
|
+
eventEmitterMap_["onReclaimAttestorAuthRequest"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
179
|
+
eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<id>>();
|
|
156
180
|
setEventEmitterCallback([&](const std::string &name, id value) {
|
|
157
181
|
static_cast<AsyncEventEmitter<id> &>(*eventEmitterMap_[name]).emit(value);
|
|
158
182
|
});
|
|
@@ -179,6 +179,37 @@ namespace JS {
|
|
|
179
179
|
@interface RCTCxxConvert (NativeInappRnSdk_Overrides)
|
|
180
180
|
+ (RCTManagedPointer *)JS_NativeInappRnSdk_Overrides:(id)json;
|
|
181
181
|
@end
|
|
182
|
+
namespace JS {
|
|
183
|
+
namespace NativeInappRnSdk {
|
|
184
|
+
struct VerificationOptions {
|
|
185
|
+
bool canDeleteCookiesBeforeVerificationStarts() const;
|
|
186
|
+
bool canUseAttestorAuthenticationRequest() const;
|
|
187
|
+
|
|
188
|
+
VerificationOptions(NSDictionary *const v) : _v(v) {}
|
|
189
|
+
private:
|
|
190
|
+
NSDictionary *_v;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@interface RCTCxxConvert (NativeInappRnSdk_VerificationOptions)
|
|
196
|
+
+ (RCTManagedPointer *)JS_NativeInappRnSdk_VerificationOptions:(id)json;
|
|
197
|
+
@end
|
|
198
|
+
namespace JS {
|
|
199
|
+
namespace NativeInappRnSdk {
|
|
200
|
+
struct VerificationOptionsOptional {
|
|
201
|
+
std::optional<JS::NativeInappRnSdk::VerificationOptions> options() const;
|
|
202
|
+
|
|
203
|
+
VerificationOptionsOptional(NSDictionary *const v) : _v(v) {}
|
|
204
|
+
private:
|
|
205
|
+
NSDictionary *_v;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@interface RCTCxxConvert (NativeInappRnSdk_VerificationOptionsOptional)
|
|
211
|
+
+ (RCTManagedPointer *)JS_NativeInappRnSdk_VerificationOptionsOptional:(id)json;
|
|
212
|
+
@end
|
|
182
213
|
@protocol NativeInappRnSdkSpec <RCTBridgeModule, RCTTurboModule>
|
|
183
214
|
|
|
184
215
|
- (void)startVerification:(JS::NativeInappRnSdk::Request &)request
|
|
@@ -192,10 +223,13 @@ namespace JS {
|
|
|
192
223
|
reject:(RCTPromiseRejectBlock)reject;
|
|
193
224
|
- (void)clearAllOverrides:(RCTPromiseResolveBlock)resolve
|
|
194
225
|
reject:(RCTPromiseRejectBlock)reject;
|
|
226
|
+
- (void)setVerificationOptions:(JS::NativeInappRnSdk::VerificationOptionsOptional &)args
|
|
227
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
228
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
195
229
|
- (void)reply:(NSString *)replyId
|
|
196
230
|
reply:(BOOL)reply;
|
|
197
|
-
- (void)
|
|
198
|
-
|
|
231
|
+
- (void)replyWithString:(NSString *)replyId
|
|
232
|
+
value:(NSString *)value;
|
|
199
233
|
- (void)ping:(RCTPromiseResolveBlock)resolve
|
|
200
234
|
reject:(RCTPromiseRejectBlock)reject;
|
|
201
235
|
|
|
@@ -211,8 +245,9 @@ facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
|
211
245
|
- (void)emitOnSessionLogs:(NSDictionary *)value;
|
|
212
246
|
- (void)emitOnSessionCreateRequest:(NSDictionary *)value;
|
|
213
247
|
- (void)emitOnSessionUpdateRequest:(NSDictionary *)value;
|
|
214
|
-
- (void)emitOnSessionIdentityUpdate:(NSDictionary *)value;
|
|
215
248
|
- (void)emitOnProviderInformationRequest:(NSDictionary *)value;
|
|
249
|
+
- (void)emitOnReclaimAttestorAuthRequest:(NSDictionary *)value;
|
|
250
|
+
- (void)emitOnSessionIdentityUpdate:(NSDictionary *)value;
|
|
216
251
|
@end
|
|
217
252
|
|
|
218
253
|
namespace facebook::react {
|
|
@@ -399,5 +434,20 @@ inline NSString *JS::NativeInappRnSdk::Overrides::capabilityAccessToken() const
|
|
|
399
434
|
id const p = _v[@"capabilityAccessToken"];
|
|
400
435
|
return RCTBridgingToOptionalString(p);
|
|
401
436
|
}
|
|
437
|
+
inline bool JS::NativeInappRnSdk::VerificationOptions::canDeleteCookiesBeforeVerificationStarts() const
|
|
438
|
+
{
|
|
439
|
+
id const p = _v[@"canDeleteCookiesBeforeVerificationStarts"];
|
|
440
|
+
return RCTBridgingToBool(p);
|
|
441
|
+
}
|
|
442
|
+
inline bool JS::NativeInappRnSdk::VerificationOptions::canUseAttestorAuthenticationRequest() const
|
|
443
|
+
{
|
|
444
|
+
id const p = _v[@"canUseAttestorAuthenticationRequest"];
|
|
445
|
+
return RCTBridgingToBool(p);
|
|
446
|
+
}
|
|
447
|
+
inline std::optional<JS::NativeInappRnSdk::VerificationOptions> JS::NativeInappRnSdk::VerificationOptionsOptional::options() const
|
|
448
|
+
{
|
|
449
|
+
id const p = _v[@"options"];
|
|
450
|
+
return (p == nil ? std::nullopt : std::make_optional(JS::NativeInappRnSdk::VerificationOptions(p)));
|
|
451
|
+
}
|
|
402
452
|
NS_ASSUME_NONNULL_END
|
|
403
453
|
#endif // RNInappRnSdkSpec_H
|
|
@@ -34,6 +34,12 @@ static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_clearAllOverrides(js
|
|
|
34
34
|
rt
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
+
static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_setVerificationOptions(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
38
|
+
return static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->setVerificationOptions(
|
|
39
|
+
rt,
|
|
40
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
37
43
|
static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_reply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
38
44
|
static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->reply(
|
|
39
45
|
rt,
|
|
@@ -42,8 +48,8 @@ static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_reply(jsi::Runtime &
|
|
|
42
48
|
);
|
|
43
49
|
return jsi::Value::undefined();
|
|
44
50
|
}
|
|
45
|
-
static jsi::Value
|
|
46
|
-
static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->
|
|
51
|
+
static jsi::Value __hostFunction_NativeInappRnSdkCxxSpecJSI_replyWithString(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
52
|
+
static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->replyWithString(
|
|
47
53
|
rt,
|
|
48
54
|
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
49
55
|
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
|
|
@@ -62,8 +68,9 @@ NativeInappRnSdkCxxSpecJSI::NativeInappRnSdkCxxSpecJSI(std::shared_ptr<CallInvok
|
|
|
62
68
|
methodMap_["startVerificationFromUrl"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_startVerificationFromUrl};
|
|
63
69
|
methodMap_["setOverrides"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_setOverrides};
|
|
64
70
|
methodMap_["clearAllOverrides"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkCxxSpecJSI_clearAllOverrides};
|
|
71
|
+
methodMap_["setVerificationOptions"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkCxxSpecJSI_setVerificationOptions};
|
|
65
72
|
methodMap_["reply"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkCxxSpecJSI_reply};
|
|
66
|
-
methodMap_["
|
|
73
|
+
methodMap_["replyWithString"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkCxxSpecJSI_replyWithString};
|
|
67
74
|
methodMap_["ping"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkCxxSpecJSI_ping};
|
|
68
75
|
}
|
|
69
76
|
|
|
@@ -452,6 +452,54 @@ struct NativeInappRnSdkReclaimAppInfoBridging {
|
|
|
452
452
|
|
|
453
453
|
|
|
454
454
|
|
|
455
|
+
#pragma mark - NativeInappRnSdkReclaimAttestorAuthRequest
|
|
456
|
+
|
|
457
|
+
template <typename P0, typename P1>
|
|
458
|
+
struct NativeInappRnSdkReclaimAttestorAuthRequest {
|
|
459
|
+
P0 reclaimHttpProviderJsonString;
|
|
460
|
+
P1 replyId;
|
|
461
|
+
bool operator==(const NativeInappRnSdkReclaimAttestorAuthRequest &other) const {
|
|
462
|
+
return reclaimHttpProviderJsonString == other.reclaimHttpProviderJsonString && replyId == other.replyId;
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
template <typename T>
|
|
467
|
+
struct NativeInappRnSdkReclaimAttestorAuthRequestBridging {
|
|
468
|
+
static T types;
|
|
469
|
+
|
|
470
|
+
static T fromJs(
|
|
471
|
+
jsi::Runtime &rt,
|
|
472
|
+
const jsi::Object &value,
|
|
473
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
474
|
+
T result{
|
|
475
|
+
bridging::fromJs<decltype(types.reclaimHttpProviderJsonString)>(rt, value.getProperty(rt, "reclaimHttpProviderJsonString"), jsInvoker),
|
|
476
|
+
bridging::fromJs<decltype(types.replyId)>(rt, value.getProperty(rt, "replyId"), jsInvoker)};
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
#ifdef DEBUG
|
|
481
|
+
static jsi::String reclaimHttpProviderJsonStringToJs(jsi::Runtime &rt, decltype(types.reclaimHttpProviderJsonString) value) {
|
|
482
|
+
return bridging::toJs(rt, value);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
static jsi::String replyIdToJs(jsi::Runtime &rt, decltype(types.replyId) value) {
|
|
486
|
+
return bridging::toJs(rt, value);
|
|
487
|
+
}
|
|
488
|
+
#endif
|
|
489
|
+
|
|
490
|
+
static jsi::Object toJs(
|
|
491
|
+
jsi::Runtime &rt,
|
|
492
|
+
const T &value,
|
|
493
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
494
|
+
auto result = facebook::jsi::Object(rt);
|
|
495
|
+
result.setProperty(rt, "reclaimHttpProviderJsonString", bridging::toJs(rt, value.reclaimHttpProviderJsonString, jsInvoker));
|
|
496
|
+
result.setProperty(rt, "replyId", bridging::toJs(rt, value.replyId, jsInvoker));
|
|
497
|
+
return result;
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
455
503
|
#pragma mark - NativeInappRnSdkReclaimSessionIdentityUpdate
|
|
456
504
|
|
|
457
505
|
template <typename P0, typename P1, typename P2>
|
|
@@ -946,6 +994,97 @@ struct NativeInappRnSdkSessionUpdateRequestEventBridging {
|
|
|
946
994
|
}
|
|
947
995
|
};
|
|
948
996
|
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
#pragma mark - NativeInappRnSdkVerificationOptions
|
|
1000
|
+
|
|
1001
|
+
template <typename P0, typename P1>
|
|
1002
|
+
struct NativeInappRnSdkVerificationOptions {
|
|
1003
|
+
P0 canDeleteCookiesBeforeVerificationStarts;
|
|
1004
|
+
P1 canUseAttestorAuthenticationRequest;
|
|
1005
|
+
bool operator==(const NativeInappRnSdkVerificationOptions &other) const {
|
|
1006
|
+
return canDeleteCookiesBeforeVerificationStarts == other.canDeleteCookiesBeforeVerificationStarts && canUseAttestorAuthenticationRequest == other.canUseAttestorAuthenticationRequest;
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
template <typename T>
|
|
1011
|
+
struct NativeInappRnSdkVerificationOptionsBridging {
|
|
1012
|
+
static T types;
|
|
1013
|
+
|
|
1014
|
+
static T fromJs(
|
|
1015
|
+
jsi::Runtime &rt,
|
|
1016
|
+
const jsi::Object &value,
|
|
1017
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1018
|
+
T result{
|
|
1019
|
+
bridging::fromJs<decltype(types.canDeleteCookiesBeforeVerificationStarts)>(rt, value.getProperty(rt, "canDeleteCookiesBeforeVerificationStarts"), jsInvoker),
|
|
1020
|
+
bridging::fromJs<decltype(types.canUseAttestorAuthenticationRequest)>(rt, value.getProperty(rt, "canUseAttestorAuthenticationRequest"), jsInvoker)};
|
|
1021
|
+
return result;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
#ifdef DEBUG
|
|
1025
|
+
static bool canDeleteCookiesBeforeVerificationStartsToJs(jsi::Runtime &rt, decltype(types.canDeleteCookiesBeforeVerificationStarts) value) {
|
|
1026
|
+
return bridging::toJs(rt, value);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
static bool canUseAttestorAuthenticationRequestToJs(jsi::Runtime &rt, decltype(types.canUseAttestorAuthenticationRequest) value) {
|
|
1030
|
+
return bridging::toJs(rt, value);
|
|
1031
|
+
}
|
|
1032
|
+
#endif
|
|
1033
|
+
|
|
1034
|
+
static jsi::Object toJs(
|
|
1035
|
+
jsi::Runtime &rt,
|
|
1036
|
+
const T &value,
|
|
1037
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1038
|
+
auto result = facebook::jsi::Object(rt);
|
|
1039
|
+
result.setProperty(rt, "canDeleteCookiesBeforeVerificationStarts", bridging::toJs(rt, value.canDeleteCookiesBeforeVerificationStarts, jsInvoker));
|
|
1040
|
+
result.setProperty(rt, "canUseAttestorAuthenticationRequest", bridging::toJs(rt, value.canUseAttestorAuthenticationRequest, jsInvoker));
|
|
1041
|
+
return result;
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
#pragma mark - NativeInappRnSdkVerificationOptionsOptional
|
|
1048
|
+
|
|
1049
|
+
template <typename P0>
|
|
1050
|
+
struct NativeInappRnSdkVerificationOptionsOptional {
|
|
1051
|
+
P0 options;
|
|
1052
|
+
bool operator==(const NativeInappRnSdkVerificationOptionsOptional &other) const {
|
|
1053
|
+
return options == other.options;
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
template <typename T>
|
|
1058
|
+
struct NativeInappRnSdkVerificationOptionsOptionalBridging {
|
|
1059
|
+
static T types;
|
|
1060
|
+
|
|
1061
|
+
static T fromJs(
|
|
1062
|
+
jsi::Runtime &rt,
|
|
1063
|
+
const jsi::Object &value,
|
|
1064
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1065
|
+
T result{
|
|
1066
|
+
bridging::fromJs<decltype(types.options)>(rt, value.getProperty(rt, "options"), jsInvoker)};
|
|
1067
|
+
return result;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
#ifdef DEBUG
|
|
1071
|
+
static std::optional<jsi::Object> optionsToJs(jsi::Runtime &rt, decltype(types.options) value) {
|
|
1072
|
+
return bridging::toJs(rt, value);
|
|
1073
|
+
}
|
|
1074
|
+
#endif
|
|
1075
|
+
|
|
1076
|
+
static jsi::Object toJs(
|
|
1077
|
+
jsi::Runtime &rt,
|
|
1078
|
+
const T &value,
|
|
1079
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1080
|
+
auto result = facebook::jsi::Object(rt);
|
|
1081
|
+
if (value.options) {
|
|
1082
|
+
result.setProperty(rt, "options", bridging::toJs(rt, value.options.value(), jsInvoker));
|
|
1083
|
+
}
|
|
1084
|
+
return result;
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
|
|
949
1088
|
class JSI_EXPORT NativeInappRnSdkCxxSpecJSI : public TurboModule {
|
|
950
1089
|
protected:
|
|
951
1090
|
NativeInappRnSdkCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
@@ -955,8 +1094,9 @@ public:
|
|
|
955
1094
|
virtual jsi::Value startVerificationFromUrl(jsi::Runtime &rt, jsi::String requestUrl) = 0;
|
|
956
1095
|
virtual jsi::Value setOverrides(jsi::Runtime &rt, jsi::Object overrides) = 0;
|
|
957
1096
|
virtual jsi::Value clearAllOverrides(jsi::Runtime &rt) = 0;
|
|
1097
|
+
virtual jsi::Value setVerificationOptions(jsi::Runtime &rt, jsi::Object args) = 0;
|
|
958
1098
|
virtual void reply(jsi::Runtime &rt, jsi::String replyId, bool reply) = 0;
|
|
959
|
-
virtual void
|
|
1099
|
+
virtual void replyWithString(jsi::Runtime &rt, jsi::String replyId, jsi::String value) = 0;
|
|
960
1100
|
virtual jsi::Value ping(jsi::Runtime &rt) = 0;
|
|
961
1101
|
|
|
962
1102
|
};
|
|
@@ -1007,16 +1147,23 @@ protected:
|
|
|
1007
1147
|
});
|
|
1008
1148
|
}
|
|
1009
1149
|
|
|
1010
|
-
template <typename
|
|
1011
|
-
static_assert(bridging::supportsFromJs<
|
|
1012
|
-
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["
|
|
1150
|
+
template <typename OnProviderInformationRequestType> void emitOnProviderInformationRequest(OnProviderInformationRequestType value) {
|
|
1151
|
+
static_assert(bridging::supportsFromJs<OnProviderInformationRequestType, jsi::Object>, "value cannnot be converted to jsi::Object");
|
|
1152
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onProviderInformationRequest"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
1013
1153
|
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
1014
1154
|
});
|
|
1015
1155
|
}
|
|
1016
1156
|
|
|
1017
|
-
template <typename
|
|
1018
|
-
static_assert(bridging::supportsFromJs<
|
|
1019
|
-
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["
|
|
1157
|
+
template <typename OnReclaimAttestorAuthRequestType> void emitOnReclaimAttestorAuthRequest(OnReclaimAttestorAuthRequestType value) {
|
|
1158
|
+
static_assert(bridging::supportsFromJs<OnReclaimAttestorAuthRequestType, jsi::Object>, "value cannnot be converted to jsi::Object");
|
|
1159
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onReclaimAttestorAuthRequest"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
1160
|
+
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
template <typename OnSessionIdentityUpdateType> void emitOnSessionIdentityUpdate(OnSessionIdentityUpdateType value) {
|
|
1165
|
+
static_assert(bridging::supportsFromJs<OnSessionIdentityUpdateType, jsi::Object>, "value cannnot be converted to jsi::Object");
|
|
1166
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onSessionIdentityUpdate"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
1020
1167
|
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
1021
1168
|
});
|
|
1022
1169
|
}
|
|
@@ -1030,8 +1177,9 @@ private:
|
|
|
1030
1177
|
eventEmitterMap_["onSessionLogs"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1031
1178
|
eventEmitterMap_["onSessionCreateRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1032
1179
|
eventEmitterMap_["onSessionUpdateRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1033
|
-
eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1034
1180
|
eventEmitterMap_["onProviderInformationRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1181
|
+
eventEmitterMap_["onReclaimAttestorAuthRequest"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1182
|
+
eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
1035
1183
|
}
|
|
1036
1184
|
|
|
1037
1185
|
jsi::Value startVerification(jsi::Runtime &rt, jsi::Object request) override {
|
|
@@ -1066,6 +1214,14 @@ private:
|
|
|
1066
1214
|
return bridging::callFromJs<jsi::Value>(
|
|
1067
1215
|
rt, &T::clearAllOverrides, jsInvoker_, instance_);
|
|
1068
1216
|
}
|
|
1217
|
+
jsi::Value setVerificationOptions(jsi::Runtime &rt, jsi::Object args) override {
|
|
1218
|
+
static_assert(
|
|
1219
|
+
bridging::getParameterCount(&T::setVerificationOptions) == 2,
|
|
1220
|
+
"Expected setVerificationOptions(...) to have 2 parameters");
|
|
1221
|
+
|
|
1222
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1223
|
+
rt, &T::setVerificationOptions, jsInvoker_, instance_, std::move(args));
|
|
1224
|
+
}
|
|
1069
1225
|
void reply(jsi::Runtime &rt, jsi::String replyId, bool reply) override {
|
|
1070
1226
|
static_assert(
|
|
1071
1227
|
bridging::getParameterCount(&T::reply) == 3,
|
|
@@ -1074,13 +1230,13 @@ private:
|
|
|
1074
1230
|
return bridging::callFromJs<void>(
|
|
1075
1231
|
rt, &T::reply, jsInvoker_, instance_, std::move(replyId), std::move(reply));
|
|
1076
1232
|
}
|
|
1077
|
-
void
|
|
1233
|
+
void replyWithString(jsi::Runtime &rt, jsi::String replyId, jsi::String value) override {
|
|
1078
1234
|
static_assert(
|
|
1079
|
-
bridging::getParameterCount(&T::
|
|
1080
|
-
"Expected
|
|
1235
|
+
bridging::getParameterCount(&T::replyWithString) == 3,
|
|
1236
|
+
"Expected replyWithString(...) to have 3 parameters");
|
|
1081
1237
|
|
|
1082
1238
|
return bridging::callFromJs<void>(
|
|
1083
|
-
rt, &T::
|
|
1239
|
+
rt, &T::replyWithString, jsInvoker_, instance_, std::move(replyId), std::move(value));
|
|
1084
1240
|
}
|
|
1085
1241
|
jsi::Value ping(jsi::Runtime &rt) override {
|
|
1086
1242
|
static_assert(
|
|
@@ -9,7 +9,7 @@ import ReclaimInAppSdk
|
|
|
9
9
|
static fileprivate var replyHandlers: [String: (Result<Bool, any Error>) -> Void] = [:]
|
|
10
10
|
|
|
11
11
|
static fileprivate func setReplyCallback(
|
|
12
|
-
|
|
12
|
+
_ callback: @escaping (Result<Bool, any Error>) -> Void
|
|
13
13
|
) -> String {
|
|
14
14
|
let replyId = UUID().uuidString
|
|
15
15
|
Task { @MainActor in
|
|
@@ -35,31 +35,31 @@ import ReclaimInAppSdk
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@MainActor
|
|
38
|
-
static fileprivate var
|
|
38
|
+
static fileprivate var replyWithStringHandler: [String: (Result<String, any Error>) -> Void] = [:]
|
|
39
39
|
|
|
40
|
-
static fileprivate func
|
|
41
|
-
|
|
40
|
+
static fileprivate func setReplyWithStringCallback(
|
|
41
|
+
_ callback: @escaping (Result<String, any Error>) -> Void
|
|
42
42
|
) -> String {
|
|
43
43
|
let replyId = UUID().uuidString
|
|
44
44
|
Task { @MainActor in
|
|
45
|
-
Api.
|
|
45
|
+
Api.replyWithStringHandler[replyId] = callback
|
|
46
46
|
}
|
|
47
47
|
return replyId
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
@objc public func
|
|
50
|
+
@objc public func replyWithString(replyId: String?, value: String?) {
|
|
51
51
|
if let replyId {
|
|
52
52
|
Task { @MainActor in
|
|
53
|
-
let callback = Api.
|
|
53
|
+
let callback = Api.replyWithStringHandler[replyId]
|
|
54
54
|
if let callback = callback {
|
|
55
|
-
Api.
|
|
56
|
-
callback(.success(
|
|
55
|
+
Api.replyWithStringHandler.removeValue(forKey: replyId)
|
|
56
|
+
callback(.success(value ?? ""))
|
|
57
57
|
} else {
|
|
58
|
-
NSLog("[Api.
|
|
58
|
+
NSLog("[Api.replyWithString] No callback found for replyId \(replyId)")
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
} else {
|
|
62
|
-
NSLog("[Api.
|
|
62
|
+
NSLog("[Api.replyWithString] Missing arg replyId")
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -183,11 +183,17 @@ import ReclaimInAppSdk
|
|
|
183
183
|
capabilityAccessToken: capabilityAccessToken
|
|
184
184
|
)
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
@objc public func clearAllOverrides() async throws {
|
|
188
188
|
return try await ReclaimVerification.clearAllOverrides()
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
@objc public func setVerificationOptions(
|
|
192
|
+
options: ReclaimApiVerificationOptions?
|
|
193
|
+
) async throws {
|
|
194
|
+
return try await ReclaimVerification.setVerificationOptions(options: options?.toSdkOptions())
|
|
195
|
+
}
|
|
196
|
+
|
|
191
197
|
func startVerificationWithRequest(_ request: ReclaimVerification.Request) async throws -> [String: Any] {
|
|
192
198
|
NSLog("[Api] starting verification");
|
|
193
199
|
return try await withCheckedThrowingContinuation { continuation in
|
|
@@ -266,14 +272,14 @@ public typealias OverridenProviderCallback = (
|
|
|
266
272
|
}
|
|
267
273
|
|
|
268
274
|
public func fetchProviderInformation(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
appId: String,
|
|
276
|
+
providerId: String,
|
|
277
|
+
sessionId: String,
|
|
278
|
+
signature: String,
|
|
279
|
+
timestamp: String,
|
|
280
|
+
completion: @escaping (Result<String, any Error>) -> Void
|
|
275
281
|
) {
|
|
276
|
-
let replyId = Api.
|
|
282
|
+
let replyId = Api.setReplyWithStringCallback(completion)
|
|
277
283
|
self._fetchProviderInformation(appId, providerId, sessionId, signature, timestamp, replyId)
|
|
278
284
|
}
|
|
279
285
|
}
|
|
@@ -469,3 +475,48 @@ public typealias OverridenLogSessionCallback = (
|
|
|
469
475
|
}
|
|
470
476
|
}
|
|
471
477
|
}
|
|
478
|
+
|
|
479
|
+
public typealias ReclaimVerificationOptionFetchAttestorAuthRequestHandler = (
|
|
480
|
+
_ reclaimHttpProviderJsonString: String,
|
|
481
|
+
_ replyId: String
|
|
482
|
+
) -> Void
|
|
483
|
+
|
|
484
|
+
@objc(ReclaimApiVerificationOptions) public class ReclaimApiVerificationOptions: NSObject {
|
|
485
|
+
public let canDeleteCookiesBeforeVerificationStarts: Bool
|
|
486
|
+
public let attestorAuthRequestProvider: ReclaimVerification.VerificationOptions.AttestorAuthRequestProvider?
|
|
487
|
+
|
|
488
|
+
@objc public init(
|
|
489
|
+
canDeleteCookiesBeforeVerificationStarts: Bool,
|
|
490
|
+
fetchAttestorAuthenticationRequest: ReclaimVerificationOptionFetchAttestorAuthRequestHandler?
|
|
491
|
+
) {
|
|
492
|
+
self.canDeleteCookiesBeforeVerificationStarts = canDeleteCookiesBeforeVerificationStarts
|
|
493
|
+
if let fetchAttestorAuthenticationRequest {
|
|
494
|
+
self.attestorAuthRequestProvider = _AttestorAuthRequestProvider(
|
|
495
|
+
fetchAttestorAuthenticationRequest: fetchAttestorAuthenticationRequest
|
|
496
|
+
)
|
|
497
|
+
} else {
|
|
498
|
+
self.attestorAuthRequestProvider = nil
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
func toSdkOptions() -> ReclaimVerification.VerificationOptions {
|
|
503
|
+
return .init(
|
|
504
|
+
canDeleteCookiesBeforeVerificationStarts: canDeleteCookiesBeforeVerificationStarts,
|
|
505
|
+
attestorAuthRequestProvider: attestorAuthRequestProvider
|
|
506
|
+
)
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
class _AttestorAuthRequestProvider: ReclaimVerification.VerificationOptions.AttestorAuthRequestProvider {
|
|
510
|
+
let fetchAttestorAuthenticationRequest: ReclaimVerificationOptionFetchAttestorAuthRequestHandler
|
|
511
|
+
|
|
512
|
+
init(fetchAttestorAuthenticationRequest: @escaping ReclaimVerificationOptionFetchAttestorAuthRequestHandler) {
|
|
513
|
+
self.fetchAttestorAuthenticationRequest = fetchAttestorAuthenticationRequest
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
func fetchAttestorAuthenticationRequest(reclaimHttpProvider: [AnyHashable? : (any Sendable)?], completion: @escaping (Result<String, any Error>) -> Void) {
|
|
517
|
+
let replyId = Api.setReplyWithStringCallback(completion)
|
|
518
|
+
let reclaimHttpProviderJsonString = JSONUtility.toString(reclaimHttpProvider)
|
|
519
|
+
fetchAttestorAuthenticationRequest(reclaimHttpProviderJsonString, replyId)
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|