@reclaimprotocol/js-sdk 1.3.11 → 2.0.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/dist/index.d.ts +53 -161
- package/dist/index.js +615 -639
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,21 @@
|
|
|
1
|
-
interface
|
|
2
|
-
id: string;
|
|
1
|
+
interface ProviderData {
|
|
3
2
|
httpProviderId: string;
|
|
4
3
|
name: string;
|
|
5
|
-
logoUrl: string;
|
|
6
4
|
url: string;
|
|
7
|
-
method?: 'GET' | 'POST';
|
|
8
5
|
loginUrl: string;
|
|
9
|
-
responseSelections:
|
|
10
|
-
|
|
11
|
-
responseMatch: string;
|
|
12
|
-
xPath?: string | undefined;
|
|
13
|
-
jsonPath?: string | undefined;
|
|
14
|
-
}[];
|
|
15
|
-
headers?: {
|
|
16
|
-
[key: string]: string;
|
|
17
|
-
};
|
|
18
|
-
creatorEmail: string;
|
|
19
|
-
applicationId: string[];
|
|
20
|
-
iconPath: {
|
|
21
|
-
uri: string;
|
|
22
|
-
};
|
|
23
|
-
customInjection?: string;
|
|
24
|
-
urlType: 'CONSTANT' | 'REGEX';
|
|
25
|
-
proofCardTitle: string;
|
|
26
|
-
proofCardText: string;
|
|
27
|
-
bodySniff?: {
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
regex?: string;
|
|
30
|
-
};
|
|
31
|
-
userAgent?: {
|
|
32
|
-
ios?: string;
|
|
33
|
-
android?: string;
|
|
34
|
-
};
|
|
35
|
-
geoLocation?: string;
|
|
36
|
-
matchType?: string;
|
|
37
|
-
injectionType: string;
|
|
38
|
-
verificationType: string;
|
|
39
|
-
disableRequestReplay: boolean;
|
|
6
|
+
responseSelections: ResponseSelection[];
|
|
7
|
+
bodySniff?: BodySniff;
|
|
40
8
|
}
|
|
41
9
|
interface ResponseSelection {
|
|
42
|
-
|
|
43
|
-
XPath: string;
|
|
10
|
+
invert: boolean;
|
|
44
11
|
responseMatch: string;
|
|
12
|
+
xPath?: string;
|
|
13
|
+
jsonPath?: string;
|
|
45
14
|
}
|
|
46
15
|
interface BodySniff {
|
|
47
16
|
enabled: boolean;
|
|
48
|
-
regex
|
|
17
|
+
regex?: string;
|
|
18
|
+
template?: string;
|
|
49
19
|
}
|
|
50
20
|
interface Proof {
|
|
51
21
|
identifier: string;
|
|
@@ -67,68 +37,13 @@ interface ProviderClaimData {
|
|
|
67
37
|
owner: string;
|
|
68
38
|
timestampS: number;
|
|
69
39
|
context: string;
|
|
70
|
-
/**
|
|
71
|
-
* identifier of the claim;
|
|
72
|
-
* Hash of (provider, parameters, context)
|
|
73
|
-
*
|
|
74
|
-
* This is different from the claimId returned
|
|
75
|
-
* from the smart contract
|
|
76
|
-
*/
|
|
77
40
|
identifier: string;
|
|
78
41
|
epoch: number;
|
|
79
42
|
}
|
|
80
|
-
interface
|
|
81
|
-
id: string;
|
|
82
|
-
sessionId: string;
|
|
83
|
-
name: string;
|
|
84
|
-
callbackUrl: string;
|
|
85
|
-
statusUrl: string;
|
|
86
|
-
claims: RequestedClaim[];
|
|
87
|
-
}
|
|
88
|
-
interface RequestedClaim {
|
|
89
|
-
provider: string;
|
|
90
|
-
context: string;
|
|
91
|
-
httpProviderId: string;
|
|
92
|
-
payload: Payload;
|
|
93
|
-
}
|
|
94
|
-
interface Payload {
|
|
95
|
-
metadata: {
|
|
96
|
-
name: string;
|
|
97
|
-
logoUrl: string;
|
|
98
|
-
proofCardTitle: string;
|
|
99
|
-
proofCardText: string;
|
|
100
|
-
};
|
|
43
|
+
interface RequestedProof {
|
|
101
44
|
url: string;
|
|
102
|
-
urlType: 'CONSTANT' | 'REGEX';
|
|
103
|
-
method: 'GET' | 'POST';
|
|
104
|
-
login: {
|
|
105
|
-
url: string;
|
|
106
|
-
};
|
|
107
|
-
responseSelections: {
|
|
108
|
-
invert: boolean;
|
|
109
|
-
responseMatch: string;
|
|
110
|
-
xPath?: string;
|
|
111
|
-
jsonPath?: string;
|
|
112
|
-
}[];
|
|
113
|
-
headers?: {
|
|
114
|
-
[key: string]: string;
|
|
115
|
-
};
|
|
116
|
-
customInjection?: string;
|
|
117
|
-
bodySniff?: {
|
|
118
|
-
enabled: boolean;
|
|
119
|
-
regex?: string;
|
|
120
|
-
};
|
|
121
|
-
userAgent?: {
|
|
122
|
-
ios?: string;
|
|
123
|
-
android?: string;
|
|
124
|
-
};
|
|
125
|
-
geoLocation?: string;
|
|
126
|
-
matchType?: string;
|
|
127
|
-
injectionType: string;
|
|
128
|
-
verificationType: string;
|
|
129
|
-
disableRequestReplay: boolean;
|
|
130
45
|
parameters: {
|
|
131
|
-
[key: string]: string
|
|
46
|
+
[key: string]: string;
|
|
132
47
|
};
|
|
133
48
|
}
|
|
134
49
|
interface Context {
|
|
@@ -136,10 +51,6 @@ interface Context {
|
|
|
136
51
|
contextMessage: string;
|
|
137
52
|
}
|
|
138
53
|
interface Beacon {
|
|
139
|
-
/**
|
|
140
|
-
* Get the witnesses for the epoch specified
|
|
141
|
-
* or the current epoch if none is specified
|
|
142
|
-
*/
|
|
143
54
|
getState(epoch?: number): Promise<BeaconState>;
|
|
144
55
|
close?(): Promise<void>;
|
|
145
56
|
}
|
|
@@ -151,72 +62,53 @@ type BeaconState = {
|
|
|
151
62
|
};
|
|
152
63
|
|
|
153
64
|
type StartSessionParams = {
|
|
154
|
-
|
|
155
|
-
|
|
65
|
+
onSuccess: OnSuccess;
|
|
66
|
+
onError: OnError;
|
|
156
67
|
};
|
|
157
|
-
type
|
|
158
|
-
type
|
|
68
|
+
type OnSuccess = (proof: Proof) => void;
|
|
69
|
+
type OnError = (error: Error) => void;
|
|
159
70
|
type ProofRequestOptions = {
|
|
160
71
|
log?: boolean;
|
|
161
|
-
|
|
72
|
+
acceptAiProviders?: boolean;
|
|
162
73
|
};
|
|
163
|
-
type ApplicationId = string;
|
|
164
|
-
type Signature = string;
|
|
165
|
-
type AppCallbackUrl = string;
|
|
166
|
-
type SessionId = string;
|
|
167
|
-
type StatusUrl = string;
|
|
168
|
-
type NoReturn = void;
|
|
169
74
|
|
|
170
|
-
declare
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
buildProofRequest(providerId: string, redirectUser?: boolean, linkingVersion?: string): Promise<RequestedProofs>;
|
|
208
|
-
createVerificationRequest(): Promise<{
|
|
209
|
-
statusUrl: StatusUrl;
|
|
210
|
-
requestUrl: string;
|
|
211
|
-
}>;
|
|
212
|
-
startSession({ onSuccessCallback, onFailureCallback }: StartSessionParams): Promise<void>;
|
|
213
|
-
scheduleIntervalEndingTask(onFailureCallback: OnFailureCallback): void;
|
|
214
|
-
availableParams(): string[];
|
|
215
|
-
setParams(params: {
|
|
216
|
-
[key: string]: string;
|
|
217
|
-
}): NoReturn;
|
|
218
|
-
};
|
|
219
|
-
};
|
|
75
|
+
declare function verifyProof(proof: Proof): Promise<boolean>;
|
|
76
|
+
declare function transformForOnchain(proof: Proof): {
|
|
77
|
+
claimInfo: any;
|
|
78
|
+
signedClaim: any;
|
|
79
|
+
};
|
|
80
|
+
declare class ReclaimProofRequest {
|
|
81
|
+
private applicationId;
|
|
82
|
+
private signature?;
|
|
83
|
+
private appCallbackUrl?;
|
|
84
|
+
private sessionId;
|
|
85
|
+
private options?;
|
|
86
|
+
private context;
|
|
87
|
+
private requestedProof?;
|
|
88
|
+
private providerId;
|
|
89
|
+
private redirectUrl?;
|
|
90
|
+
private intervals;
|
|
91
|
+
private timeStamp;
|
|
92
|
+
private constructor();
|
|
93
|
+
static init(applicationId: string, appSecret: string, providerId: string, options?: ProofRequestOptions): Promise<ReclaimProofRequest>;
|
|
94
|
+
static fromJsonString(jsonString: string): Promise<ReclaimProofRequest>;
|
|
95
|
+
setAppCallbackUrl(url: string): void;
|
|
96
|
+
setRedirectUrl(url: string): void;
|
|
97
|
+
addContext(address: string, message: string): void;
|
|
98
|
+
setParams(params: {
|
|
99
|
+
[key: string]: string;
|
|
100
|
+
}): void;
|
|
101
|
+
getAppCallbackUrl(): string;
|
|
102
|
+
getStatusUrl(): string;
|
|
103
|
+
private setSignature;
|
|
104
|
+
private generateSignature;
|
|
105
|
+
private buildProofRequest;
|
|
106
|
+
private getRequestedProof;
|
|
107
|
+
private availableParams;
|
|
108
|
+
private clearInterval;
|
|
109
|
+
toJsonString(options?: ProofRequestOptions): string;
|
|
110
|
+
getRequestUrl(): Promise<string>;
|
|
111
|
+
startSession({ onSuccess, onError }: StartSessionParams): Promise<void>;
|
|
220
112
|
}
|
|
221
113
|
|
|
222
|
-
export { type Beacon, type BeaconState, type BodySniff, type Context, type
|
|
114
|
+
export { type Beacon, type BeaconState, type BodySniff, type Context, type Proof, type ProviderClaimData, type ProviderData, ReclaimProofRequest, type RequestedProof, type ResponseSelection, type WitnessData, transformForOnchain, verifyProof };
|