@reclaimprotocol/inapp-rn-sdk 0.3.0 → 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/README.md +1 -0
- package/lib/commonjs/index.js +124 -31
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/{ReclaimVerificationPlatformChannel.js → platform.js} +11 -105
- package/lib/commonjs/platform.js.map +1 -0
- package/lib/module/index.js +125 -14
- package/lib/module/index.js.map +1 -1
- package/lib/module/{ReclaimVerificationPlatformChannel.js → platform.js} +9 -102
- package/lib/module/platform.js.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +140 -9
- 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/module/src/index.d.ts +140 -9
- 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/package.json +2 -1
- package/src/index.ts +258 -20
- package/src/platform.ts +218 -0
- 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 -115
- 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 -115
- 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 -408
- package/src/types/proof.ts +0 -44
|
@@ -1,114 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import NativeReclaimInappModule from "./specs/NativeInappRnSdk.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
* This namespace provides types involved in initiating and managing the verification process
|
|
7
|
-
* for proving claims about user data through various providers.
|
|
8
|
-
*/
|
|
9
|
-
export let ReclaimVerificationApi;
|
|
10
|
-
(function (_ReclaimVerificationApi) {
|
|
11
|
-
/**
|
|
12
|
-
* Represents user's session information for a verification attempt.
|
|
13
|
-
* This data class contains the necessary data to identify and validate a verification session.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Represents a request for a verification attempt.
|
|
17
|
-
*
|
|
18
|
-
* You can create a request using the [ReclaimVerification.Request] constructor or the [ReclaimVerification.Request.fromManifestMetaData] factory method.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Contains the proof and response data after verification
|
|
22
|
-
*/
|
|
23
|
-
let Overrides;
|
|
24
|
-
(function (_Overrides) {
|
|
25
|
-
;
|
|
26
|
-
})(Overrides || (Overrides = _ReclaimVerificationApi.Overrides || (_ReclaimVerificationApi.Overrides = {})));
|
|
27
|
-
let ExceptionType = /*#__PURE__*/function (ExceptionType) {
|
|
28
|
-
ExceptionType["Cancelled"] = "Cancelled";
|
|
29
|
-
ExceptionType["Dismissed"] = "Dismissed";
|
|
30
|
-
ExceptionType["SessionExpired"] = "SessionExpired";
|
|
31
|
-
ExceptionType["Failed"] = "Failed";
|
|
32
|
-
return ExceptionType;
|
|
33
|
-
}({});
|
|
34
|
-
_ReclaimVerificationApi.ExceptionType = ExceptionType;
|
|
35
|
-
class ReclaimPlatformException extends Error {
|
|
36
|
-
constructor(message, innerError) {
|
|
37
|
-
super(message);
|
|
38
|
-
this.innerError = innerError;
|
|
39
|
-
this.reason = innerError.message;
|
|
40
|
-
if ('userInfo' in innerError) {
|
|
41
|
-
const details = innerError.userInfo;
|
|
42
|
-
this.details = details;
|
|
43
|
-
if ('message' in details) {
|
|
44
|
-
this.reason = details.message || this.reason;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
static isReclaimPlatformException(error) {
|
|
49
|
-
return error instanceof ReclaimPlatformException;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
_ReclaimVerificationApi.ReclaimPlatformException = ReclaimPlatformException;
|
|
53
|
-
class ReclaimVerificationException extends Error {
|
|
54
|
-
constructor(message, innerError, type, sessionId, didSubmitManualVerification, reason) {
|
|
55
|
-
super(message);
|
|
56
|
-
this.innerError = innerError;
|
|
57
|
-
this.type = type;
|
|
58
|
-
this.sessionId = sessionId;
|
|
59
|
-
this.didSubmitManualVerification = didSubmitManualVerification;
|
|
60
|
-
this.reason = reason;
|
|
61
|
-
}
|
|
62
|
-
static fromTypeName(name) {
|
|
63
|
-
switch (name) {
|
|
64
|
-
case "cancelled":
|
|
65
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Cancelled":
|
|
66
|
-
return ExceptionType.Cancelled;
|
|
67
|
-
case "dismissed":
|
|
68
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Dismissed":
|
|
69
|
-
return ExceptionType.Dismissed;
|
|
70
|
-
case "sessionExpired":
|
|
71
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.SessionExpired":
|
|
72
|
-
return ExceptionType.SessionExpired;
|
|
73
|
-
case "failed":
|
|
74
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Failed":
|
|
75
|
-
return ExceptionType.Failed;
|
|
76
|
-
}
|
|
77
|
-
return ExceptionType.Failed;
|
|
78
|
-
}
|
|
79
|
-
static fromError(error, sessionIdHint) {
|
|
80
|
-
if ('userInfo' in error) {
|
|
81
|
-
// From native, we send information about error in userInfo
|
|
82
|
-
let userInfo = error.userInfo;
|
|
83
|
-
if (userInfo) {
|
|
84
|
-
let type = ReclaimVerificationApi.ReclaimVerificationException.fromTypeName(userInfo.errorType);
|
|
85
|
-
let maybeSessionId = userInfo?.sessionId;
|
|
86
|
-
return new ReclaimVerificationException(error.message, error, type, typeof maybeSessionId === 'string' && maybeSessionId ? maybeSessionId : sessionIdHint, userInfo?.didSubmitManualVerification ?? false, userInfo?.reason ?? "");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return new ReclaimVerificationException(error.message, error, ReclaimVerificationApi.ExceptionType.Failed, sessionIdHint, false, "");
|
|
90
|
-
}
|
|
91
|
-
static isReclaimVerificationException(error) {
|
|
92
|
-
return error instanceof ReclaimVerificationException;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
_ReclaimVerificationApi.ReclaimVerificationException = ReclaimVerificationException;
|
|
96
|
-
})(ReclaimVerificationApi || (ReclaimVerificationApi = {}));
|
|
97
|
-
export class ReclaimVerificationPlatformChannel {}
|
|
98
|
-
export class ReclaimVerificationPlatformChannelImpl extends ReclaimVerificationPlatformChannel {
|
|
4
|
+
import { ReclaimVerification } from "./index.js";
|
|
5
|
+
export class PlatformImpl extends ReclaimVerification.Platform {
|
|
99
6
|
async startVerification(request) {
|
|
100
7
|
try {
|
|
101
8
|
const response = await NativeReclaimInappModule.startVerification(request);
|
|
102
9
|
return {
|
|
103
10
|
...response,
|
|
104
|
-
proofs: ReclaimResult.asProofs(response.proofs)
|
|
11
|
+
proofs: ReclaimVerification.ReclaimResult.asProofs(response.proofs)
|
|
105
12
|
};
|
|
106
13
|
} catch (error) {
|
|
107
14
|
console.info({
|
|
108
15
|
error
|
|
109
16
|
});
|
|
110
17
|
if (error instanceof Error) {
|
|
111
|
-
throw
|
|
18
|
+
throw ReclaimVerification.ReclaimVerificationException.fromError(error, request.session?.sessionId ?? "");
|
|
112
19
|
}
|
|
113
20
|
throw error;
|
|
114
21
|
}
|
|
@@ -118,14 +25,14 @@ export class ReclaimVerificationPlatformChannelImpl extends ReclaimVerificationP
|
|
|
118
25
|
const response = await NativeReclaimInappModule.startVerificationFromUrl(requestUrl);
|
|
119
26
|
return {
|
|
120
27
|
...response,
|
|
121
|
-
proofs: ReclaimResult.asProofs(response.proofs)
|
|
28
|
+
proofs: ReclaimVerification.ReclaimResult.asProofs(response.proofs)
|
|
122
29
|
};
|
|
123
30
|
} catch (error) {
|
|
124
31
|
console.info({
|
|
125
32
|
error
|
|
126
33
|
});
|
|
127
34
|
if (error instanceof Error) {
|
|
128
|
-
throw
|
|
35
|
+
throw ReclaimVerification.ReclaimVerificationException.fromError(error, "");
|
|
129
36
|
}
|
|
130
37
|
throw error;
|
|
131
38
|
}
|
|
@@ -250,7 +157,7 @@ export class ReclaimVerificationPlatformChannelImpl extends ReclaimVerificationP
|
|
|
250
157
|
capabilityAccessToken
|
|
251
158
|
});
|
|
252
159
|
} catch (error) {
|
|
253
|
-
throw new
|
|
160
|
+
throw new ReclaimVerification.ReclaimPlatformException("Failed to set overrides", error);
|
|
254
161
|
}
|
|
255
162
|
}
|
|
256
163
|
async clearAllOverrides() {
|
|
@@ -292,8 +199,8 @@ export class ReclaimVerificationPlatformChannelImpl extends ReclaimVerificationP
|
|
|
292
199
|
options: args
|
|
293
200
|
});
|
|
294
201
|
} catch (error) {
|
|
295
|
-
throw new
|
|
202
|
+
throw new ReclaimVerification.ReclaimPlatformException("Failed to set verification options", error);
|
|
296
203
|
}
|
|
297
204
|
}
|
|
298
205
|
}
|
|
299
|
-
//# sourceMappingURL=
|
|
206
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeReclaimInappModule","ReclaimVerification","PlatformImpl","Platform","startVerification","request","response","proofs","ReclaimResult","asProofs","error","console","info","Error","ReclaimVerificationException","fromError","session","sessionId","startVerificationFromUrl","requestUrl","ping","previousSessionManagementCancelCallback","disposeSessionManagement","callback","undefined","previousLogSubscription","disposeLogListener","remove","previousProviderRequestCancelCallback","disposeProviderRequestListener","setOverrides","provider","featureOptions","logConsumer","sessionManagement","appInfo","capabilityAccessToken","providerCallback","providerOverride","url","jsonString","canFetchProviderInformationFromHost","providerRequestSubscription","onProviderInformationRequest","event","result","replyWithString","replyId","cancel","onLogsListener","onLogs","logConsumerRequest","enableLogHandler","canSdkCollectTelemetry","canSdkPrintLogs","arg","sessionManagementRequest","enableSdkSessionManagement","sessionCreateSubscription","onSessionCreateRequest","reply","sessionUpdateSubscription","onSessionUpdateRequest","sessionLogsSubscription","onSessionLogs","onLog","ReclaimPlatformException","clearAllOverrides","previousAttestorAuthRequestCancelCallback","disposeAttestorAuthRequestListener","setVerificationOptions","options","args","canUseAttestorAuthenticationRequest","fetchAttestorAuthenticationRequest","canDeleteCookiesBeforeVerificationStarts","attestorAuthRequestSubscription","onReclaimAttestorAuthRequest","reclaimHttpProviderJsonString"],"sourceRoot":"../../src","sources":["platform.ts"],"mappings":";;AACA,OAAOA,wBAAwB,MAAM,6BAA0B;AAE/D,SAASC,mBAAmB,QAAQ,YAAS;AAE7C,OAAO,MAAMC,YAAY,SAASD,mBAAmB,CAACE,QAAQ,CAAC;EAC3D,MAAeC,iBAAiBA,CAACC,OAAoC,EAAyC;IAC1G,IAAI;MACA,MAAMC,QAAQ,GAAG,MAAMN,wBAAwB,CAACI,iBAAiB,CAACC,OAAO,CAAC;MAC1E,OAAO;QACH,GAAGC,QAAQ;QACXC,MAAM,EAAEN,mBAAmB,CAACO,aAAa,CAACC,QAAQ,CAACH,QAAQ,CAACC,MAAM;MACtE,CAAC;IACL,CAAC,CAAC,OAAOG,KAAK,EAAE;MACZC,OAAO,CAACC,IAAI,CAAC;QACTF;MACJ,CAAC,CAAC;MACF,IAAIA,KAAK,YAAYG,KAAK,EAAE;QACxB,MAAMZ,mBAAmB,CAACa,4BAA4B,CAACC,SAAS,CAACL,KAAK,EAAEL,OAAO,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ACJ","ignoreList":[]}
|
|
@@ -1,14 +1,145 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as NativeReclaimInappModuleTypes from "./specs/NativeInappRnSdk";
|
|
2
|
+
/**
|
|
3
|
+
* [ReclaimVerification] is the main class for interacting with the Reclaim verification system.
|
|
4
|
+
* It provides methods to start verification processes, manage platform configurations,
|
|
5
|
+
* and handle verification options.
|
|
6
|
+
*
|
|
7
|
+
* The class can be instantiated with a custom platform implementation, or will use
|
|
8
|
+
* the default [PlatformImpl] if none is provided.
|
|
9
|
+
*/
|
|
4
10
|
export declare class ReclaimVerification {
|
|
5
|
-
|
|
6
|
-
private static
|
|
7
|
-
constructor(
|
|
8
|
-
startVerification(request:
|
|
11
|
+
platform: ReclaimVerification.Platform;
|
|
12
|
+
private static defaultPlatform;
|
|
13
|
+
constructor(platform?: ReclaimVerification.Platform);
|
|
14
|
+
startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response>;
|
|
9
15
|
ping(): Promise<boolean>;
|
|
10
|
-
setOverrides(overrides:
|
|
16
|
+
setOverrides(overrides: ReclaimVerification.OverrideConfig): Promise<void>;
|
|
11
17
|
clearAllOverrides(): Promise<void>;
|
|
12
|
-
setVerificationOptions(options?:
|
|
18
|
+
setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This namespace provides types involved in initiating and managing the verification process
|
|
22
|
+
* for proving claims about user data through various providers.
|
|
23
|
+
*/
|
|
24
|
+
export declare namespace ReclaimVerification {
|
|
25
|
+
/**
|
|
26
|
+
* Represents user's session information for a verification attempt.
|
|
27
|
+
* This data class contains the necessary data to identify and validate a verification session.
|
|
28
|
+
*/
|
|
29
|
+
type SessionInformation = NativeReclaimInappModuleTypes.SessionInformation;
|
|
30
|
+
/**
|
|
31
|
+
* Represents a request for a verification attempt.
|
|
32
|
+
*
|
|
33
|
+
* You can create a request using the [ReclaimVerification.Request] constructor or the [ReclaimVerification.Request.fromManifestMetaData] factory method.
|
|
34
|
+
*/
|
|
35
|
+
type Request = NativeReclaimInappModuleTypes.Request;
|
|
36
|
+
/**
|
|
37
|
+
* Contains the proof and response data after verification
|
|
38
|
+
*/
|
|
39
|
+
interface Response extends NativeReclaimInappModuleTypes.Response {
|
|
40
|
+
proofs: ReclaimResult.Proof[];
|
|
41
|
+
}
|
|
42
|
+
namespace ReclaimResult {
|
|
43
|
+
interface Proof {
|
|
44
|
+
identifier: string;
|
|
45
|
+
signatures: string[];
|
|
46
|
+
/**
|
|
47
|
+
* A data associated with this [Proof].
|
|
48
|
+
* The data type of this object is dynamic and can be any JSON serializable Javascript object.
|
|
49
|
+
*/
|
|
50
|
+
publicData?: any | null;
|
|
51
|
+
witnesses: WitnessData[];
|
|
52
|
+
claimData: ProviderClaimData;
|
|
53
|
+
}
|
|
54
|
+
const isProof: (value: Record<string, any>) => value is Proof;
|
|
55
|
+
const asProofs: (proofs: Record<string, any>[]) => Proof[];
|
|
56
|
+
interface ProviderClaimData {
|
|
57
|
+
owner: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
timestampS: number;
|
|
60
|
+
epoch: number;
|
|
61
|
+
context: string;
|
|
62
|
+
identifier: string;
|
|
63
|
+
parameters: string;
|
|
64
|
+
}
|
|
65
|
+
interface WitnessData {
|
|
66
|
+
id: string;
|
|
67
|
+
url: string;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
interface VerificationOptions {
|
|
71
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
72
|
+
fetchAttestorAuthenticationRequest: (reclaimHttpProviderJsonString: string) => Promise<string>;
|
|
73
|
+
}
|
|
74
|
+
namespace Overrides {
|
|
75
|
+
interface ProviderInformation {
|
|
76
|
+
url?: string;
|
|
77
|
+
jsonString?: string;
|
|
78
|
+
callback?: (request: NativeReclaimInappModuleTypes.ProviderInformationRequest) => Promise<string>;
|
|
79
|
+
}
|
|
80
|
+
type FeatureOptions = NativeReclaimInappModuleTypes.FeatureOptions;
|
|
81
|
+
interface LogConsumer {
|
|
82
|
+
/**
|
|
83
|
+
* Handler for consuming logs exported from the SDK.
|
|
84
|
+
* Defaults to false.
|
|
85
|
+
*/
|
|
86
|
+
onLogs?: (logJsonString: String, cancel: () => void) => void;
|
|
87
|
+
/**
|
|
88
|
+
* When enabled, logs are sent to reclaim that can be used to help you.
|
|
89
|
+
* Defaults to true.
|
|
90
|
+
*/
|
|
91
|
+
canSdkCollectTelemetry?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Defaults to enabled when not in release mode.
|
|
94
|
+
*/
|
|
95
|
+
canSdkPrintLogs?: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface SessionManagement {
|
|
98
|
+
onLog: (event: NativeReclaimInappModuleTypes.SessionLogEvent) => void;
|
|
99
|
+
onSessionCreateRequest: (event: NativeReclaimInappModuleTypes.SessionCreateRequestEvent) => Promise<boolean>;
|
|
100
|
+
onSessionUpdateRequest: (event: NativeReclaimInappModuleTypes.SessionUpdateRequestEvent) => Promise<boolean>;
|
|
101
|
+
}
|
|
102
|
+
type ReclaimAppInfo = NativeReclaimInappModuleTypes.ReclaimAppInfo;
|
|
103
|
+
}
|
|
104
|
+
type OverrideConfig = {
|
|
105
|
+
provider?: Overrides.ProviderInformation;
|
|
106
|
+
featureOptions?: Overrides.FeatureOptions;
|
|
107
|
+
logConsumer?: Overrides.LogConsumer;
|
|
108
|
+
sessionManagement?: Overrides.SessionManagement;
|
|
109
|
+
appInfo?: Overrides.ReclaimAppInfo;
|
|
110
|
+
capabilityAccessToken?: string | null;
|
|
111
|
+
};
|
|
112
|
+
enum ExceptionType {
|
|
113
|
+
Cancelled = "Cancelled",
|
|
114
|
+
Dismissed = "Dismissed",
|
|
115
|
+
SessionExpired = "SessionExpired",
|
|
116
|
+
Failed = "Failed"
|
|
117
|
+
}
|
|
118
|
+
class ReclaimPlatformException extends Error {
|
|
119
|
+
readonly innerError: Error;
|
|
120
|
+
readonly reason?: string;
|
|
121
|
+
readonly details?: any;
|
|
122
|
+
constructor(message: string, innerError: Error);
|
|
123
|
+
static isReclaimPlatformException(error: Error): error is ReclaimPlatformException;
|
|
124
|
+
}
|
|
125
|
+
class ReclaimVerificationException extends Error {
|
|
126
|
+
readonly innerError: Error;
|
|
127
|
+
readonly type: ExceptionType;
|
|
128
|
+
readonly sessionId: string;
|
|
129
|
+
readonly "didSubmitManualVerification": boolean;
|
|
130
|
+
readonly "reason": string;
|
|
131
|
+
constructor(message: string, innerError: Error, type: ExceptionType, sessionId: string, didSubmitManualVerification: boolean, reason: string);
|
|
132
|
+
private static fromTypeName;
|
|
133
|
+
static fromError(error: Error, sessionIdHint: string): ReclaimVerificationException;
|
|
134
|
+
static isReclaimVerificationException(error: Error): error is ReclaimVerificationException;
|
|
135
|
+
}
|
|
136
|
+
abstract class Platform {
|
|
137
|
+
abstract startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response>;
|
|
138
|
+
abstract startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerification.Response>;
|
|
139
|
+
abstract ping(): Promise<boolean>;
|
|
140
|
+
abstract setOverrides(config: ReclaimVerification.OverrideConfig): Promise<void>;
|
|
141
|
+
abstract clearAllOverrides(): Promise<void>;
|
|
142
|
+
abstract setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void>;
|
|
143
|
+
}
|
|
13
144
|
}
|
|
14
145
|
//# 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,KAAK,6BAA6B,MAAM,0BAA0B,CAAC;AAG1E;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IACvB,QAAQ,EAAE,mBAAmB,CAAC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AAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,GAAG,4BAA4B;QA4BnF,MAAM,CAAC,8BAA8B,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,4BAA4B;KAG3F;IAED,eAAsB,QAAQ;QAC5B,QAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAEvG,QAAQ,CAAC,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAE5F,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;QAEjC,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,mBAAmB,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;QAEhF,QAAQ,CAAC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;QAE3C,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;KACzG;CACF"}
|
|
@@ -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"}
|
|
@@ -1,14 +1,145 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as NativeReclaimInappModuleTypes from "./specs/NativeInappRnSdk";
|
|
2
|
+
/**
|
|
3
|
+
* [ReclaimVerification] is the main class for interacting with the Reclaim verification system.
|
|
4
|
+
* It provides methods to start verification processes, manage platform configurations,
|
|
5
|
+
* and handle verification options.
|
|
6
|
+
*
|
|
7
|
+
* The class can be instantiated with a custom platform implementation, or will use
|
|
8
|
+
* the default [PlatformImpl] if none is provided.
|
|
9
|
+
*/
|
|
4
10
|
export declare class ReclaimVerification {
|
|
5
|
-
|
|
6
|
-
private static
|
|
7
|
-
constructor(
|
|
8
|
-
startVerification(request:
|
|
11
|
+
platform: ReclaimVerification.Platform;
|
|
12
|
+
private static defaultPlatform;
|
|
13
|
+
constructor(platform?: ReclaimVerification.Platform);
|
|
14
|
+
startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response>;
|
|
9
15
|
ping(): Promise<boolean>;
|
|
10
|
-
setOverrides(overrides:
|
|
16
|
+
setOverrides(overrides: ReclaimVerification.OverrideConfig): Promise<void>;
|
|
11
17
|
clearAllOverrides(): Promise<void>;
|
|
12
|
-
setVerificationOptions(options?:
|
|
18
|
+
setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This namespace provides types involved in initiating and managing the verification process
|
|
22
|
+
* for proving claims about user data through various providers.
|
|
23
|
+
*/
|
|
24
|
+
export declare namespace ReclaimVerification {
|
|
25
|
+
/**
|
|
26
|
+
* Represents user's session information for a verification attempt.
|
|
27
|
+
* This data class contains the necessary data to identify and validate a verification session.
|
|
28
|
+
*/
|
|
29
|
+
type SessionInformation = NativeReclaimInappModuleTypes.SessionInformation;
|
|
30
|
+
/**
|
|
31
|
+
* Represents a request for a verification attempt.
|
|
32
|
+
*
|
|
33
|
+
* You can create a request using the [ReclaimVerification.Request] constructor or the [ReclaimVerification.Request.fromManifestMetaData] factory method.
|
|
34
|
+
*/
|
|
35
|
+
type Request = NativeReclaimInappModuleTypes.Request;
|
|
36
|
+
/**
|
|
37
|
+
* Contains the proof and response data after verification
|
|
38
|
+
*/
|
|
39
|
+
interface Response extends NativeReclaimInappModuleTypes.Response {
|
|
40
|
+
proofs: ReclaimResult.Proof[];
|
|
41
|
+
}
|
|
42
|
+
namespace ReclaimResult {
|
|
43
|
+
interface Proof {
|
|
44
|
+
identifier: string;
|
|
45
|
+
signatures: string[];
|
|
46
|
+
/**
|
|
47
|
+
* A data associated with this [Proof].
|
|
48
|
+
* The data type of this object is dynamic and can be any JSON serializable Javascript object.
|
|
49
|
+
*/
|
|
50
|
+
publicData?: any | null;
|
|
51
|
+
witnesses: WitnessData[];
|
|
52
|
+
claimData: ProviderClaimData;
|
|
53
|
+
}
|
|
54
|
+
const isProof: (value: Record<string, any>) => value is Proof;
|
|
55
|
+
const asProofs: (proofs: Record<string, any>[]) => Proof[];
|
|
56
|
+
interface ProviderClaimData {
|
|
57
|
+
owner: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
timestampS: number;
|
|
60
|
+
epoch: number;
|
|
61
|
+
context: string;
|
|
62
|
+
identifier: string;
|
|
63
|
+
parameters: string;
|
|
64
|
+
}
|
|
65
|
+
interface WitnessData {
|
|
66
|
+
id: string;
|
|
67
|
+
url: string;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
interface VerificationOptions {
|
|
71
|
+
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
72
|
+
fetchAttestorAuthenticationRequest: (reclaimHttpProviderJsonString: string) => Promise<string>;
|
|
73
|
+
}
|
|
74
|
+
namespace Overrides {
|
|
75
|
+
interface ProviderInformation {
|
|
76
|
+
url?: string;
|
|
77
|
+
jsonString?: string;
|
|
78
|
+
callback?: (request: NativeReclaimInappModuleTypes.ProviderInformationRequest) => Promise<string>;
|
|
79
|
+
}
|
|
80
|
+
type FeatureOptions = NativeReclaimInappModuleTypes.FeatureOptions;
|
|
81
|
+
interface LogConsumer {
|
|
82
|
+
/**
|
|
83
|
+
* Handler for consuming logs exported from the SDK.
|
|
84
|
+
* Defaults to false.
|
|
85
|
+
*/
|
|
86
|
+
onLogs?: (logJsonString: String, cancel: () => void) => void;
|
|
87
|
+
/**
|
|
88
|
+
* When enabled, logs are sent to reclaim that can be used to help you.
|
|
89
|
+
* Defaults to true.
|
|
90
|
+
*/
|
|
91
|
+
canSdkCollectTelemetry?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Defaults to enabled when not in release mode.
|
|
94
|
+
*/
|
|
95
|
+
canSdkPrintLogs?: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface SessionManagement {
|
|
98
|
+
onLog: (event: NativeReclaimInappModuleTypes.SessionLogEvent) => void;
|
|
99
|
+
onSessionCreateRequest: (event: NativeReclaimInappModuleTypes.SessionCreateRequestEvent) => Promise<boolean>;
|
|
100
|
+
onSessionUpdateRequest: (event: NativeReclaimInappModuleTypes.SessionUpdateRequestEvent) => Promise<boolean>;
|
|
101
|
+
}
|
|
102
|
+
type ReclaimAppInfo = NativeReclaimInappModuleTypes.ReclaimAppInfo;
|
|
103
|
+
}
|
|
104
|
+
type OverrideConfig = {
|
|
105
|
+
provider?: Overrides.ProviderInformation;
|
|
106
|
+
featureOptions?: Overrides.FeatureOptions;
|
|
107
|
+
logConsumer?: Overrides.LogConsumer;
|
|
108
|
+
sessionManagement?: Overrides.SessionManagement;
|
|
109
|
+
appInfo?: Overrides.ReclaimAppInfo;
|
|
110
|
+
capabilityAccessToken?: string | null;
|
|
111
|
+
};
|
|
112
|
+
enum ExceptionType {
|
|
113
|
+
Cancelled = "Cancelled",
|
|
114
|
+
Dismissed = "Dismissed",
|
|
115
|
+
SessionExpired = "SessionExpired",
|
|
116
|
+
Failed = "Failed"
|
|
117
|
+
}
|
|
118
|
+
class ReclaimPlatformException extends Error {
|
|
119
|
+
readonly innerError: Error;
|
|
120
|
+
readonly reason?: string;
|
|
121
|
+
readonly details?: any;
|
|
122
|
+
constructor(message: string, innerError: Error);
|
|
123
|
+
static isReclaimPlatformException(error: Error): error is ReclaimPlatformException;
|
|
124
|
+
}
|
|
125
|
+
class ReclaimVerificationException extends Error {
|
|
126
|
+
readonly innerError: Error;
|
|
127
|
+
readonly type: ExceptionType;
|
|
128
|
+
readonly sessionId: string;
|
|
129
|
+
readonly "didSubmitManualVerification": boolean;
|
|
130
|
+
readonly "reason": string;
|
|
131
|
+
constructor(message: string, innerError: Error, type: ExceptionType, sessionId: string, didSubmitManualVerification: boolean, reason: string);
|
|
132
|
+
private static fromTypeName;
|
|
133
|
+
static fromError(error: Error, sessionIdHint: string): ReclaimVerificationException;
|
|
134
|
+
static isReclaimVerificationException(error: Error): error is ReclaimVerificationException;
|
|
135
|
+
}
|
|
136
|
+
abstract class Platform {
|
|
137
|
+
abstract startVerification(request: ReclaimVerification.Request): Promise<ReclaimVerification.Response>;
|
|
138
|
+
abstract startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerification.Response>;
|
|
139
|
+
abstract ping(): Promise<boolean>;
|
|
140
|
+
abstract setOverrides(config: ReclaimVerification.OverrideConfig): Promise<void>;
|
|
141
|
+
abstract clearAllOverrides(): Promise<void>;
|
|
142
|
+
abstract setVerificationOptions(options?: ReclaimVerification.VerificationOptions | null): Promise<void>;
|
|
143
|
+
}
|
|
13
144
|
}
|
|
14
145
|
//# 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,KAAK,6BAA6B,MAAM,0BAA0B,CAAC;AAG1E;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IACvB,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,CAAC;IAE9C,OAAO,CAAC,MAAM,CAAC,eAAe,CAA6C;gBAExD,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ;IAW7C,iBAAiB,CAAC,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AA4B;KAG3F;IAED,eAAsB,QAAQ;QAC5B,QAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAEvG,QAAQ,CAAC,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC;QAE5F,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;QAEjC,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,mBAAmB,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;QAEhF,QAAQ,CAAC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;QAE3C,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;KACzG;CACF"}
|
|
@@ -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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/inapp-rn-sdk",
|
|
3
|
-
"version": "0.3.
|
|
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"
|