@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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReclaimVerification } from "./index";
|
|
2
|
+
export declare class PlatformImpl extends ReclaimVerification.Platform {
|
|
3
|
+
startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response>;
|
|
4
|
+
startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerification.Response>;
|
|
5
|
+
ping(): Promise<boolean>;
|
|
6
|
+
private previousSessionManagementCancelCallback;
|
|
7
|
+
disposeSessionManagement(): void;
|
|
8
|
+
private previousLogSubscription;
|
|
9
|
+
disposeLogListener(): void;
|
|
10
|
+
private previousProviderRequestCancelCallback;
|
|
11
|
+
private disposeProviderRequestListener;
|
|
12
|
+
setOverrides({ provider, featureOptions, logConsumer, sessionManagement, appInfo, capabilityAccessToken }: ReclaimVerification.OverrideConfig): Promise<void>;
|
|
13
|
+
clearAllOverrides(): Promise<void>;
|
|
14
|
+
private previousAttestorAuthRequestCancelCallback;
|
|
15
|
+
disposeAttestorAuthRequestListener(): void;
|
|
16
|
+
setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/platform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,qBAAa,YAAa,SAAQ,mBAAmB,CAAC,QAAQ;IAC3C,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;IAkB9F,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;IAkBnF,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAIvC,OAAO,CAAC,uCAAuC,CAA6B;IAC5E,wBAAwB;IAQxB,OAAO,CAAC,uBAAuB,CAAkC;IACjE,kBAAkB;IAKlB,OAAO,CAAC,qCAAqC,CAA6B;IAC1E,OAAO,CAAC,8BAA8B;IAQvB,YAAY,CAAC,EACxB,QAAQ,EACR,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACxB,EAAE,mBAAmB,CAAC,cAAc;IAgGtB,iBAAiB;IAOhC,OAAO,CAAC,yCAAyC,CAA6B;IAC9E,kCAAkC;IAQnB,sBAAsB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CA4BjH"}
|
|
@@ -281,20 +281,36 @@ export interface ProviderInformationRequest {
|
|
|
281
281
|
*/
|
|
282
282
|
readonly replyId: string;
|
|
283
283
|
}
|
|
284
|
+
export interface VerificationOptions {
|
|
285
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
286
|
+
canUseAttestorAuthenticationRequest: boolean;
|
|
287
|
+
}
|
|
288
|
+
export interface VerificationOptionsOptional {
|
|
289
|
+
options?: VerificationOptions | null;
|
|
290
|
+
}
|
|
291
|
+
export interface ReclaimAttestorAuthRequest {
|
|
292
|
+
reclaimHttpProviderJsonString: string;
|
|
293
|
+
/**
|
|
294
|
+
* internal
|
|
295
|
+
*/
|
|
296
|
+
readonly replyId: string;
|
|
297
|
+
}
|
|
284
298
|
export interface Spec extends TurboModule {
|
|
285
299
|
startVerification(request: Request): Promise<Response>;
|
|
286
300
|
startVerificationFromUrl(requestUrl: string): Promise<Response>;
|
|
287
301
|
setOverrides(overrides: Overrides): Promise<void>;
|
|
288
302
|
clearAllOverrides(): Promise<void>;
|
|
303
|
+
setVerificationOptions(args: VerificationOptionsOptional): Promise<void>;
|
|
289
304
|
reply(replyId: string, reply: boolean): void;
|
|
290
|
-
|
|
305
|
+
replyWithString(replyId: string, value: string): void;
|
|
291
306
|
ping(): Promise<boolean>;
|
|
292
307
|
readonly onLogs: EventEmitter<string>;
|
|
293
308
|
readonly onSessionLogs: EventEmitter<SessionLogEvent>;
|
|
294
309
|
readonly onSessionCreateRequest: EventEmitter<SessionCreateRequestEvent>;
|
|
295
310
|
readonly onSessionUpdateRequest: EventEmitter<SessionUpdateRequestEvent>;
|
|
296
|
-
readonly onSessionIdentityUpdate: EventEmitter<ReclaimSessionIdentityUpdate>;
|
|
297
311
|
readonly onProviderInformationRequest: EventEmitter<ProviderInformationRequest>;
|
|
312
|
+
readonly onReclaimAttestorAuthRequest: EventEmitter<ReclaimAttestorAuthRequest>;
|
|
313
|
+
readonly onSessionIdentityUpdate: EventEmitter<ReclaimSessionIdentityUpdate>;
|
|
298
314
|
}
|
|
299
315
|
declare const _default: Spec;
|
|
300
316
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeInappRnSdk.d.ts","sourceRoot":"","sources":["../../../../../src/specs/NativeInappRnSdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAE9E,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AACD;;;;KAIK;AACL,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAEvC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,QA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MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IACrD,QAAQ,CAAC,sBAAsB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAA;IACxE,QAAQ,CAAC,sBAAsB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAA;IACxE,QAAQ,CAAC,4BAA4B,EAAE,YAAY,CAAC,0BAA0B,CAAC,CAAA;IAC/E,QAAQ,CAAC,4BAA4B,EAAE,YAAY,CAAC,0BAA0B,CAAC,CAAA;IAE/E,QAAQ,CAAC,uBAAuB,EAAE,YAAY,CAAC,4BAA4B,CAAC,CAAA;CAC7E;;AAED,wBAAoE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/inapp-rn-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
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",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
45
45
|
"android:gen:specs": "cd example/android && ./gradlew :app:invokeLibraryCodegen",
|
|
46
46
|
"ios:gen:specs": "cd example/ios && bundle install && bundle exec pod install",
|
|
47
|
+
"gen:specs": "npx react-native codegen",
|
|
47
48
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
48
49
|
"prepare": "bob build",
|
|
49
50
|
"release": "release-it"
|
package/src/index.ts
CHANGED
|
@@ -1,36 +1,278 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export type { ReclaimVerificationApi as ReclaimVerificationApiType, ReclaimResult } from './ReclaimVerificationPlatformChannel';
|
|
1
|
+
import * as NativeReclaimInappModuleTypes from "./specs/NativeInappRnSdk";
|
|
2
|
+
import { PlatformImpl } from "./platform";
|
|
4
3
|
|
|
4
|
+
/**
|
|
5
|
+
* [ReclaimVerification] is the main class for interacting with the Reclaim verification system.
|
|
6
|
+
* It provides methods to start verification processes, manage platform configurations,
|
|
7
|
+
* and handle verification options.
|
|
8
|
+
*
|
|
9
|
+
* The class can be instantiated with a custom platform implementation, or will use
|
|
10
|
+
* the default [PlatformImpl] if none is provided.
|
|
11
|
+
*/
|
|
5
12
|
export class ReclaimVerification {
|
|
6
|
-
public
|
|
13
|
+
public platform: ReclaimVerification.Platform;
|
|
7
14
|
|
|
8
|
-
private static
|
|
15
|
+
private static defaultPlatform: ReclaimVerification.Platform | null = null;
|
|
9
16
|
|
|
10
|
-
public constructor(
|
|
11
|
-
if (
|
|
12
|
-
this.
|
|
17
|
+
public constructor(platform?: ReclaimVerification.Platform) {
|
|
18
|
+
if (platform) {
|
|
19
|
+
this.platform = platform;
|
|
13
20
|
} else {
|
|
14
|
-
if (ReclaimVerification.
|
|
15
|
-
ReclaimVerification.
|
|
21
|
+
if (ReclaimVerification.defaultPlatform == null) {
|
|
22
|
+
ReclaimVerification.defaultPlatform = new PlatformImpl();
|
|
16
23
|
}
|
|
17
|
-
this.
|
|
24
|
+
this.platform = ReclaimVerification.defaultPlatform;
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
public async startVerification(request:
|
|
22
|
-
return this.
|
|
28
|
+
public async startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response> {
|
|
29
|
+
return this.platform.startVerification(request);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
public async ping(): Promise<boolean> {
|
|
26
|
-
return this.
|
|
33
|
+
return this.platform.ping();
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
public setOverrides(overrides:
|
|
30
|
-
return this.
|
|
36
|
+
public setOverrides(overrides: ReclaimVerification.OverrideConfig) {
|
|
37
|
+
return this.platform.setOverrides(overrides);
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
public clearAllOverrides() {
|
|
34
|
-
return this.
|
|
41
|
+
return this.platform.clearAllOverrides();
|
|
35
42
|
}
|
|
36
|
-
|
|
43
|
+
|
|
44
|
+
public setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null) {
|
|
45
|
+
return this.platform.setVerificationOptions(options);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* This namespace provides types involved in initiating and managing the verification process
|
|
52
|
+
* for proving claims about user data through various providers.
|
|
53
|
+
*/
|
|
54
|
+
export namespace ReclaimVerification {
|
|
55
|
+
/**
|
|
56
|
+
* Represents user's session information for a verification attempt.
|
|
57
|
+
* This data class contains the necessary data to identify and validate a verification session.
|
|
58
|
+
*/
|
|
59
|
+
export type SessionInformation = NativeReclaimInappModuleTypes.SessionInformation;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Represents a request for a verification attempt.
|
|
63
|
+
*
|
|
64
|
+
* You can create a request using the [ReclaimVerification.Request] constructor or the [ReclaimVerification.Request.fromManifestMetaData] factory method.
|
|
65
|
+
*/
|
|
66
|
+
export type Request = NativeReclaimInappModuleTypes.Request;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Contains the proof and response data after verification
|
|
70
|
+
*/
|
|
71
|
+
export interface Response extends NativeReclaimInappModuleTypes.Response {
|
|
72
|
+
proofs: ReclaimResult.Proof[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export namespace ReclaimResult {
|
|
76
|
+
export interface Proof {
|
|
77
|
+
identifier: string;
|
|
78
|
+
signatures: string[];
|
|
79
|
+
/**
|
|
80
|
+
* A data associated with this [Proof].
|
|
81
|
+
* The data type of this object is dynamic and can be any JSON serializable Javascript object.
|
|
82
|
+
*/
|
|
83
|
+
publicData?: any | null;
|
|
84
|
+
witnesses: WitnessData[];
|
|
85
|
+
claimData: ProviderClaimData;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const isProof = (value: Record<string, any>): value is Proof => {
|
|
89
|
+
return typeof value === 'object' && value !== null && 'identifier' in value && 'signatures' in value && 'witnesses' in value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const asProofs = (proofs: Record<string, any>[]): Proof[] => {
|
|
93
|
+
return proofs.filter(isProof);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ProviderClaimData {
|
|
97
|
+
owner: string;
|
|
98
|
+
provider: string;
|
|
99
|
+
/// int
|
|
100
|
+
timestampS: number;
|
|
101
|
+
/// int
|
|
102
|
+
epoch: number;
|
|
103
|
+
context: string;
|
|
104
|
+
identifier: string;
|
|
105
|
+
parameters: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface WitnessData {
|
|
109
|
+
id: string;
|
|
110
|
+
url: string;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface VerificationOptions {
|
|
115
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
116
|
+
fetchAttestorAuthenticationRequest: (reclaimHttpProviderJsonString: string) => Promise<string>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export namespace Overrides {
|
|
120
|
+
export interface ProviderInformation {
|
|
121
|
+
url?: string;
|
|
122
|
+
jsonString?: string;
|
|
123
|
+
callback?: (request: NativeReclaimInappModuleTypes.ProviderInformationRequest) => Promise<string>;
|
|
124
|
+
}
|
|
125
|
+
export type FeatureOptions = NativeReclaimInappModuleTypes.FeatureOptions;
|
|
126
|
+
export interface LogConsumer {
|
|
127
|
+
/**
|
|
128
|
+
* Handler for consuming logs exported from the SDK.
|
|
129
|
+
* Defaults to false.
|
|
130
|
+
*/
|
|
131
|
+
onLogs?: (logJsonString: String, cancel: () => void) => void;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* When enabled, logs are sent to reclaim that can be used to help you.
|
|
135
|
+
* Defaults to true.
|
|
136
|
+
*/
|
|
137
|
+
canSdkCollectTelemetry?: boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Defaults to enabled when not in release mode.
|
|
141
|
+
*/
|
|
142
|
+
canSdkPrintLogs?: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface SessionManagement {
|
|
145
|
+
onLog: (event: NativeReclaimInappModuleTypes.SessionLogEvent) => void;
|
|
146
|
+
onSessionCreateRequest: (event: NativeReclaimInappModuleTypes.SessionCreateRequestEvent) => Promise<boolean>;
|
|
147
|
+
onSessionUpdateRequest: (event: NativeReclaimInappModuleTypes.SessionUpdateRequestEvent) => Promise<boolean>;
|
|
148
|
+
};
|
|
149
|
+
export type ReclaimAppInfo = NativeReclaimInappModuleTypes.ReclaimAppInfo;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type OverrideConfig = {
|
|
153
|
+
provider?: Overrides.ProviderInformation,
|
|
154
|
+
featureOptions?: Overrides.FeatureOptions,
|
|
155
|
+
logConsumer?: Overrides.LogConsumer,
|
|
156
|
+
sessionManagement?: Overrides.SessionManagement,
|
|
157
|
+
appInfo?: Overrides.ReclaimAppInfo,
|
|
158
|
+
capabilityAccessToken?: string | null,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export enum ExceptionType {
|
|
162
|
+
Cancelled = "Cancelled",
|
|
163
|
+
Dismissed = "Dismissed",
|
|
164
|
+
SessionExpired = "SessionExpired",
|
|
165
|
+
Failed = "Failed",
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export class ReclaimPlatformException extends Error {
|
|
169
|
+
readonly innerError: Error
|
|
170
|
+
readonly reason?: string
|
|
171
|
+
readonly details?: any
|
|
172
|
+
|
|
173
|
+
constructor(message: string, innerError: Error) {
|
|
174
|
+
super(message);
|
|
175
|
+
this.innerError = innerError;
|
|
176
|
+
this.reason = innerError.message;
|
|
177
|
+
if ('userInfo' in innerError) {
|
|
178
|
+
const details: any = innerError.userInfo
|
|
179
|
+
this.details = details
|
|
180
|
+
if ('message' in details) {
|
|
181
|
+
this.reason = details.message || this.reason
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static isReclaimPlatformException(error: Error): error is ReclaimPlatformException {
|
|
187
|
+
return error instanceof ReclaimPlatformException
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export class ReclaimVerificationException extends Error {
|
|
192
|
+
readonly innerError: Error
|
|
193
|
+
readonly type: ExceptionType
|
|
194
|
+
readonly sessionId: string
|
|
195
|
+
readonly "didSubmitManualVerification": boolean
|
|
196
|
+
readonly "reason": string
|
|
197
|
+
|
|
198
|
+
constructor(
|
|
199
|
+
message: string,
|
|
200
|
+
innerError: Error,
|
|
201
|
+
type: ExceptionType,
|
|
202
|
+
sessionId: string,
|
|
203
|
+
didSubmitManualVerification: boolean,
|
|
204
|
+
reason: string
|
|
205
|
+
) {
|
|
206
|
+
super(message);
|
|
207
|
+
this.innerError = innerError;
|
|
208
|
+
this.type = type;
|
|
209
|
+
this.sessionId = sessionId;
|
|
210
|
+
this.didSubmitManualVerification = didSubmitManualVerification;
|
|
211
|
+
this.reason = reason;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private static fromTypeName(name: string): ExceptionType {
|
|
215
|
+
switch (name) {
|
|
216
|
+
case "cancelled":
|
|
217
|
+
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Cancelled":
|
|
218
|
+
return ExceptionType.Cancelled;
|
|
219
|
+
case "dismissed":
|
|
220
|
+
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Dismissed":
|
|
221
|
+
return ExceptionType.Dismissed;
|
|
222
|
+
case "sessionExpired":
|
|
223
|
+
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.SessionExpired":
|
|
224
|
+
return ExceptionType.SessionExpired;
|
|
225
|
+
case "failed":
|
|
226
|
+
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Failed":
|
|
227
|
+
return ExceptionType.Failed;
|
|
228
|
+
}
|
|
229
|
+
return ExceptionType.Failed;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
static fromError(error: Error, sessionIdHint: string): ReclaimVerificationException {
|
|
233
|
+
if ('userInfo' in error) {
|
|
234
|
+
// From native, we send information about error in userInfo
|
|
235
|
+
let userInfo = error.userInfo as any;
|
|
236
|
+
if (userInfo) {
|
|
237
|
+
let type = ReclaimVerification.ReclaimVerificationException.fromTypeName(userInfo.errorType);
|
|
238
|
+
let maybeSessionId = userInfo?.sessionId
|
|
239
|
+
return new ReclaimVerificationException(
|
|
240
|
+
error.message,
|
|
241
|
+
error,
|
|
242
|
+
type,
|
|
243
|
+
(typeof maybeSessionId === 'string' && maybeSessionId)
|
|
244
|
+
? maybeSessionId : sessionIdHint,
|
|
245
|
+
userInfo?.didSubmitManualVerification ?? false,
|
|
246
|
+
userInfo?.reason ?? ""
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return new ReclaimVerificationException(
|
|
251
|
+
error.message,
|
|
252
|
+
error,
|
|
253
|
+
ReclaimVerification.ExceptionType.Failed,
|
|
254
|
+
sessionIdHint,
|
|
255
|
+
false,
|
|
256
|
+
""
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
static isReclaimVerificationException(error: Error): error is ReclaimVerificationException {
|
|
261
|
+
return error instanceof ReclaimVerificationException
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export abstract class Platform {
|
|
266
|
+
abstract startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response>
|
|
267
|
+
|
|
268
|
+
abstract startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerification.Response>
|
|
269
|
+
|
|
270
|
+
abstract ping(): Promise<boolean>
|
|
271
|
+
|
|
272
|
+
abstract setOverrides(config: ReclaimVerification.OverrideConfig): Promise<void>
|
|
273
|
+
|
|
274
|
+
abstract clearAllOverrides(): Promise<void>
|
|
275
|
+
|
|
276
|
+
abstract setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void>
|
|
277
|
+
}
|
|
278
|
+
}
|
package/src/platform.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { EventSubscription } from "react-native";
|
|
2
|
+
import NativeReclaimInappModule from "./specs/NativeInappRnSdk";
|
|
3
|
+
import * as NativeReclaimInappModuleTypes from "./specs/NativeInappRnSdk";
|
|
4
|
+
import { ReclaimVerification } from "./index";
|
|
5
|
+
|
|
6
|
+
export class PlatformImpl extends ReclaimVerification.Platform {
|
|
7
|
+
override async startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response> {
|
|
8
|
+
try {
|
|
9
|
+
const response = await NativeReclaimInappModule.startVerification(request);
|
|
10
|
+
return {
|
|
11
|
+
...response,
|
|
12
|
+
proofs: ReclaimVerification.ReclaimResult.asProofs(response.proofs),
|
|
13
|
+
}
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.info({
|
|
16
|
+
error
|
|
17
|
+
})
|
|
18
|
+
if (error instanceof Error) {
|
|
19
|
+
throw ReclaimVerification.ReclaimVerificationException.fromError(error, request.session?.sessionId ?? "");
|
|
20
|
+
}
|
|
21
|
+
throw error
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override async startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerification.Response> {
|
|
26
|
+
try {
|
|
27
|
+
const response = await NativeReclaimInappModule.startVerificationFromUrl(requestUrl);
|
|
28
|
+
return {
|
|
29
|
+
...response,
|
|
30
|
+
proofs: ReclaimVerification.ReclaimResult.asProofs(response.proofs),
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.info({
|
|
34
|
+
error
|
|
35
|
+
})
|
|
36
|
+
if (error instanceof Error) {
|
|
37
|
+
throw ReclaimVerification.ReclaimVerificationException.fromError(error, "");
|
|
38
|
+
}
|
|
39
|
+
throw error
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override async ping(): Promise<boolean> {
|
|
44
|
+
return await NativeReclaimInappModule.ping();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private previousSessionManagementCancelCallback: null | (() => void) = null;
|
|
48
|
+
disposeSessionManagement() {
|
|
49
|
+
let callback = this.previousSessionManagementCancelCallback;
|
|
50
|
+
if (callback != null && callback != undefined) {
|
|
51
|
+
callback();
|
|
52
|
+
}
|
|
53
|
+
this.previousSessionManagementCancelCallback = null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private previousLogSubscription: EventSubscription | null = null;
|
|
57
|
+
disposeLogListener() {
|
|
58
|
+
this.previousLogSubscription?.remove()
|
|
59
|
+
this.previousLogSubscription = null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private previousProviderRequestCancelCallback: null | (() => void) = null;
|
|
63
|
+
private disposeProviderRequestListener() {
|
|
64
|
+
let callback = this.previousProviderRequestCancelCallback;
|
|
65
|
+
if (callback != null && callback != undefined) {
|
|
66
|
+
callback();
|
|
67
|
+
}
|
|
68
|
+
this.previousProviderRequestCancelCallback = null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
override async setOverrides({
|
|
72
|
+
provider,
|
|
73
|
+
featureOptions,
|
|
74
|
+
logConsumer,
|
|
75
|
+
sessionManagement,
|
|
76
|
+
appInfo,
|
|
77
|
+
capabilityAccessToken
|
|
78
|
+
}: ReclaimVerification.OverrideConfig) {
|
|
79
|
+
let providerCallback = provider?.callback;
|
|
80
|
+
let providerOverride = !provider ? null : {
|
|
81
|
+
url: provider?.url,
|
|
82
|
+
jsonString: provider?.jsonString,
|
|
83
|
+
canFetchProviderInformationFromHost: !!providerCallback,
|
|
84
|
+
}
|
|
85
|
+
if (providerCallback) {
|
|
86
|
+
this.disposeProviderRequestListener();
|
|
87
|
+
let providerRequestSubscription = NativeReclaimInappModule.onProviderInformationRequest(async (event) => {
|
|
88
|
+
try {
|
|
89
|
+
let result = await providerCallback(event);
|
|
90
|
+
NativeReclaimInappModule.replyWithString(event.replyId, result);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error(error);
|
|
93
|
+
NativeReclaimInappModule.replyWithString(event.replyId, "");
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const cancel = () => {
|
|
97
|
+
providerRequestSubscription.remove();
|
|
98
|
+
}
|
|
99
|
+
this.previousProviderRequestCancelCallback = cancel;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const onLogsListener = logConsumer?.onLogs;
|
|
103
|
+
let logConsumerRequest = !logConsumer ? undefined : {
|
|
104
|
+
enableLogHandler: !!onLogsListener,
|
|
105
|
+
canSdkCollectTelemetry: logConsumer?.canSdkCollectTelemetry,
|
|
106
|
+
canSdkPrintLogs: logConsumer?.canSdkPrintLogs
|
|
107
|
+
}
|
|
108
|
+
if (onLogsListener) {
|
|
109
|
+
this.disposeLogListener();
|
|
110
|
+
const cancel = () => {
|
|
111
|
+
this.previousLogSubscription?.remove();
|
|
112
|
+
this.previousLogSubscription = null;
|
|
113
|
+
};
|
|
114
|
+
this.previousLogSubscription = NativeReclaimInappModule.onLogs((arg) => {
|
|
115
|
+
onLogsListener(arg, cancel);
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let sessionManagementRequest = !sessionManagement ? undefined : {
|
|
120
|
+
// A handler is provided, so we don't let SDK manage sessions
|
|
121
|
+
enableSdkSessionManagement: false
|
|
122
|
+
}
|
|
123
|
+
if (sessionManagement) {
|
|
124
|
+
this.disposeSessionManagement();
|
|
125
|
+
let sessionCreateSubscription = NativeReclaimInappModule.onSessionCreateRequest(async (event) => {
|
|
126
|
+
const replyId = event.replyId;
|
|
127
|
+
try {
|
|
128
|
+
let result = await sessionManagement.onSessionCreateRequest(event);
|
|
129
|
+
NativeReclaimInappModule.reply(replyId, result);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error(error);
|
|
132
|
+
NativeReclaimInappModule.reply(replyId, false);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
let sessionUpdateSubscription = NativeReclaimInappModule.onSessionUpdateRequest(async (event) => {
|
|
136
|
+
const replyId = event.replyId;
|
|
137
|
+
try {
|
|
138
|
+
let result = await sessionManagement.onSessionUpdateRequest(event);
|
|
139
|
+
NativeReclaimInappModule.reply(replyId, result);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error(error);
|
|
142
|
+
NativeReclaimInappModule.reply(replyId, false);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
let sessionLogsSubscription = NativeReclaimInappModule.onSessionLogs((event) => {
|
|
146
|
+
try {
|
|
147
|
+
sessionManagement.onLog(event);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error(error);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
const cancel = () => {
|
|
153
|
+
sessionCreateSubscription.remove()
|
|
154
|
+
sessionUpdateSubscription.remove()
|
|
155
|
+
sessionLogsSubscription.remove()
|
|
156
|
+
}
|
|
157
|
+
this.previousSessionManagementCancelCallback = cancel;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
return await NativeReclaimInappModule.setOverrides({
|
|
162
|
+
provider: providerOverride,
|
|
163
|
+
featureOptions,
|
|
164
|
+
logConsumer: logConsumerRequest,
|
|
165
|
+
sessionManagement: sessionManagementRequest,
|
|
166
|
+
appInfo,
|
|
167
|
+
capabilityAccessToken
|
|
168
|
+
});
|
|
169
|
+
} catch (error) {
|
|
170
|
+
throw new ReclaimVerification.ReclaimPlatformException("Failed to set overrides", error as Error);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
override async clearAllOverrides() {
|
|
175
|
+
this.disposeProviderRequestListener();
|
|
176
|
+
this.disposeLogListener();
|
|
177
|
+
this.disposeSessionManagement();
|
|
178
|
+
return NativeReclaimInappModule.clearAllOverrides();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private previousAttestorAuthRequestCancelCallback: null | (() => void) = null;
|
|
182
|
+
disposeAttestorAuthRequestListener() {
|
|
183
|
+
let callback = this.previousAttestorAuthRequestCancelCallback;
|
|
184
|
+
if (callback != null && callback != undefined) {
|
|
185
|
+
callback();
|
|
186
|
+
}
|
|
187
|
+
this.previousAttestorAuthRequestCancelCallback = null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
override async setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void> {
|
|
191
|
+
let args: NativeReclaimInappModuleTypes.VerificationOptions | null = null
|
|
192
|
+
if (options) {
|
|
193
|
+
let canUseAttestorAuthenticationRequest = options.fetchAttestorAuthenticationRequest != null
|
|
194
|
+
args = {
|
|
195
|
+
canDeleteCookiesBeforeVerificationStarts: options.canDeleteCookiesBeforeVerificationStarts,
|
|
196
|
+
canUseAttestorAuthenticationRequest: canUseAttestorAuthenticationRequest,
|
|
197
|
+
}
|
|
198
|
+
if (canUseAttestorAuthenticationRequest) {
|
|
199
|
+
this.disposeAttestorAuthRequestListener();
|
|
200
|
+
let attestorAuthRequestSubscription = NativeReclaimInappModule.onReclaimAttestorAuthRequest(async (event) => {
|
|
201
|
+
let result = await options.fetchAttestorAuthenticationRequest(event.reclaimHttpProviderJsonString);
|
|
202
|
+
NativeReclaimInappModule.replyWithString(event.replyId, result);
|
|
203
|
+
});
|
|
204
|
+
const cancel = () => {
|
|
205
|
+
attestorAuthRequestSubscription.remove();
|
|
206
|
+
}
|
|
207
|
+
this.previousAttestorAuthRequestCancelCallback = cancel;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
return await NativeReclaimInappModule.setVerificationOptions({
|
|
212
|
+
options: args
|
|
213
|
+
});
|
|
214
|
+
} catch (error) {
|
|
215
|
+
throw new ReclaimVerification.ReclaimPlatformException("Failed to set verification options", error as Error);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -319,22 +319,41 @@ export interface ProviderInformationRequest {
|
|
|
319
319
|
readonly replyId: string;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
+
export interface VerificationOptions {
|
|
323
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
324
|
+
canUseAttestorAuthenticationRequest: boolean;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface VerificationOptionsOptional {
|
|
328
|
+
options?: VerificationOptions | null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export interface ReclaimAttestorAuthRequest {
|
|
332
|
+
reclaimHttpProviderJsonString: string;
|
|
333
|
+
/**
|
|
334
|
+
* internal
|
|
335
|
+
*/
|
|
336
|
+
readonly replyId: string;
|
|
337
|
+
}
|
|
338
|
+
|
|
322
339
|
export interface Spec extends TurboModule {
|
|
323
340
|
startVerification(request: Request): Promise<Response>;
|
|
324
341
|
startVerificationFromUrl(requestUrl: string): Promise<Response>;
|
|
325
342
|
setOverrides(overrides: Overrides): Promise<void>;
|
|
326
343
|
clearAllOverrides(): Promise<void>;
|
|
344
|
+
setVerificationOptions(args: VerificationOptionsOptional): Promise<void>;
|
|
327
345
|
reply(replyId: string, reply: boolean): void;
|
|
328
|
-
|
|
346
|
+
replyWithString(replyId: string, value: string): void;
|
|
329
347
|
ping(): Promise<boolean>;
|
|
330
348
|
|
|
331
349
|
readonly onLogs: EventEmitter<string>
|
|
332
350
|
readonly onSessionLogs: EventEmitter<SessionLogEvent>
|
|
333
351
|
readonly onSessionCreateRequest: EventEmitter<SessionCreateRequestEvent>
|
|
334
352
|
readonly onSessionUpdateRequest: EventEmitter<SessionUpdateRequestEvent>
|
|
353
|
+
readonly onProviderInformationRequest: EventEmitter<ProviderInformationRequest>
|
|
354
|
+
readonly onReclaimAttestorAuthRequest: EventEmitter<ReclaimAttestorAuthRequest>
|
|
335
355
|
// unimplemented
|
|
336
356
|
readonly onSessionIdentityUpdate: EventEmitter<ReclaimSessionIdentityUpdate>
|
|
337
|
-
readonly onProviderInformationRequest: EventEmitter<ProviderInformationRequest>
|
|
338
357
|
}
|
|
339
358
|
|
|
340
359
|
export default TurboModuleRegistry.getEnforcing<Spec>('InappRnSdk');
|