@reclaimprotocol/inapp-rn-sdk 0.7.2 → 0.8.3
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 +7 -6
- package/android/build.gradle +1 -1
- package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +4 -0
- package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +6 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +7 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +95 -22
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +44 -9
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/JsonExtension.kt +18 -0
- package/ios/InappRnSdk.mm +266 -138
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +13 -0
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +45 -10
- package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +7 -0
- package/ios/generated/RNInappRnSdkSpecJSI.h +95 -22
- package/ios/inapp_rn_sdk/Api.swift +322 -154
- package/lib/commonjs/index.js +36 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/module/index.js +36 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +18 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +22 -2
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/commonjs/user-workspace/src/App.d.ts +2 -0
- package/lib/typescript/commonjs/user-workspace/src/App.d.ts.map +1 -0
- package/lib/typescript/commonjs/user-workspace/src/App.overrides.d.ts +2 -0
- package/lib/typescript/commonjs/user-workspace/src/App.overrides.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +18 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +22 -2
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/module/user-workspace/src/App.d.ts +2 -0
- package/lib/typescript/module/user-workspace/src/App.d.ts.map +1 -0
- package/lib/typescript/module/user-workspace/src/App.overrides.d.ts +2 -0
- package/lib/typescript/module/user-workspace/src/App.overrides.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/index.ts +59 -3
- package/src/specs/NativeInappRnSdk.ts +24 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.overrides.d.ts","sourceRoot":"","sources":["../../../../../user-workspace/src/App.overrides.tsx"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,GAAG,4CAyR1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/inapp-rn-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.3",
|
|
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",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"!**/.*"
|
|
40
40
|
],
|
|
41
41
|
"scripts": {
|
|
42
|
-
"
|
|
42
|
+
"user-workspace": "yarn workspace @reclaimprotocol/inapp-rn-sdk-user-workspace",
|
|
43
43
|
"test": "jest",
|
|
44
44
|
"typecheck": "tsc",
|
|
45
45
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
46
|
-
"android:gen:specs": "cd
|
|
47
|
-
"ios:gen:specs": "cd
|
|
46
|
+
"android:gen:specs": "cd user-workspace/android && ./gradlew :app:invokeLibraryCodegen",
|
|
47
|
+
"ios:gen:specs": "cd user-workspace/ios && bundle install && bundle exec pod install",
|
|
48
48
|
"gen:specs": "npx react-native codegen",
|
|
49
|
-
"clean": "del-cli android/build
|
|
49
|
+
"clean": "del-cli android/build user-workspace/android/build user-workspace/android/app/build user-workspace/ios/build lib",
|
|
50
50
|
"prepare": "bob build",
|
|
51
51
|
"release": "release-it"
|
|
52
52
|
},
|
|
@@ -98,13 +98,14 @@
|
|
|
98
98
|
"react-native": "*"
|
|
99
99
|
},
|
|
100
100
|
"workspaces": [
|
|
101
|
-
"
|
|
101
|
+
"user-workspace"
|
|
102
102
|
],
|
|
103
103
|
"packageManager": "yarn@3.6.1",
|
|
104
104
|
"jest": {
|
|
105
105
|
"preset": "react-native",
|
|
106
106
|
"modulePathIgnorePatterns": [
|
|
107
|
-
"<rootDir>/
|
|
107
|
+
"<rootDir>/user-workspace/node_modules",
|
|
108
|
+
"<rootDir>/samples/",
|
|
108
109
|
"<rootDir>/lib/"
|
|
109
110
|
]
|
|
110
111
|
},
|
package/src/index.ts
CHANGED
|
@@ -36,6 +36,12 @@ export class ReclaimVerification {
|
|
|
36
36
|
return this.platform.startVerificationFromUrl(requestUrl);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
public async startVerificationFromJson(
|
|
40
|
+
template: Record<string, any>
|
|
41
|
+
): Promise<ReclaimVerification.Response> {
|
|
42
|
+
return this.platform.startVerificationFromJson(template);
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
public async ping(): Promise<boolean> {
|
|
40
46
|
return this.platform.ping();
|
|
41
47
|
}
|
|
@@ -72,7 +78,25 @@ export namespace ReclaimVerification {
|
|
|
72
78
|
*
|
|
73
79
|
* You can create a request using the [ReclaimVerification.Request] constructor or the [ReclaimVerification.Request.fromManifestMetaData] factory method.
|
|
74
80
|
*/
|
|
75
|
-
export type Request = NativeReclaimInappModuleTypes.Request;
|
|
81
|
+
export type Request = NativeReclaimInappModuleTypes.Request & { providerVersion?: ProviderVersion };
|
|
82
|
+
|
|
83
|
+
export class ProviderVersion implements NativeReclaimInappModuleTypes.ProviderVersion {
|
|
84
|
+
resolvedVersion: string;
|
|
85
|
+
versionExpression: string;
|
|
86
|
+
|
|
87
|
+
private constructor(exactVersion: string, versionExpression: string) {
|
|
88
|
+
this.resolvedVersion = exactVersion;
|
|
89
|
+
this.versionExpression = versionExpression;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static resolved(exactVersion: string, versionExpression?: string): ProviderVersion {
|
|
93
|
+
return new ProviderVersion(exactVersion, versionExpression ?? exactVersion);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static from(versionExpression: string = ''): ProviderVersion {
|
|
97
|
+
return new ProviderVersion(versionExpression, versionExpression);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
76
100
|
|
|
77
101
|
/**
|
|
78
102
|
* Contains the proof and response data after verification
|
|
@@ -179,11 +203,17 @@ export namespace ReclaimVerification {
|
|
|
179
203
|
*/
|
|
180
204
|
onSessionCreateRequest: (
|
|
181
205
|
event: NativeReclaimInappModuleTypes.SessionCreateRequestEvent
|
|
182
|
-
) => Promise<
|
|
206
|
+
) => Promise<SessionInitResponse>;
|
|
183
207
|
onSessionUpdateRequest: (
|
|
184
208
|
event: NativeReclaimInappModuleTypes.SessionUpdateRequestEvent
|
|
185
209
|
) => Promise<boolean>;
|
|
186
210
|
}
|
|
211
|
+
|
|
212
|
+
export interface SessionInitResponse {
|
|
213
|
+
sessionId: string,
|
|
214
|
+
resolvedProviderVersion: string
|
|
215
|
+
}
|
|
216
|
+
|
|
187
217
|
export type ReclaimAppInfo = NativeReclaimInappModuleTypes.ReclaimAppInfo;
|
|
188
218
|
}
|
|
189
219
|
|
|
@@ -320,6 +350,10 @@ export namespace ReclaimVerification {
|
|
|
320
350
|
requestUrl: string
|
|
321
351
|
): Promise<ReclaimVerification.Response>;
|
|
322
352
|
|
|
353
|
+
abstract startVerificationFromJson(
|
|
354
|
+
template: Record<string, any>
|
|
355
|
+
): Promise<ReclaimVerification.Response>;
|
|
356
|
+
|
|
323
357
|
abstract ping(): Promise<boolean>;
|
|
324
358
|
|
|
325
359
|
abstract setOverrides(
|
|
@@ -383,6 +417,28 @@ export class PlatformImpl extends ReclaimVerification.Platform {
|
|
|
383
417
|
}
|
|
384
418
|
}
|
|
385
419
|
|
|
420
|
+
override async startVerificationFromJson(template: Record<string, any>): Promise<ReclaimVerification.Response> {
|
|
421
|
+
try {
|
|
422
|
+
const response =
|
|
423
|
+
await NativeReclaimInappModule.startVerificationFromJson(JSON.stringify(template));
|
|
424
|
+
return {
|
|
425
|
+
...response,
|
|
426
|
+
proofs: ReclaimVerification.ReclaimResult.asProofs(response.proofs),
|
|
427
|
+
};
|
|
428
|
+
} catch (error) {
|
|
429
|
+
console.info({
|
|
430
|
+
error,
|
|
431
|
+
});
|
|
432
|
+
if (error instanceof Error) {
|
|
433
|
+
throw ReclaimVerification.ReclaimVerificationException.fromError(
|
|
434
|
+
error,
|
|
435
|
+
''
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
throw error;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
386
442
|
override async ping(): Promise<boolean> {
|
|
387
443
|
return await NativeReclaimInappModule.ping();
|
|
388
444
|
}
|
|
@@ -477,7 +533,7 @@ export class PlatformImpl extends ReclaimVerification.Platform {
|
|
|
477
533
|
const replyId = event.replyId;
|
|
478
534
|
try {
|
|
479
535
|
let result = await sessionManagement.onSessionCreateRequest(event);
|
|
480
|
-
NativeReclaimInappModule.replyWithString(replyId, result);
|
|
536
|
+
NativeReclaimInappModule.replyWithString(replyId, JSON.stringify(result));
|
|
481
537
|
} catch (error) {
|
|
482
538
|
console.error(error);
|
|
483
539
|
// Send an empty string to indicate failure
|
|
@@ -99,9 +99,15 @@ export interface Request {
|
|
|
99
99
|
*/
|
|
100
100
|
parameters?: { [key: string]: string }; // Use index signature for Map
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
/**
|
|
103
|
+
* The version of the provider to use in verification
|
|
104
|
+
*/
|
|
105
|
+
providerVersion?: ProviderVersion | null; // Optional
|
|
106
|
+
}
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
export interface ProviderVersion {
|
|
109
|
+
resolvedVersion: string;
|
|
110
|
+
versionExpression: string;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
/**
|
|
@@ -171,6 +177,17 @@ export interface FeatureOptions {
|
|
|
171
177
|
* @deprecated Removed.
|
|
172
178
|
*/
|
|
173
179
|
isAIFlowEnabled?: boolean | null;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Message to display when the user submitting a verification session for manual review.
|
|
183
|
+
* Optional, defaults to null.
|
|
184
|
+
*/
|
|
185
|
+
manualReviewMessage?: string | null;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Message to display when the user is logging in.
|
|
189
|
+
*/
|
|
190
|
+
loginPromptMessage?: string | null;
|
|
174
191
|
}
|
|
175
192
|
|
|
176
193
|
export interface LogConsumer {
|
|
@@ -271,6 +288,10 @@ export interface SessionCreateRequestEvent {
|
|
|
271
288
|
* The session signature for the verification attempt
|
|
272
289
|
*/
|
|
273
290
|
signature: string;
|
|
291
|
+
/**
|
|
292
|
+
* The provider version for the verification attempt
|
|
293
|
+
*/
|
|
294
|
+
providerVersion: string;
|
|
274
295
|
/**
|
|
275
296
|
* internal
|
|
276
297
|
*/
|
|
@@ -348,6 +369,7 @@ export interface ReclaimAttestorAuthRequest {
|
|
|
348
369
|
export interface Spec extends TurboModule {
|
|
349
370
|
startVerification(request: Request): Promise<Response>;
|
|
350
371
|
startVerificationFromUrl(requestUrl: string): Promise<Response>;
|
|
372
|
+
startVerificationFromJson(templateJsonString: string): Promise<Response>;
|
|
351
373
|
setOverrides(overrides: Overrides): Promise<void>;
|
|
352
374
|
clearAllOverrides(): Promise<void>;
|
|
353
375
|
setVerificationOptions(args: VerificationOptionsOptional): Promise<void>;
|