@reclaimprotocol/inapp-rn-sdk 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## @reclaimprotocol/inapp-rn-sdk
4
4
 
5
+ ![NPM Version](https://img.shields.io/npm/v/%40reclaimprotocol%2Finapp-rn-sdk)
6
+
5
7
  This SDK allows you to integrate Reclaim's in-app verification process into your React Native application.
6
8
 
7
9
  [Refer Reclaim Protocol's official documentation for React Native SDK](https://docs.reclaimprotocol.org/inapp-sdks/react-native)
@@ -168,21 +168,29 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
168
168
  reactContext.runOnUiQueueThread {
169
169
  ReclaimVerification.setOverrides(
170
170
  context = reactContext.applicationContext,
171
- provider = if (provider == null) null else (if (provider.isNull("url")) ReclaimOverrides.ProviderInformation.FromJsonString(
172
- requireString(
173
- provider, "jsonString"
174
- )
175
- )
176
- else ReclaimOverrides.ProviderInformation.FromUrl(requireString(provider, "url"))),
171
+ provider = if (provider == null) null else (
172
+ if (!hasValue(provider, "url"))
173
+ ReclaimOverrides.ProviderInformation.FromJsonString(
174
+ requireString(
175
+ provider, "jsonString"
176
+ )
177
+ )
178
+ else
179
+ ReclaimOverrides.ProviderInformation.FromUrl(
180
+ requireString(
181
+ provider, "url"
182
+ )
183
+ )
184
+ ),
177
185
  featureOptions = if (featureOptions == null) null else ReclaimOverrides.FeatureOptions(
178
186
  cookiePersist = getBoolean(featureOptions, "cookiePersist"),
179
187
  singleReclaimRequest = getBoolean(featureOptions, "singleReclaimRequest"),
180
- idleTimeThresholdForManualVerificationTrigger = getLong(
188
+ idleTimeThresholdForManualVerificationTrigger = getDouble(
181
189
  featureOptions, "idleTimeThresholdForManualVerificationTrigger"
182
- ),
183
- sessionTimeoutForManualVerificationTrigger = getLong(
190
+ )?.toLong(),
191
+ sessionTimeoutForManualVerificationTrigger = getDouble(
184
192
  featureOptions, "sessionTimeoutForManualVerificationTrigger"
185
- ),
193
+ )?.toLong(),
186
194
  attestorBrowserRpcUrl = getString(featureOptions, "attestorBrowserRpcUrl"),
187
195
  isResponseRedactionRegexEscapingEnabled = getBoolean(
188
196
  featureOptions, "isResponseRedactionRegexEscapingEnabled"
@@ -274,6 +282,11 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
274
282
  }
275
283
  }
276
284
 
285
+ @Suppress("SameParameterValue")
286
+ private fun hasValue(map: ReadableMap, key: String): Boolean {
287
+ return map.hasKey(key) && !map.isNull(key)
288
+ }
289
+
277
290
  private fun requireString(map: ReadableMap, key: String): String {
278
291
  val value = getString(map, key)
279
292
  if (value == null) {
@@ -291,11 +304,11 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
291
304
  }
292
305
  }
293
306
 
294
- private fun getLong(map: ReadableMap, key: String): Long? {
307
+ private fun getDouble(map: ReadableMap, key: String): Double? {
295
308
  return if (!map.hasKey(key) || map.isNull(key)) {
296
309
  null
297
310
  } else {
298
- map.getLong(key)
311
+ map.getDouble(key)
299
312
  }
300
313
  }
301
314
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reclaimprotocol/inapp-rn-sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Reclaim Protocol's InApp React Native SDK for ZK proof generations for requests with an in-app experience of web verification",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/commonjs/index.js",