@reclaimprotocol/inapp-rn-sdk 0.1.5 → 0.1.7
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
|
+

|
|
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 (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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 =
|
|
188
|
+
idleTimeThresholdForManualVerificationTrigger = getNumber(
|
|
181
189
|
featureOptions, "idleTimeThresholdForManualVerificationTrigger"
|
|
182
|
-
),
|
|
183
|
-
sessionTimeoutForManualVerificationTrigger =
|
|
190
|
+
)?.toLong(),
|
|
191
|
+
sessionTimeoutForManualVerificationTrigger = getNumber(
|
|
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,12 +304,15 @@ class InappRnSdkModule(private val reactContext: ReactApplicationContext) :
|
|
|
291
304
|
}
|
|
292
305
|
}
|
|
293
306
|
|
|
294
|
-
private fun
|
|
295
|
-
|
|
296
|
-
null
|
|
297
|
-
}
|
|
298
|
-
|
|
307
|
+
private fun getNumber(map: ReadableMap, key: String): Number? {
|
|
308
|
+
if (!map.hasKey(key) || map.isNull(key)) {
|
|
309
|
+
return null
|
|
310
|
+
}
|
|
311
|
+
val value = map.toHashMap()[key]
|
|
312
|
+
if (value is Number) {
|
|
313
|
+
return value
|
|
299
314
|
}
|
|
315
|
+
throw TypeCastException("Value for key $key is not a Number")
|
|
300
316
|
}
|
|
301
317
|
|
|
302
318
|
private fun getString(map: ReadableMap, key: String): String? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/inapp-rn-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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",
|