@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.
Files changed (56) hide show
  1. package/InappRnSdk.podspec +1 -1
  2. package/README.md +8 -6
  3. package/android/build.gradle +3 -3
  4. package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +13 -5
  5. package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +11 -4
  6. package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +10 -3
  7. package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +168 -12
  8. package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +49 -8
  9. package/ios/InappRnSdk.mm +33 -6
  10. package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +32 -8
  11. package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +53 -3
  12. package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +10 -3
  13. package/ios/generated/RNInappRnSdkSpecJSI.h +168 -12
  14. package/ios/inapp_rn_sdk/Api.swift +71 -20
  15. package/lib/commonjs/index.js +126 -30
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/{ReclaimVerificationPlatformChannel.js → platform.js} +48 -106
  18. package/lib/commonjs/platform.js.map +1 -0
  19. package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
  20. package/lib/module/index.js +127 -13
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/module/{ReclaimVerificationPlatformChannel.js → platform.js} +46 -103
  23. package/lib/module/platform.js.map +1 -0
  24. package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
  25. package/lib/typescript/commonjs/src/index.d.ts +140 -8
  26. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/src/platform.d.ts +18 -0
  28. package/lib/typescript/commonjs/src/platform.d.ts.map +1 -0
  29. package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +18 -2
  30. package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
  31. package/lib/typescript/module/src/index.d.ts +140 -8
  32. package/lib/typescript/module/src/index.d.ts.map +1 -1
  33. package/lib/typescript/module/src/platform.d.ts +18 -0
  34. package/lib/typescript/module/src/platform.d.ts.map +1 -0
  35. package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +18 -2
  36. package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
  37. package/package.json +2 -1
  38. package/src/index.ts +260 -18
  39. package/src/platform.ts +218 -0
  40. package/src/specs/NativeInappRnSdk.ts +21 -2
  41. package/lib/commonjs/ReclaimVerificationPlatformChannel.js.map +0 -1
  42. package/lib/commonjs/types/proof.js +0 -16
  43. package/lib/commonjs/types/proof.js.map +0 -1
  44. package/lib/module/ReclaimVerificationPlatformChannel.js.map +0 -1
  45. package/lib/module/types/proof.js +0 -12
  46. package/lib/module/types/proof.js.map +0 -1
  47. package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts +0 -107
  48. package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts.map +0 -1
  49. package/lib/typescript/commonjs/src/types/proof.d.ts +0 -33
  50. package/lib/typescript/commonjs/src/types/proof.d.ts.map +0 -1
  51. package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts +0 -107
  52. package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts.map +0 -1
  53. package/lib/typescript/module/src/types/proof.d.ts +0 -33
  54. package/lib/typescript/module/src/types/proof.d.ts.map +0 -1
  55. package/src/ReclaimVerificationPlatformChannel.ts +0 -363
  56. package/src/types/proof.ts +0 -44
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
18
18
  s.private_header_files = "ios/generated/**/*.h"
19
- s.dependency "ReclaimInAppSdk", "~> 0.2.1"
19
+ s.dependency "ReclaimInAppSdk", "~> 0.3.0"
20
20
 
21
21
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
22
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
package/README.md CHANGED
@@ -15,7 +15,7 @@ This SDK allows you to integrate Reclaim's in-app verification process into your
15
15
 
16
16
  ## Example
17
17
 
18
- - See the [Reclaim Example - React Native](example/README.md) for a complete example of how to use the SDK in a React Native application.
18
+ - See the [Reclaim Example - React Native](samples/example_new_arch/README.md) for a complete example of how to use the SDK in a React Native application.
19
19
 
20
20
  ## Installation
21
21
 
@@ -59,7 +59,7 @@ add the following to the end of settings.gradle:
59
59
  dependencyResolutionManagement {
60
60
  repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
61
61
  String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
62
- String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.2.1/repo"
62
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo"
63
63
  repositories {
64
64
  google()
65
65
  mavenCentral()
@@ -78,7 +78,7 @@ or alternatively add the following repositories to the relevant repositories blo
78
78
 
79
79
  ```groovy
80
80
  String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
81
- String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.2.1/repo"
81
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo"
82
82
  maven {
83
83
  url "$reclaimStorageUrl"
84
84
  }
@@ -108,13 +108,13 @@ Ignore if you already have this declaration in your `Podfile`.
108
108
 
109
109
  ```ruby
110
110
  # Cocoapods is the recommended way to install the SDK.
111
- pod 'ReclaimInAppSdk', '~> 0.2.1'
111
+ pod 'ReclaimInAppSdk', '~> 0.3.0'
112
112
  ```
113
113
 
114
114
  ##### From a specific tag
115
115
 
116
116
  ```ruby
117
- pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.2.1'
117
+ pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.3.0'
118
118
  ```
119
119
 
120
120
  ##### From git HEAD
@@ -151,7 +151,7 @@ target 'InappRnSdkExample' do
151
151
  )
152
152
 
153
153
  # This is the line that you may need to add in your podfile.
154
- pod 'ReclaimInAppSdk', '~> 0.2.1'
154
+ pod 'ReclaimInAppSdk', '~> 0.3.0'
155
155
 
156
156
  pre_install do |installer|
157
157
  system("cd ../../ && npx bob build --target codegen")
@@ -290,6 +290,8 @@ error.innerError
290
290
 
291
291
  ## Migration
292
292
 
293
+ - Migration steps for [0.3.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#031)
294
+ - Migration steps for [0.3.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#030)
293
295
  - Migration steps for [0.2.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#021)
294
296
 
295
297
  ## Advanced Usage
@@ -3,7 +3,7 @@ buildscript {
3
3
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['InappRnSdk_' + name]
4
4
  }
5
5
  String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
6
- String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.2.1/repo"
6
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo"
7
7
  repositories {
8
8
  google()
9
9
  mavenCentral()
@@ -98,7 +98,7 @@ android {
98
98
  }
99
99
 
100
100
  String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
101
- String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.2.1/repo"
101
+ String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/0.3.0/repo"
102
102
 
103
103
  repositories {
104
104
  mavenCentral()
@@ -118,7 +118,7 @@ dependencies {
118
118
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
119
119
 
120
120
  //noinspection UseTomlInstead
121
- implementation "org.reclaimprotocol:inapp_sdk:0.2.1"
121
+ implementation "org.reclaimprotocol:inapp_sdk:0.3.0"
122
122
  }
123
123
 
124
124
  if (isNewArchitectureEnabled()) {
@@ -49,14 +49,18 @@ public abstract class NativeInappRnSdkSpec extends ReactContextBaseJavaModule im
49
49
  mEventEmitterCallback.invoke("onSessionUpdateRequest", value);
50
50
  }
51
51
 
52
- protected final void emitOnSessionIdentityUpdate(ReadableMap value) {
53
- mEventEmitterCallback.invoke("onSessionIdentityUpdate", value);
54
- }
55
-
56
52
  protected final void emitOnProviderInformationRequest(ReadableMap value) {
57
53
  mEventEmitterCallback.invoke("onProviderInformationRequest", value);
58
54
  }
59
55
 
56
+ protected final void emitOnReclaimAttestorAuthRequest(ReadableMap value) {
57
+ mEventEmitterCallback.invoke("onReclaimAttestorAuthRequest", value);
58
+ }
59
+
60
+ protected final void emitOnSessionIdentityUpdate(ReadableMap value) {
61
+ mEventEmitterCallback.invoke("onSessionIdentityUpdate", value);
62
+ }
63
+
60
64
  @ReactMethod
61
65
  @DoNotStrip
62
66
  public abstract void startVerification(ReadableMap request, Promise promise);
@@ -73,13 +77,17 @@ public abstract class NativeInappRnSdkSpec extends ReactContextBaseJavaModule im
73
77
  @DoNotStrip
74
78
  public abstract void clearAllOverrides(Promise promise);
75
79
 
80
+ @ReactMethod
81
+ @DoNotStrip
82
+ public abstract void setVerificationOptions(ReadableMap args, Promise promise);
83
+
76
84
  @ReactMethod
77
85
  @DoNotStrip
78
86
  public abstract void reply(String replyId, boolean reply);
79
87
 
80
88
  @ReactMethod
81
89
  @DoNotStrip
82
- public abstract void replyWithProviderInformation(String replyId, String providerInformation);
90
+ public abstract void replyWithString(String replyId, String value);
83
91
 
84
92
  @ReactMethod
85
93
  @DoNotStrip
@@ -32,14 +32,19 @@ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_clearAllOverr
32
32
  return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "clearAllOverrides", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
33
33
  }
34
34
 
35
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_setVerificationOptions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setVerificationOptions", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
38
+ }
39
+
35
40
  static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_reply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
41
  static jmethodID cachedMethodId = nullptr;
37
42
  return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "reply", "(Ljava/lang/String;Z)V", args, count, cachedMethodId);
38
43
  }
39
44
 
40
- static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_replyWithProviderInformation(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
45
+ static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_replyWithString(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
46
  static jmethodID cachedMethodId = nullptr;
42
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "replyWithProviderInformation", "(Ljava/lang/String;Ljava/lang/String;)V", args, count, cachedMethodId);
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "replyWithString", "(Ljava/lang/String;Ljava/lang/String;)V", args, count, cachedMethodId);
43
48
  }
44
49
 
45
50
  static facebook::jsi::Value __hostFunction_NativeInappRnSdkSpecJSI_ping(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
@@ -53,15 +58,17 @@ NativeInappRnSdkSpecJSI::NativeInappRnSdkSpecJSI(const JavaTurboModule::InitPara
53
58
  methodMap_["startVerificationFromUrl"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_startVerificationFromUrl};
54
59
  methodMap_["setOverrides"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setOverrides};
55
60
  methodMap_["clearAllOverrides"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkSpecJSI_clearAllOverrides};
61
+ methodMap_["setVerificationOptions"] = MethodMetadata {1, __hostFunction_NativeInappRnSdkSpecJSI_setVerificationOptions};
56
62
  methodMap_["reply"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkSpecJSI_reply};
57
- methodMap_["replyWithProviderInformation"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkSpecJSI_replyWithProviderInformation};
63
+ methodMap_["replyWithString"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkSpecJSI_replyWithString};
58
64
  methodMap_["ping"] = MethodMetadata {0, __hostFunction_NativeInappRnSdkSpecJSI_ping};
59
65
  eventEmitterMap_["onLogs"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
60
66
  eventEmitterMap_["onSessionLogs"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
61
67
  eventEmitterMap_["onSessionCreateRequest"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
62
68
  eventEmitterMap_["onSessionUpdateRequest"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
63
- eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
64
69
  eventEmitterMap_["onProviderInformationRequest"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
70
+ eventEmitterMap_["onReclaimAttestorAuthRequest"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
71
+ eventEmitterMap_["onSessionIdentityUpdate"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
65
72
  setEventEmitterCallback(params.instance);
66
73
  }
67
74
 
@@ -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 __hostFunction_NativeInappRnSdkCxxSpecJSI_replyWithProviderInformation(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
46
- static_cast<NativeInappRnSdkCxxSpecJSI *>(&turboModule)->replyWithProviderInformation(
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_["replyWithProviderInformation"] = MethodMetadata {2, __hostFunction_NativeInappRnSdkCxxSpecJSI_replyWithProviderInformation};
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 replyWithProviderInformation(jsi::Runtime &rt, jsi::String replyId, jsi::String providerInformation) = 0;
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 OnSessionIdentityUpdateType> void emitOnSessionIdentityUpdate(OnSessionIdentityUpdateType value) {
1011
- static_assert(bridging::supportsFromJs<OnSessionIdentityUpdateType, jsi::Object>, "value cannnot be converted to jsi::Object");
1012
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onSessionIdentityUpdate"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
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 OnProviderInformationRequestType> void emitOnProviderInformationRequest(OnProviderInformationRequestType value) {
1018
- static_assert(bridging::supportsFromJs<OnProviderInformationRequestType, jsi::Object>, "value cannnot be converted to jsi::Object");
1019
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onProviderInformationRequest"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
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 replyWithProviderInformation(jsi::Runtime &rt, jsi::String replyId, jsi::String providerInformation) override {
1233
+ void replyWithString(jsi::Runtime &rt, jsi::String replyId, jsi::String value) override {
1078
1234
  static_assert(
1079
- bridging::getParameterCount(&T::replyWithProviderInformation) == 3,
1080
- "Expected replyWithProviderInformation(...) to have 3 parameters");
1235
+ bridging::getParameterCount(&T::replyWithString) == 3,
1236
+ "Expected replyWithString(...) to have 3 parameters");
1081
1237
 
1082
1238
  return bridging::callFromJs<void>(
1083
- rt, &T::replyWithProviderInformation, jsInvoker_, instance_, std::move(replyId), std::move(providerInformation));
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(
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReadableMap
8
8
  import com.facebook.react.bridge.WritableArray
9
9
  import com.facebook.react.bridge.WritableMap
10
10
  import com.facebook.react.module.annotations.ReactModule
11
+ import org.json.JSONObject
11
12
  import org.reclaimprotocol.inapp_sdk.ReclaimOverrides
12
13
  import org.reclaimprotocol.inapp_sdk.ReclaimSessionStatus
13
14
  import org.reclaimprotocol.inapp_sdk.ReclaimVerification
@@ -168,6 +169,46 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
168
169
  }
169
170
  }
170
171
 
172
+ override fun setVerificationOptions(args: ReadableMap?, promise: Promise?) {
173
+ val inputOptions = getMap(args, "options")
174
+ var options: ReclaimVerification.VerificationOptions? = null
175
+ if (inputOptions != null) {
176
+ val canUseAttestorAuthRequestProvider = getBoolean(inputOptions, "canUseAttestorAuthenticationRequest") == true;
177
+ options = ReclaimVerification.VerificationOptions(
178
+ canDeleteCookiesBeforeVerificationStarts = getBoolean(inputOptions, "canDeleteCookiesBeforeVerificationStarts") ?: true,
179
+ attestorAuthRequestProvider = if (canUseAttestorAuthRequestProvider) {
180
+ object : ReclaimVerification.VerificationOptions.AttestorAuthRequestProvider {
181
+ override fun fetchAttestorAuthenticationRequest(
182
+ reclaimHttpProvider: Map<Any?, Any?>,
183
+ callback: (Result<String>) -> Unit
184
+ ) {
185
+ val args = Arguments.createMap()
186
+ args.putString("reclaimHttpProviderJsonString", JSONObject(reclaimHttpProvider).toString())
187
+ val replyId = UUID.randomUUID().toString()
188
+ args.putString("replyId", replyId)
189
+ replyWithString[replyId] = callback
190
+ emitOnReclaimAttestorAuthRequest(args)
191
+ }
192
+ }
193
+ } else {
194
+ null
195
+ }
196
+ )
197
+ }
198
+ reactContext.runOnUiQueueThread {
199
+ ReclaimVerification.setVerificationOptions(
200
+ context = reactContext.applicationContext,
201
+ options = options
202
+ ) { result ->
203
+ result.onSuccess {
204
+ promise?.resolve(null)
205
+ }.onFailure { error ->
206
+ onPlatformException(promise, error)
207
+ }
208
+ }
209
+ }
210
+ }
211
+
171
212
  private fun setOverrides(
172
213
  provider: ReadableMap?,
173
214
  featureOptions: ReadableMap?,
@@ -194,7 +235,7 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
194
235
  )
195
236
  )
196
237
  else if (getBoolean(provider, "canFetchProviderInformationFromHost") == true)
197
- ReclaimOverrides.ProviderInformation.FromCallback(object : ReclaimOverrides.ProviderInformation.FromCallbackHandler {
238
+ ReclaimOverrides.ProviderInformation.FromCallback(object : ReclaimOverrides.ProviderInformation.FromCallback.Handler {
198
239
  override fun fetchProviderInformation(
199
240
  appId: String,
200
241
  providerId: String,
@@ -211,7 +252,7 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
211
252
  args.putString("timestamp", timestamp)
212
253
  val replyId = UUID.randomUUID().toString()
213
254
  args.putString("replyId", replyId)
214
- replyWithProviderInformationHandlers[replyId] = callback
255
+ replyWithString[replyId] = callback
215
256
  emitOnProviderInformationRequest(args)
216
257
  }
217
258
  })
@@ -331,20 +372,20 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
331
372
  }
332
373
  }
333
374
 
334
- private val replyWithProviderInformationHandlers: MutableMap<String, (Result<String>) -> Unit> =
375
+ private val replyWithString: MutableMap<String, (Result<String>) -> Unit> =
335
376
  mutableMapOf()
336
377
 
337
- override fun replyWithProviderInformation(replyId: String?, providerInformation: String?) {
378
+ override fun replyWithString(replyId: String?, value: String?) {
338
379
  if (replyId == null) {
339
- Log.w(NAME, "(replyWithProviderInformation) Missing arg replyId")
380
+ Log.w(NAME, "(replyWithString) Missing arg replyId")
340
381
  return
341
382
  }
342
383
  reactContext.runOnUiQueueThread {
343
- val callback = replyWithProviderInformationHandlers[replyId]
384
+ val callback = replyWithString[replyId]
344
385
  if (callback != null) {
345
- callback(Result.success(providerInformation ?: ""))
386
+ callback(Result.success(value ?: ""))
346
387
  } else {
347
- Log.w(NAME, "(replyWithProviderInformation) Missing reply handler for id: $replyId")
388
+ Log.w(NAME, "(replyWithString) Missing reply handler for id: $replyId")
348
389
  }
349
390
  }
350
391
  }
package/ios/InappRnSdk.mm CHANGED
@@ -35,8 +35,8 @@ Api *api = [[Api alloc] init];
35
35
  [api replyWithReplyId:replyId reply:reply];
36
36
  }
37
37
 
38
- - (void)replyWithProviderInformation:(nonnull NSString *)replyId providerInformation:(nonnull NSString *)providerInformation {
39
- [api replyWithProviderInformationWithReplyId:replyId providerInformation:providerInformation];
38
+ - (void)replyWithString:(nonnull NSString *)replyId value:(nonnull NSString *)value {
39
+ [api replyWithStringWithReplyId:replyId value:value];
40
40
  }
41
41
 
42
42
  - (void)startVerification:(JS::NativeInappRnSdk::Request &)request resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
@@ -179,7 +179,7 @@ Api *api = [[Api alloc] init];
179
179
  }
180
180
  overridenLogConsumer = [[OverridenLogConsumer alloc] initWithLogHandler: logHandler canSdkCollectTelemetry: canSDKCollectTelemetry canSdkPrintLogs: canSdkPrintLogs];
181
181
  }
182
-
182
+
183
183
  OverridenSessionManagement * _Nullable sessionManagement;
184
184
  if (overrides.sessionManagement().has_value()) {
185
185
  sessionManagement = [[OverridenSessionManagement alloc] initWithHandler:[[OverridenSessionHandler alloc] initWith_createSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull replyId) {
@@ -195,12 +195,12 @@ Api *api = [[Api alloc] init];
195
195
  @"status": status,
196
196
  @"replyId": replyId
197
197
  }];
198
- } _logSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull replyId) {
198
+ } _logSession:^(NSString * _Nonnull appId, NSString * _Nonnull providerId, NSString * _Nonnull sessionId, NSString * _Nonnull logType) {
199
199
  [self emitOnSessionLogs:@{
200
200
  @"appId": appId,
201
201
  @"providerId": providerId,
202
202
  @"sessionId": sessionId,
203
- @"replyId": replyId
203
+ @"logType": logType
204
204
  }];
205
205
  }]];
206
206
  }
@@ -229,7 +229,7 @@ Api *api = [[Api alloc] init];
229
229
  }];
230
230
  }
231
231
 
232
- - (void)clearAllOverrides:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
232
+ - (void)clearAllOverrides:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
233
233
  [api clearAllOverridesWithCompletionHandler:^(NSError * _Nullable error) {
234
234
  if (error != nil) {
235
235
  reject(@"OVERRIDE_ERROR", @"Error on clearing overrides", error);
@@ -239,4 +239,31 @@ Api *api = [[Api alloc] init];
239
239
  }];
240
240
  }
241
241
 
242
+ - (void)setVerificationOptions:(JS::NativeInappRnSdk::VerificationOptionsOptional &)args resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
243
+ ReclaimApiVerificationOptions * _Nullable options = nil;
244
+ if (args.options().has_value()) {
245
+ JS::NativeInappRnSdk::VerificationOptions inputOptions = args.options().value();
246
+ if (inputOptions.canUseAttestorAuthenticationRequest()) {
247
+ options = [[ReclaimApiVerificationOptions alloc] initWithCanDeleteCookiesBeforeVerificationStarts:inputOptions.canDeleteCookiesBeforeVerificationStarts() fetchAttestorAuthenticationRequest:^(NSString * _Nonnull reclaimHttpProviderJsonString, NSString * _Nonnull replyId) {
248
+ [self emitOnReclaimAttestorAuthRequest:@{
249
+ @"reclaimHttpProviderJsonString": reclaimHttpProviderJsonString,
250
+ @"replyId": replyId
251
+ }];
252
+ }
253
+ ];
254
+ } else {
255
+ options = [[ReclaimApiVerificationOptions alloc] initWithCanDeleteCookiesBeforeVerificationStarts:inputOptions.canDeleteCookiesBeforeVerificationStarts() fetchAttestorAuthenticationRequest:nil];
256
+ }
257
+
258
+ }
259
+ [api setVerificationOptionsWithOptions:options completionHandler:^(NSError * _Nullable error) {
260
+ if (error != nil) {
261
+ reject(@"VERIFICATION_OPTIONS_ERROR", @"Error on setting verification options", error);
262
+ } else {
263
+ resolve(nil);
264
+ }
265
+ }];
266
+ }
267
+
268
+
242
269
  @end