@reclaimprotocol/inapp-rn-sdk 0.1.7 → 0.3.0
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 +12 -7
- package/android/build.gradle +3 -3
- package/android/generated/java/com/reclaimprotocol/inapp_rn_sdk/NativeInappRnSdkSpec.java +24 -0
- package/android/generated/jni/RNInappRnSdkSpec-generated.cpp +21 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI-generated.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNInappRnSdkSpec/RNInappRnSdkSpecJSI.h +348 -20
- package/android/src/main/java/com/reclaimprotocol/inapp_rn_sdk/InappRnSdkModule.kt +140 -20
- package/ios/InappRnSdk.mm +65 -11
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec-generated.mm +48 -0
- package/ios/generated/RNInappRnSdkSpec/RNInappRnSdkSpec.h +68 -6
- package/ios/generated/RNInappRnSdkSpecJSI-generated.cpp +22 -0
- package/ios/generated/RNInappRnSdkSpecJSI.h +348 -20
- package/ios/inapp_rn_sdk/Api.swift +124 -7
- package/lib/commonjs/ReclaimVerificationPlatformChannel.js +156 -36
- package/lib/commonjs/ReclaimVerificationPlatformChannel.js.map +1 -1
- package/lib/commonjs/index.js +14 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeInappRnSdk.js +1 -0
- package/lib/commonjs/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/module/ReclaimVerificationPlatformChannel.js +153 -34
- package/lib/module/ReclaimVerificationPlatformChannel.js.map +1 -1
- package/lib/module/index.js +10 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeInappRnSdk.js +2 -0
- package/lib/module/specs/NativeInappRnSdk.js.map +1 -1
- package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts +37 -4
- package/lib/typescript/commonjs/src/ReclaimVerificationPlatformChannel.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +5 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts +38 -4
- package/lib/typescript/commonjs/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/proof.d.ts.map +1 -1
- package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts +37 -4
- package/lib/typescript/module/src/ReclaimVerificationPlatformChannel.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +5 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts +38 -4
- package/lib/typescript/module/src/specs/NativeInappRnSdk.d.ts.map +1 -1
- package/lib/typescript/module/src/types/proof.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ReclaimVerificationPlatformChannel.ts +194 -41
- package/src/index.ts +12 -4
- package/src/specs/NativeInappRnSdk.ts +51 -6
|
@@ -21,8 +21,16 @@ export declare namespace ReclaimVerificationApi {
|
|
|
21
21
|
* Contains the proof and response data after verification
|
|
22
22
|
*/
|
|
23
23
|
type Response = ReclaimVerificationResponse;
|
|
24
|
+
interface VerificationOptions {
|
|
25
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
26
|
+
fetchAttestorAuthenticationRequest: (reclaimHttpProviderJsonString: string) => Promise<string>;
|
|
27
|
+
}
|
|
24
28
|
namespace Overrides {
|
|
25
|
-
|
|
29
|
+
interface ProviderInformation {
|
|
30
|
+
url?: string;
|
|
31
|
+
jsonString?: string;
|
|
32
|
+
callback?: (request: NativeReclaimInappModuleTypes.ProviderInformationRequest) => Promise<string>;
|
|
33
|
+
}
|
|
26
34
|
type FeatureOptions = NativeReclaimInappModuleTypes.FeatureOptions;
|
|
27
35
|
interface LogConsumer {
|
|
28
36
|
/**
|
|
@@ -53,6 +61,7 @@ export declare namespace ReclaimVerificationApi {
|
|
|
53
61
|
logConsumer?: Overrides.LogConsumer;
|
|
54
62
|
sessionManagement?: Overrides.SessionManagement;
|
|
55
63
|
appInfo?: Overrides.ReclaimAppInfo;
|
|
64
|
+
capabilityAccessToken?: string | null;
|
|
56
65
|
};
|
|
57
66
|
enum ExceptionType {
|
|
58
67
|
Cancelled = "Cancelled",
|
|
@@ -60,6 +69,13 @@ export declare namespace ReclaimVerificationApi {
|
|
|
60
69
|
SessionExpired = "SessionExpired",
|
|
61
70
|
Failed = "Failed"
|
|
62
71
|
}
|
|
72
|
+
class ReclaimPlatformException extends Error {
|
|
73
|
+
readonly innerError: Error;
|
|
74
|
+
readonly reason?: string;
|
|
75
|
+
readonly details?: any;
|
|
76
|
+
constructor(message: string, innerError: Error);
|
|
77
|
+
static isReclaimPlatformException(error: Error): error is ReclaimPlatformException;
|
|
78
|
+
}
|
|
63
79
|
class ReclaimVerificationException extends Error {
|
|
64
80
|
readonly innerError: Error;
|
|
65
81
|
readonly type: ExceptionType;
|
|
@@ -69,14 +85,31 @@ export declare namespace ReclaimVerificationApi {
|
|
|
69
85
|
constructor(message: string, innerError: Error, type: ExceptionType, sessionId: string, didSubmitManualVerification: boolean, reason: string);
|
|
70
86
|
private static fromTypeName;
|
|
71
87
|
static fromError(error: Error, sessionIdHint: string): ReclaimVerificationException;
|
|
88
|
+
static isReclaimVerificationException(error: Error): error is ReclaimVerificationException;
|
|
72
89
|
}
|
|
73
90
|
}
|
|
74
|
-
export declare class ReclaimVerificationPlatformChannel {
|
|
91
|
+
export declare abstract class ReclaimVerificationPlatformChannel {
|
|
92
|
+
abstract startVerification(request: ReclaimVerificationApi.Request): Promise<ReclaimVerificationApi.Response>;
|
|
93
|
+
abstract startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerificationApi.Response>;
|
|
94
|
+
abstract ping(): Promise<boolean>;
|
|
95
|
+
abstract setOverrides(config: ReclaimVerificationApi.OverrideConfig): Promise<void>;
|
|
96
|
+
abstract clearAllOverrides(): Promise<void>;
|
|
97
|
+
abstract setVerificationOptions(options?: ReclaimVerificationApi.VerificationOptions | null): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
export declare class ReclaimVerificationPlatformChannelImpl extends ReclaimVerificationPlatformChannel {
|
|
75
100
|
startVerification(request: ReclaimVerificationApi.Request): Promise<ReclaimVerificationApi.Response>;
|
|
76
101
|
startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerificationApi.Response>;
|
|
77
102
|
ping(): Promise<boolean>;
|
|
78
|
-
private previousLogSubscription;
|
|
79
103
|
private previousSessionManagementCancelCallback;
|
|
80
|
-
|
|
104
|
+
disposeSessionManagement(): void;
|
|
105
|
+
private previousLogSubscription;
|
|
106
|
+
disposeLogListener(): void;
|
|
107
|
+
private previousProviderRequestCancelCallback;
|
|
108
|
+
private disposeProviderRequestListener;
|
|
109
|
+
setOverrides({ provider, featureOptions, logConsumer, sessionManagement, appInfo, capabilityAccessToken }: ReclaimVerificationApi.OverrideConfig): Promise<void>;
|
|
110
|
+
clearAllOverrides(): Promise<void>;
|
|
111
|
+
private previousAttestorAuthRequestCancelCallback;
|
|
112
|
+
disposeAttestorAuthRequestListener(): void;
|
|
113
|
+
setVerificationOptions(options?: ReclaimVerificationApi.VerificationOptions | null): Promise<void>;
|
|
81
114
|
}
|
|
82
115
|
//# sourceMappingURL=ReclaimVerificationPlatformChannel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReclaimVerificationPlatformChannel.d.ts","sourceRoot":"","sources":["../../../../src/ReclaimVerificationPlatformChannel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,6BAA6B,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAiB,KAAK,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAChF,YAAY,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhF;;;GAGG;AACH,yBAAiB,sBAAsB,CAAC;IACpC;;;OAGG;IACH,KAAY,kBAAkB,GAAG,6BAA6B,CAAC,kBAAkB,CAAC;IAElF;;;;OAIG;IACH,KAAY,OAAO,GAAG,6BAA6B,CAAC,OAAO,CAAC;IAE5D;;OAEG;IACH,KAAY,QAAQ,GAAG,2BAA2B,CAAC;IAEnD,UAAiB,SAAS,CAAC;QACvB,
|
|
1
|
+
{"version":3,"file":"ReclaimVerificationPlatformChannel.d.ts","sourceRoot":"","sources":["../../../../src/ReclaimVerificationPlatformChannel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,6BAA6B,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAiB,KAAK,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAChF,YAAY,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhF;;;GAGG;AACH,yBAAiB,sBAAsB,CAAC;IACpC;;;OAGG;IACH,KAAY,kBAAkB,GAAG,6BAA6B,CAAC,kBAAkB,CAAC;IAElF;;;;OAIG;IACH,KAAY,OAAO,GAAG,6BAA6B,CAAC,OAAO,CAAC;IAE5D;;OAEG;IACH,KAAY,QAAQ,GAAG,2BAA2B,CAAC;IAEnD,UAAiB,mBAAmB;QAChC,wCAAwC,EAAE,OAAO,CAAC;QAClD,kCAAkC,EAAE,CAAC,6BAA6B,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;KAClG;IAED,UAAiB,SAAS,CAAC;QACvB,UAAiB,mBAAmB;YAChC,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,6BAA6B,CAAC,0BAA0B,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;SACrG;QACD,KAAY,cAAc,GAAG,6BAA6B,CAAC,cAAc,CAAC;QAC1E,UAAiB,WAAW;YACxB;;;eAGG;YACH,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,I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CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAkBpG,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAkBtF,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,sBAAsB,CAAC,cAAc;IAgGzB,iBAAiB;IAOhC,OAAO,CAAC,yCAAyC,CAA6B;IAC9E,kCAAkC;IAQnB,sBAAsB,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CA4BpH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ReclaimVerificationPlatformChannel, ReclaimVerificationApi } from './ReclaimVerificationPlatformChannel';
|
|
1
|
+
import { type ReclaimVerificationApi, ReclaimVerificationPlatformChannel } from './ReclaimVerificationPlatformChannel';
|
|
2
|
+
export { ReclaimVerificationPlatformChannel, ReclaimVerificationApi, ReclaimVerificationPlatformChannelImpl } from './ReclaimVerificationPlatformChannel';
|
|
3
3
|
export type { ReclaimVerificationApi as ReclaimVerificationApiType, ReclaimResult } from './ReclaimVerificationPlatformChannel';
|
|
4
4
|
export declare class ReclaimVerification {
|
|
5
5
|
channel: ReclaimVerificationPlatformChannel;
|
|
@@ -7,6 +7,8 @@ export declare class ReclaimVerification {
|
|
|
7
7
|
constructor(channel?: ReclaimVerificationPlatformChannel);
|
|
8
8
|
startVerification(request: ReclaimVerificationApi.Request): Promise<ReclaimVerificationApi.Response>;
|
|
9
9
|
ping(): Promise<boolean>;
|
|
10
|
-
setOverrides(overrides: ReclaimVerificationApi.OverrideConfig): void
|
|
10
|
+
setOverrides(overrides: ReclaimVerificationApi.OverrideConfig): Promise<void>;
|
|
11
|
+
clearAllOverrides(): Promise<void>;
|
|
12
|
+
setVerificationOptions(options?: ReclaimVerificationApi.VerificationOptions | null): Promise<void>;
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,kCAAkC,EAA0C,MAAM,sCAAsC,CAAC;AAC/J,OAAO,EAAE,kCAAkC,EAAE,sBAAsB,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC1J,YAAY,EAAE,sBAAsB,IAAI,0BAA0B,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAEhI,qBAAa,mBAAmB;IACvB,OAAO,EAAE,kCAAkC,CAAC;IAEnD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAmD;gBAE7D,OAAO,CAAC,EAAE,kCAAkC;IAWlD,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAIpG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAI9B,YAAY,CAAC,SAAS,EAAE,sBAAsB,CAAC,cAAc;IAI7D,iBAAiB;IAIjB,sBAAsB,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,GAAG,IAAI;CAG1F"}
|
|
@@ -91,10 +91,6 @@ export interface Request {
|
|
|
91
91
|
parameters?: {
|
|
92
92
|
[key: string]: string;
|
|
93
93
|
};
|
|
94
|
-
/**
|
|
95
|
-
* Whether to hide the landing page of the verification process. When false, shows an introductory page with claims to be proven.
|
|
96
|
-
*/
|
|
97
|
-
hideLanding?: boolean;
|
|
98
94
|
/**
|
|
99
95
|
* Whether to automatically submit the proof after generation.
|
|
100
96
|
*/
|
|
@@ -124,6 +120,7 @@ export interface Response {
|
|
|
124
120
|
export interface ProviderInformation {
|
|
125
121
|
url?: string;
|
|
126
122
|
jsonString?: string;
|
|
123
|
+
canFetchProviderInformationFromHost: boolean;
|
|
127
124
|
}
|
|
128
125
|
/**
|
|
129
126
|
* Interface representing Feature Options.
|
|
@@ -228,6 +225,11 @@ export interface SessionLogEvent {
|
|
|
228
225
|
*/
|
|
229
226
|
logType: string;
|
|
230
227
|
}
|
|
228
|
+
export interface ReclaimSessionIdentityUpdate {
|
|
229
|
+
appId: string;
|
|
230
|
+
providerId: string;
|
|
231
|
+
sessionId: string;
|
|
232
|
+
}
|
|
231
233
|
export interface SessionCreateRequestEvent {
|
|
232
234
|
/**
|
|
233
235
|
* The app ID for the verification attempt
|
|
@@ -266,17 +268,49 @@ export interface Overrides {
|
|
|
266
268
|
logConsumer?: LogConsumer | null;
|
|
267
269
|
sessionManagement?: SessionManagement | null;
|
|
268
270
|
appInfo?: ReclaimAppInfo | null;
|
|
271
|
+
capabilityAccessToken?: string | null;
|
|
272
|
+
}
|
|
273
|
+
export interface ProviderInformationRequest {
|
|
274
|
+
appId: string;
|
|
275
|
+
providerId: string;
|
|
276
|
+
sessionId: string;
|
|
277
|
+
signature: string;
|
|
278
|
+
timestamp: string;
|
|
279
|
+
/**
|
|
280
|
+
* internal
|
|
281
|
+
*/
|
|
282
|
+
readonly replyId: string;
|
|
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;
|
|
269
297
|
}
|
|
270
298
|
export interface Spec extends TurboModule {
|
|
271
299
|
startVerification(request: Request): Promise<Response>;
|
|
272
300
|
startVerificationFromUrl(requestUrl: string): Promise<Response>;
|
|
273
301
|
setOverrides(overrides: Overrides): Promise<void>;
|
|
302
|
+
clearAllOverrides(): Promise<void>;
|
|
303
|
+
setVerificationOptions(args: VerificationOptionsOptional): Promise<void>;
|
|
274
304
|
reply(replyId: string, reply: boolean): void;
|
|
305
|
+
replyWithString(replyId: string, value: string): void;
|
|
275
306
|
ping(): Promise<boolean>;
|
|
276
307
|
readonly onLogs: EventEmitter<string>;
|
|
277
308
|
readonly onSessionLogs: EventEmitter<SessionLogEvent>;
|
|
278
309
|
readonly onSessionCreateRequest: EventEmitter<SessionCreateRequestEvent>;
|
|
279
310
|
readonly onSessionUpdateRequest: EventEmitter<SessionUpdateRequestEvent>;
|
|
311
|
+
readonly onProviderInformationRequest: EventEmitter<ProviderInformationRequest>;
|
|
312
|
+
readonly onReclaimAttestorAuthRequest: EventEmitter<ReclaimAttestorAuthRequest>;
|
|
313
|
+
readonly onSessionIdentityUpdate: EventEmitter<ReclaimSessionIdentityUpdate>;
|
|
280
314
|
}
|
|
281
315
|
declare const _default: Spec;
|
|
282
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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AE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtD,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../../../../src/types/proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,6BAA6B,MAAM,6BAA6B,CAAC;AAE7E,MAAM,WAAW,2BAA4B,SAAQ,6BAA6B,CAAC,QAAQ;IACvF,MAAM,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC;CACjC;AAED,yBAAiB,aAAa,CAAC;IAC3B,UAAiB,KAAK;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB;;;WAGG;QACH,UAAU,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;QACxB,SAAS,EAAE,WAAW,EAAE,CAAC;QACzB,SAAS,EAAE,iBAAiB,CAAC;KAChC;IAEM,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../../../../src/types/proof.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,6BAA6B,MAAM,6BAA6B,CAAC;AAE7E,MAAM,WAAW,2BAA4B,SAAQ,6BAA6B,CAAC,QAAQ;IACvF,MAAM,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC;CACjC;AAED,yBAAiB,aAAa,CAAC;IAC3B,UAAiB,KAAK;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB;;;WAGG;QACH,UAAU,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;QACxB,SAAS,EAAE,WAAW,EAAE,CAAC;QACzB,SAAS,EAAE,iBAAiB,CAAC;KAChC;IAEM,MAAM,OAAO,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,KAAK,IAAI,KAE7D,CAAA;IAEM,MAAM,QAAQ,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAG,KAAK,EAE7D,CAAA;IAED,UAAiB,iBAAiB;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QAEjB,UAAU,EAAE,MAAM,CAAC;QAEnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACtB;IAED,UAAiB,WAAW;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;KACf;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/inapp-rn-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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",
|
|
@@ -27,8 +27,17 @@ export namespace ReclaimVerificationApi {
|
|
|
27
27
|
*/
|
|
28
28
|
export type Response = ReclaimVerificationResponse;
|
|
29
29
|
|
|
30
|
+
export interface VerificationOptions {
|
|
31
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
32
|
+
fetchAttestorAuthenticationRequest: (reclaimHttpProviderJsonString: string) => Promise<string>;
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
export namespace Overrides {
|
|
31
|
-
export
|
|
36
|
+
export interface ProviderInformation {
|
|
37
|
+
url?: string;
|
|
38
|
+
jsonString?: string;
|
|
39
|
+
callback?: (request: NativeReclaimInappModuleTypes.ProviderInformationRequest) => Promise<string>;
|
|
40
|
+
}
|
|
32
41
|
export type FeatureOptions = NativeReclaimInappModuleTypes.FeatureOptions;
|
|
33
42
|
export interface LogConsumer {
|
|
34
43
|
/**
|
|
@@ -61,7 +70,8 @@ export namespace ReclaimVerificationApi {
|
|
|
61
70
|
featureOptions?: Overrides.FeatureOptions,
|
|
62
71
|
logConsumer?: Overrides.LogConsumer,
|
|
63
72
|
sessionManagement?: Overrides.SessionManagement,
|
|
64
|
-
appInfo?: Overrides.ReclaimAppInfo
|
|
73
|
+
appInfo?: Overrides.ReclaimAppInfo,
|
|
74
|
+
capabilityAccessToken?: string | null,
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
export enum ExceptionType {
|
|
@@ -71,6 +81,29 @@ export namespace ReclaimVerificationApi {
|
|
|
71
81
|
Failed = "Failed",
|
|
72
82
|
}
|
|
73
83
|
|
|
84
|
+
export class ReclaimPlatformException extends Error {
|
|
85
|
+
readonly innerError: Error
|
|
86
|
+
readonly reason?: string
|
|
87
|
+
readonly details?: any
|
|
88
|
+
|
|
89
|
+
constructor(message: string, innerError: Error) {
|
|
90
|
+
super(message);
|
|
91
|
+
this.innerError = innerError;
|
|
92
|
+
this.reason = innerError.message;
|
|
93
|
+
if ('userInfo' in innerError) {
|
|
94
|
+
const details: any = innerError.userInfo
|
|
95
|
+
this.details = details
|
|
96
|
+
if ('message' in details) {
|
|
97
|
+
this.reason = details.message || this.reason
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static isReclaimPlatformException(error: Error): error is ReclaimPlatformException {
|
|
103
|
+
return error instanceof ReclaimPlatformException
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
74
107
|
export class ReclaimVerificationException extends Error {
|
|
75
108
|
readonly innerError: Error
|
|
76
109
|
readonly type: ExceptionType
|
|
@@ -113,21 +146,20 @@ export namespace ReclaimVerificationApi {
|
|
|
113
146
|
}
|
|
114
147
|
|
|
115
148
|
static fromError(error: Error, sessionIdHint: string): ReclaimVerificationException {
|
|
116
|
-
if (
|
|
149
|
+
if ('userInfo' in error) {
|
|
117
150
|
// From native, we send information about error in userInfo
|
|
118
|
-
let
|
|
119
|
-
let userInfo = unTypedError.userInfo;
|
|
151
|
+
let userInfo = error.userInfo as any;
|
|
120
152
|
if (userInfo) {
|
|
121
|
-
let type = ReclaimVerificationApi.ReclaimVerificationException.fromTypeName(
|
|
122
|
-
let maybeSessionId =
|
|
153
|
+
let type = ReclaimVerificationApi.ReclaimVerificationException.fromTypeName(userInfo.errorType);
|
|
154
|
+
let maybeSessionId = userInfo?.sessionId
|
|
123
155
|
return new ReclaimVerificationException(
|
|
124
156
|
error.message,
|
|
125
157
|
error,
|
|
126
158
|
type,
|
|
127
159
|
(typeof maybeSessionId === 'string' && maybeSessionId)
|
|
128
160
|
? maybeSessionId : sessionIdHint,
|
|
129
|
-
|
|
130
|
-
|
|
161
|
+
userInfo?.didSubmitManualVerification ?? false,
|
|
162
|
+
userInfo?.reason ?? ""
|
|
131
163
|
);
|
|
132
164
|
}
|
|
133
165
|
}
|
|
@@ -140,11 +172,29 @@ export namespace ReclaimVerificationApi {
|
|
|
140
172
|
""
|
|
141
173
|
);
|
|
142
174
|
}
|
|
175
|
+
|
|
176
|
+
static isReclaimVerificationException(error: Error): error is ReclaimVerificationException {
|
|
177
|
+
return error instanceof ReclaimVerificationException
|
|
178
|
+
}
|
|
143
179
|
}
|
|
144
180
|
}
|
|
145
181
|
|
|
146
|
-
export class ReclaimVerificationPlatformChannel {
|
|
147
|
-
|
|
182
|
+
export abstract class ReclaimVerificationPlatformChannel {
|
|
183
|
+
abstract startVerification(request: ReclaimVerificationApi.Request): Promise<ReclaimVerificationApi.Response>
|
|
184
|
+
|
|
185
|
+
abstract startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerificationApi.Response>
|
|
186
|
+
|
|
187
|
+
abstract ping(): Promise<boolean>
|
|
188
|
+
|
|
189
|
+
abstract setOverrides(config: ReclaimVerificationApi.OverrideConfig): Promise<void>
|
|
190
|
+
|
|
191
|
+
abstract clearAllOverrides(): Promise<void>
|
|
192
|
+
|
|
193
|
+
abstract setVerificationOptions(options?: ReclaimVerificationApi.VerificationOptions | null): Promise<void>
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export class ReclaimVerificationPlatformChannelImpl extends ReclaimVerificationPlatformChannel {
|
|
197
|
+
override async startVerification(request: ReclaimVerificationApi.Request): Promise<ReclaimVerificationApi.Response> {
|
|
148
198
|
try {
|
|
149
199
|
const response = await NativeReclaimInappModule.startVerification(request);
|
|
150
200
|
return {
|
|
@@ -162,7 +212,7 @@ export class ReclaimVerificationPlatformChannel {
|
|
|
162
212
|
}
|
|
163
213
|
}
|
|
164
214
|
|
|
165
|
-
async startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerificationApi.Response> {
|
|
215
|
+
override async startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerificationApi.Response> {
|
|
166
216
|
try {
|
|
167
217
|
const response = await NativeReclaimInappModule.startVerificationFromUrl(requestUrl);
|
|
168
218
|
return {
|
|
@@ -180,35 +230,73 @@ export class ReclaimVerificationPlatformChannel {
|
|
|
180
230
|
}
|
|
181
231
|
}
|
|
182
232
|
|
|
183
|
-
async ping(): Promise<boolean> {
|
|
233
|
+
override async ping(): Promise<boolean> {
|
|
184
234
|
return await NativeReclaimInappModule.ping();
|
|
185
235
|
}
|
|
186
236
|
|
|
187
|
-
private previousLogSubscription: EventSubscription | null = null;
|
|
188
237
|
private previousSessionManagementCancelCallback: null | (() => void) = null;
|
|
238
|
+
disposeSessionManagement() {
|
|
239
|
+
let callback = this.previousSessionManagementCancelCallback;
|
|
240
|
+
if (callback != null && callback != undefined) {
|
|
241
|
+
callback();
|
|
242
|
+
}
|
|
243
|
+
this.previousSessionManagementCancelCallback = null;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private previousLogSubscription: EventSubscription | null = null;
|
|
247
|
+
disposeLogListener() {
|
|
248
|
+
this.previousLogSubscription?.remove()
|
|
249
|
+
this.previousLogSubscription = null;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
private previousProviderRequestCancelCallback: null | (() => void) = null;
|
|
253
|
+
private disposeProviderRequestListener() {
|
|
254
|
+
let callback = this.previousProviderRequestCancelCallback;
|
|
255
|
+
if (callback != null && callback != undefined) {
|
|
256
|
+
callback();
|
|
257
|
+
}
|
|
258
|
+
this.previousProviderRequestCancelCallback = null;
|
|
259
|
+
}
|
|
189
260
|
|
|
190
|
-
setOverrides({
|
|
261
|
+
override async setOverrides({
|
|
191
262
|
provider,
|
|
192
263
|
featureOptions,
|
|
193
264
|
logConsumer,
|
|
194
265
|
sessionManagement,
|
|
195
|
-
appInfo
|
|
266
|
+
appInfo,
|
|
267
|
+
capabilityAccessToken
|
|
196
268
|
}: ReclaimVerificationApi.OverrideConfig) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
269
|
+
let providerCallback = provider?.callback;
|
|
270
|
+
let providerOverride = !provider ? null : {
|
|
271
|
+
url: provider?.url,
|
|
272
|
+
jsonString: provider?.jsonString,
|
|
273
|
+
canFetchProviderInformationFromHost: !!providerCallback,
|
|
274
|
+
}
|
|
275
|
+
if (providerCallback) {
|
|
276
|
+
this.disposeProviderRequestListener();
|
|
277
|
+
let providerRequestSubscription = NativeReclaimInappModule.onProviderInformationRequest(async (event) => {
|
|
278
|
+
try {
|
|
279
|
+
let result = await providerCallback(event);
|
|
280
|
+
NativeReclaimInappModule.replyWithString(event.replyId, result);
|
|
281
|
+
} catch (error) {
|
|
282
|
+
console.error(error);
|
|
283
|
+
NativeReclaimInappModule.replyWithString(event.replyId, "");
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
const cancel = () => {
|
|
287
|
+
providerRequestSubscription.remove();
|
|
288
|
+
}
|
|
289
|
+
this.previousProviderRequestCancelCallback = cancel;
|
|
202
290
|
}
|
|
203
|
-
this.previousSessionManagementCancelCallback = null;
|
|
204
291
|
|
|
205
|
-
|
|
206
|
-
|
|
292
|
+
const onLogsListener = logConsumer?.onLogs;
|
|
293
|
+
let logConsumerRequest = !logConsumer ? undefined : {
|
|
294
|
+
enableLogHandler: !!onLogsListener,
|
|
207
295
|
canSdkCollectTelemetry: logConsumer?.canSdkCollectTelemetry,
|
|
208
296
|
canSdkPrintLogs: logConsumer?.canSdkPrintLogs
|
|
209
297
|
}
|
|
210
|
-
|
|
211
|
-
|
|
298
|
+
if (onLogsListener) {
|
|
299
|
+
this.disposeLogListener();
|
|
212
300
|
const cancel = () => {
|
|
213
301
|
this.previousLogSubscription?.remove();
|
|
214
302
|
this.previousLogSubscription = null;
|
|
@@ -218,23 +306,38 @@ export class ReclaimVerificationPlatformChannel {
|
|
|
218
306
|
})
|
|
219
307
|
}
|
|
220
308
|
|
|
221
|
-
let sessionManagementRequest = sessionManagement
|
|
309
|
+
let sessionManagementRequest = !sessionManagement ? undefined : {
|
|
222
310
|
// A handler is provided, so we don't let SDK manage sessions
|
|
223
311
|
enableSdkSessionManagement: false
|
|
224
312
|
}
|
|
225
|
-
if (sessionManagement
|
|
313
|
+
if (sessionManagement) {
|
|
314
|
+
this.disposeSessionManagement();
|
|
226
315
|
let sessionCreateSubscription = NativeReclaimInappModule.onSessionCreateRequest(async (event) => {
|
|
227
316
|
const replyId = event.replyId;
|
|
228
|
-
|
|
229
|
-
|
|
317
|
+
try {
|
|
318
|
+
let result = await sessionManagement.onSessionCreateRequest(event);
|
|
319
|
+
NativeReclaimInappModule.reply(replyId, result);
|
|
320
|
+
} catch (error) {
|
|
321
|
+
console.error(error);
|
|
322
|
+
NativeReclaimInappModule.reply(replyId, false);
|
|
323
|
+
}
|
|
230
324
|
});
|
|
231
325
|
let sessionUpdateSubscription = NativeReclaimInappModule.onSessionUpdateRequest(async (event) => {
|
|
232
326
|
const replyId = event.replyId;
|
|
233
|
-
|
|
234
|
-
|
|
327
|
+
try {
|
|
328
|
+
let result = await sessionManagement.onSessionUpdateRequest(event);
|
|
329
|
+
NativeReclaimInappModule.reply(replyId, result);
|
|
330
|
+
} catch (error) {
|
|
331
|
+
console.error(error);
|
|
332
|
+
NativeReclaimInappModule.reply(replyId, false);
|
|
333
|
+
}
|
|
235
334
|
});
|
|
236
335
|
let sessionLogsSubscription = NativeReclaimInappModule.onSessionLogs((event) => {
|
|
237
|
-
|
|
336
|
+
try {
|
|
337
|
+
sessionManagement.onLog(event);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error(error);
|
|
340
|
+
}
|
|
238
341
|
});
|
|
239
342
|
const cancel = () => {
|
|
240
343
|
sessionCreateSubscription.remove()
|
|
@@ -244,12 +347,62 @@ export class ReclaimVerificationPlatformChannel {
|
|
|
244
347
|
this.previousSessionManagementCancelCallback = cancel;
|
|
245
348
|
}
|
|
246
349
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
350
|
+
try {
|
|
351
|
+
return await NativeReclaimInappModule.setOverrides({
|
|
352
|
+
provider: providerOverride,
|
|
353
|
+
featureOptions,
|
|
354
|
+
logConsumer: logConsumerRequest,
|
|
355
|
+
sessionManagement: sessionManagementRequest,
|
|
356
|
+
appInfo,
|
|
357
|
+
capabilityAccessToken
|
|
358
|
+
});
|
|
359
|
+
} catch (error) {
|
|
360
|
+
throw new ReclaimVerificationApi.ReclaimPlatformException("Failed to set overrides", error as Error);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
override async clearAllOverrides() {
|
|
365
|
+
this.disposeProviderRequestListener();
|
|
366
|
+
this.disposeLogListener();
|
|
367
|
+
this.disposeSessionManagement();
|
|
368
|
+
return NativeReclaimInappModule.clearAllOverrides();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
private previousAttestorAuthRequestCancelCallback: null | (() => void) = null;
|
|
372
|
+
disposeAttestorAuthRequestListener() {
|
|
373
|
+
let callback = this.previousAttestorAuthRequestCancelCallback;
|
|
374
|
+
if (callback != null && callback != undefined) {
|
|
375
|
+
callback();
|
|
376
|
+
}
|
|
377
|
+
this.previousAttestorAuthRequestCancelCallback = null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
override async setVerificationOptions(options?: ReclaimVerificationApi.VerificationOptions | null): Promise<void> {
|
|
381
|
+
let args: NativeReclaimInappModuleTypes.VerificationOptions | null = null
|
|
382
|
+
if (options) {
|
|
383
|
+
let canUseAttestorAuthenticationRequest = options.fetchAttestorAuthenticationRequest != null
|
|
384
|
+
args = {
|
|
385
|
+
canDeleteCookiesBeforeVerificationStarts: options.canDeleteCookiesBeforeVerificationStarts,
|
|
386
|
+
canUseAttestorAuthenticationRequest: canUseAttestorAuthenticationRequest,
|
|
387
|
+
}
|
|
388
|
+
if (canUseAttestorAuthenticationRequest) {
|
|
389
|
+
this.disposeAttestorAuthRequestListener();
|
|
390
|
+
let attestorAuthRequestSubscription = NativeReclaimInappModule.onReclaimAttestorAuthRequest(async (event) => {
|
|
391
|
+
let result = await options.fetchAttestorAuthenticationRequest(event.reclaimHttpProviderJsonString);
|
|
392
|
+
NativeReclaimInappModule.replyWithString(event.replyId, result);
|
|
393
|
+
});
|
|
394
|
+
const cancel = () => {
|
|
395
|
+
attestorAuthRequestSubscription.remove();
|
|
396
|
+
}
|
|
397
|
+
this.previousAttestorAuthRequestCancelCallback = cancel;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
try {
|
|
401
|
+
return await NativeReclaimInappModule.setVerificationOptions({
|
|
402
|
+
options: args
|
|
403
|
+
});
|
|
404
|
+
} catch (error) {
|
|
405
|
+
throw new ReclaimVerificationApi.ReclaimPlatformException("Failed to set verification options", error as Error);
|
|
406
|
+
}
|
|
254
407
|
}
|
|
255
|
-
}
|
|
408
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReclaimVerificationPlatformChannel,
|
|
2
|
-
export { ReclaimVerificationPlatformChannel, ReclaimVerificationApi } from './ReclaimVerificationPlatformChannel';
|
|
1
|
+
import { type ReclaimVerificationApi, ReclaimVerificationPlatformChannel, ReclaimVerificationPlatformChannelImpl } from './ReclaimVerificationPlatformChannel';
|
|
2
|
+
export { ReclaimVerificationPlatformChannel, ReclaimVerificationApi, ReclaimVerificationPlatformChannelImpl } from './ReclaimVerificationPlatformChannel';
|
|
3
3
|
export type { ReclaimVerificationApi as ReclaimVerificationApiType, ReclaimResult } from './ReclaimVerificationPlatformChannel';
|
|
4
4
|
|
|
5
5
|
export class ReclaimVerification {
|
|
@@ -12,7 +12,7 @@ export class ReclaimVerification {
|
|
|
12
12
|
this.channel = channel;
|
|
13
13
|
} else {
|
|
14
14
|
if (ReclaimVerification.defaultChannel == null) {
|
|
15
|
-
ReclaimVerification.defaultChannel = new
|
|
15
|
+
ReclaimVerification.defaultChannel = new ReclaimVerificationPlatformChannelImpl();
|
|
16
16
|
}
|
|
17
17
|
this.channel = ReclaimVerification.defaultChannel;
|
|
18
18
|
}
|
|
@@ -27,6 +27,14 @@ export class ReclaimVerification {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
public setOverrides(overrides: ReclaimVerificationApi.OverrideConfig) {
|
|
30
|
-
this.channel.setOverrides(overrides);
|
|
30
|
+
return this.channel.setOverrides(overrides);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public clearAllOverrides() {
|
|
34
|
+
return this.channel.clearAllOverrides();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public setVerificationOptions(options?: ReclaimVerificationApi.VerificationOptions | null) {
|
|
38
|
+
return this.channel.setVerificationOptions(options);
|
|
31
39
|
}
|
|
32
40
|
}
|