@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,408 +0,0 @@
|
|
|
1
|
-
import type { EventSubscription } from "react-native";
|
|
2
|
-
import NativeReclaimInappModule from "./specs/NativeInappRnSdk";
|
|
3
|
-
import * as NativeReclaimInappModuleTypes from "./specs/NativeInappRnSdk";
|
|
4
|
-
import { ReclaimResult, type ReclaimVerificationResponse } from "./types/proof";
|
|
5
|
-
export type { ReclaimVerificationResponse, ReclaimResult } from "./types/proof";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This namespace provides types involved in initiating and managing the verification process
|
|
9
|
-
* for proving claims about user data through various providers.
|
|
10
|
-
*/
|
|
11
|
-
export namespace ReclaimVerificationApi {
|
|
12
|
-
/**
|
|
13
|
-
* Represents user's session information for a verification attempt.
|
|
14
|
-
* This data class contains the necessary data to identify and validate a verification session.
|
|
15
|
-
*/
|
|
16
|
-
export type SessionInformation = NativeReclaimInappModuleTypes.SessionInformation;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents a request for a verification attempt.
|
|
20
|
-
*
|
|
21
|
-
* You can create a request using the [ReclaimVerification.Request] constructor or the [ReclaimVerification.Request.fromManifestMetaData] factory method.
|
|
22
|
-
*/
|
|
23
|
-
export type Request = NativeReclaimInappModuleTypes.Request;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Contains the proof and response data after verification
|
|
27
|
-
*/
|
|
28
|
-
export type Response = ReclaimVerificationResponse;
|
|
29
|
-
|
|
30
|
-
export interface VerificationOptions {
|
|
31
|
-
canDeleteCookiesBeforeVerificationStarts: boolean;
|
|
32
|
-
fetchAttestorAuthenticationRequest: (reclaimHttpProviderJsonString: string) => Promise<string>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export namespace Overrides {
|
|
36
|
-
export interface ProviderInformation {
|
|
37
|
-
url?: string;
|
|
38
|
-
jsonString?: string;
|
|
39
|
-
callback?: (request: NativeReclaimInappModuleTypes.ProviderInformationRequest) => Promise<string>;
|
|
40
|
-
}
|
|
41
|
-
export type FeatureOptions = NativeReclaimInappModuleTypes.FeatureOptions;
|
|
42
|
-
export interface LogConsumer {
|
|
43
|
-
/**
|
|
44
|
-
* Handler for consuming logs exported from the SDK.
|
|
45
|
-
* Defaults to false.
|
|
46
|
-
*/
|
|
47
|
-
onLogs?: (logJsonString: String, cancel: () => void) => void;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* When enabled, logs are sent to reclaim that can be used to help you.
|
|
51
|
-
* Defaults to true.
|
|
52
|
-
*/
|
|
53
|
-
canSdkCollectTelemetry?: boolean;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Defaults to enabled when not in release mode.
|
|
57
|
-
*/
|
|
58
|
-
canSdkPrintLogs?: boolean;
|
|
59
|
-
}
|
|
60
|
-
export interface SessionManagement {
|
|
61
|
-
onLog: (event: NativeReclaimInappModuleTypes.SessionLogEvent) => void;
|
|
62
|
-
onSessionCreateRequest: (event: NativeReclaimInappModuleTypes.SessionCreateRequestEvent) => Promise<boolean>;
|
|
63
|
-
onSessionUpdateRequest: (event: NativeReclaimInappModuleTypes.SessionUpdateRequestEvent) => Promise<boolean>;
|
|
64
|
-
};
|
|
65
|
-
export type ReclaimAppInfo = NativeReclaimInappModuleTypes.ReclaimAppInfo;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type OverrideConfig = {
|
|
69
|
-
provider?: Overrides.ProviderInformation,
|
|
70
|
-
featureOptions?: Overrides.FeatureOptions,
|
|
71
|
-
logConsumer?: Overrides.LogConsumer,
|
|
72
|
-
sessionManagement?: Overrides.SessionManagement,
|
|
73
|
-
appInfo?: Overrides.ReclaimAppInfo,
|
|
74
|
-
capabilityAccessToken?: string | null,
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export enum ExceptionType {
|
|
78
|
-
Cancelled = "Cancelled",
|
|
79
|
-
Dismissed = "Dismissed",
|
|
80
|
-
SessionExpired = "SessionExpired",
|
|
81
|
-
Failed = "Failed",
|
|
82
|
-
}
|
|
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
|
-
|
|
107
|
-
export class ReclaimVerificationException extends Error {
|
|
108
|
-
readonly innerError: Error
|
|
109
|
-
readonly type: ExceptionType
|
|
110
|
-
readonly sessionId: string
|
|
111
|
-
readonly "didSubmitManualVerification": boolean
|
|
112
|
-
readonly "reason": string
|
|
113
|
-
|
|
114
|
-
constructor(
|
|
115
|
-
message: string,
|
|
116
|
-
innerError: Error,
|
|
117
|
-
type: ExceptionType,
|
|
118
|
-
sessionId: string,
|
|
119
|
-
didSubmitManualVerification: boolean,
|
|
120
|
-
reason: string
|
|
121
|
-
) {
|
|
122
|
-
super(message);
|
|
123
|
-
this.innerError = innerError;
|
|
124
|
-
this.type = type;
|
|
125
|
-
this.sessionId = sessionId;
|
|
126
|
-
this.didSubmitManualVerification = didSubmitManualVerification;
|
|
127
|
-
this.reason = reason;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private static fromTypeName(name: string): ExceptionType {
|
|
131
|
-
switch (name) {
|
|
132
|
-
case "cancelled":
|
|
133
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Cancelled":
|
|
134
|
-
return ExceptionType.Cancelled;
|
|
135
|
-
case "dismissed":
|
|
136
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Dismissed":
|
|
137
|
-
return ExceptionType.Dismissed;
|
|
138
|
-
case "sessionExpired":
|
|
139
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.SessionExpired":
|
|
140
|
-
return ExceptionType.SessionExpired;
|
|
141
|
-
case "failed":
|
|
142
|
-
case "org.reclaimprotocol.inapp_sdk.ReclaimVerification.ReclaimVerificationException.Failed":
|
|
143
|
-
return ExceptionType.Failed;
|
|
144
|
-
}
|
|
145
|
-
return ExceptionType.Failed;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
static fromError(error: Error, sessionIdHint: string): ReclaimVerificationException {
|
|
149
|
-
if ('userInfo' in error) {
|
|
150
|
-
// From native, we send information about error in userInfo
|
|
151
|
-
let userInfo = error.userInfo as any;
|
|
152
|
-
if (userInfo) {
|
|
153
|
-
let type = ReclaimVerificationApi.ReclaimVerificationException.fromTypeName(userInfo.errorType);
|
|
154
|
-
let maybeSessionId = userInfo?.sessionId
|
|
155
|
-
return new ReclaimVerificationException(
|
|
156
|
-
error.message,
|
|
157
|
-
error,
|
|
158
|
-
type,
|
|
159
|
-
(typeof maybeSessionId === 'string' && maybeSessionId)
|
|
160
|
-
? maybeSessionId : sessionIdHint,
|
|
161
|
-
userInfo?.didSubmitManualVerification ?? false,
|
|
162
|
-
userInfo?.reason ?? ""
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return new ReclaimVerificationException(
|
|
167
|
-
error.message,
|
|
168
|
-
error,
|
|
169
|
-
ReclaimVerificationApi.ExceptionType.Failed,
|
|
170
|
-
sessionIdHint,
|
|
171
|
-
false,
|
|
172
|
-
""
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
static isReclaimVerificationException(error: Error): error is ReclaimVerificationException {
|
|
177
|
-
return error instanceof ReclaimVerificationException
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
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> {
|
|
198
|
-
try {
|
|
199
|
-
const response = await NativeReclaimInappModule.startVerification(request);
|
|
200
|
-
return {
|
|
201
|
-
...response,
|
|
202
|
-
proofs: ReclaimResult.asProofs(response.proofs),
|
|
203
|
-
}
|
|
204
|
-
} catch (error) {
|
|
205
|
-
console.info({
|
|
206
|
-
error
|
|
207
|
-
})
|
|
208
|
-
if (error instanceof Error) {
|
|
209
|
-
throw ReclaimVerificationApi.ReclaimVerificationException.fromError(error, request.session?.sessionId ?? "");
|
|
210
|
-
}
|
|
211
|
-
throw error
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
override async startVerificationFromUrl(requestUrl: string): Promise<ReclaimVerificationApi.Response> {
|
|
216
|
-
try {
|
|
217
|
-
const response = await NativeReclaimInappModule.startVerificationFromUrl(requestUrl);
|
|
218
|
-
return {
|
|
219
|
-
...response,
|
|
220
|
-
proofs: ReclaimResult.asProofs(response.proofs),
|
|
221
|
-
}
|
|
222
|
-
} catch (error) {
|
|
223
|
-
console.info({
|
|
224
|
-
error
|
|
225
|
-
})
|
|
226
|
-
if (error instanceof Error) {
|
|
227
|
-
throw ReclaimVerificationApi.ReclaimVerificationException.fromError(error, "");
|
|
228
|
-
}
|
|
229
|
-
throw error
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
override async ping(): Promise<boolean> {
|
|
234
|
-
return await NativeReclaimInappModule.ping();
|
|
235
|
-
}
|
|
236
|
-
|
|
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
|
-
}
|
|
260
|
-
|
|
261
|
-
override async setOverrides({
|
|
262
|
-
provider,
|
|
263
|
-
featureOptions,
|
|
264
|
-
logConsumer,
|
|
265
|
-
sessionManagement,
|
|
266
|
-
appInfo,
|
|
267
|
-
capabilityAccessToken
|
|
268
|
-
}: ReclaimVerificationApi.OverrideConfig) {
|
|
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;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const onLogsListener = logConsumer?.onLogs;
|
|
293
|
-
let logConsumerRequest = !logConsumer ? undefined : {
|
|
294
|
-
enableLogHandler: !!onLogsListener,
|
|
295
|
-
canSdkCollectTelemetry: logConsumer?.canSdkCollectTelemetry,
|
|
296
|
-
canSdkPrintLogs: logConsumer?.canSdkPrintLogs
|
|
297
|
-
}
|
|
298
|
-
if (onLogsListener) {
|
|
299
|
-
this.disposeLogListener();
|
|
300
|
-
const cancel = () => {
|
|
301
|
-
this.previousLogSubscription?.remove();
|
|
302
|
-
this.previousLogSubscription = null;
|
|
303
|
-
};
|
|
304
|
-
this.previousLogSubscription = NativeReclaimInappModule.onLogs((arg) => {
|
|
305
|
-
onLogsListener(arg, cancel);
|
|
306
|
-
})
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
let sessionManagementRequest = !sessionManagement ? undefined : {
|
|
310
|
-
// A handler is provided, so we don't let SDK manage sessions
|
|
311
|
-
enableSdkSessionManagement: false
|
|
312
|
-
}
|
|
313
|
-
if (sessionManagement) {
|
|
314
|
-
this.disposeSessionManagement();
|
|
315
|
-
let sessionCreateSubscription = NativeReclaimInappModule.onSessionCreateRequest(async (event) => {
|
|
316
|
-
const replyId = event.replyId;
|
|
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
|
-
}
|
|
324
|
-
});
|
|
325
|
-
let sessionUpdateSubscription = NativeReclaimInappModule.onSessionUpdateRequest(async (event) => {
|
|
326
|
-
const replyId = event.replyId;
|
|
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
|
-
}
|
|
334
|
-
});
|
|
335
|
-
let sessionLogsSubscription = NativeReclaimInappModule.onSessionLogs((event) => {
|
|
336
|
-
try {
|
|
337
|
-
sessionManagement.onLog(event);
|
|
338
|
-
} catch (error) {
|
|
339
|
-
console.error(error);
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
const cancel = () => {
|
|
343
|
-
sessionCreateSubscription.remove()
|
|
344
|
-
sessionUpdateSubscription.remove()
|
|
345
|
-
sessionLogsSubscription.remove()
|
|
346
|
-
}
|
|
347
|
-
this.previousSessionManagementCancelCallback = cancel;
|
|
348
|
-
}
|
|
349
|
-
|
|
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
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
package/src/types/proof.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as NativeReclaimInappModuleTypes from "./../specs/NativeInappRnSdk";
|
|
2
|
-
|
|
3
|
-
export interface ReclaimVerificationResponse extends NativeReclaimInappModuleTypes.Response {
|
|
4
|
-
proofs: ReclaimResult.Proof[];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export namespace ReclaimResult {
|
|
8
|
-
export interface Proof {
|
|
9
|
-
identifier: string;
|
|
10
|
-
signatures: string[];
|
|
11
|
-
/**
|
|
12
|
-
* A data associated with this [Proof].
|
|
13
|
-
* The data type of this object is dynamic and can be any JSON serializable Javascript object.
|
|
14
|
-
*/
|
|
15
|
-
publicData?: any | null;
|
|
16
|
-
witnesses: WitnessData[];
|
|
17
|
-
claimData: ProviderClaimData;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const isProof = (value: Record<string, any>): value is Proof => {
|
|
21
|
-
return typeof value === 'object' && value !== null && 'identifier' in value && 'signatures' in value && 'witnesses' in value;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const asProofs = (proofs: Record<string, any>[]): Proof[] => {
|
|
25
|
-
return proofs.filter(isProof);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ProviderClaimData {
|
|
29
|
-
owner: string;
|
|
30
|
-
provider: string;
|
|
31
|
-
/// int
|
|
32
|
-
timestampS: number;
|
|
33
|
-
/// int
|
|
34
|
-
epoch: number;
|
|
35
|
-
context: string;
|
|
36
|
-
identifier: string;
|
|
37
|
-
parameters: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface WitnessData {
|
|
41
|
-
id: string;
|
|
42
|
-
url: string;
|
|
43
|
-
}
|
|
44
|
-
}
|