@reclaimprotocol/js-sdk 0.1.2 → 0.1.4

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 CHANGED
@@ -7,6 +7,7 @@ interface ProviderV2 {
7
7
  method?: 'GET' | 'POST';
8
8
  loginUrl: string;
9
9
  responseSelections: {
10
+ invert: boolean;
10
11
  responseMatch: string;
11
12
  xPath?: string | undefined;
12
13
  jsonPath?: string | undefined;
@@ -33,6 +34,8 @@ interface ProviderV2 {
33
34
  };
34
35
  geoLocation?: string;
35
36
  matchType?: string;
37
+ injectionType: string;
38
+ disableRequestReplay: boolean;
36
39
  }
37
40
  interface ResponseSelection {
38
41
  JSONPath: string;
@@ -49,6 +52,9 @@ interface Proof {
49
52
  signatures: string[];
50
53
  witnesses: WitnessData[];
51
54
  extractedParameterValues: any;
55
+ publicData?: {
56
+ [key: string]: string;
57
+ };
52
58
  }
53
59
  interface WitnessData {
54
60
  id: string;
@@ -98,6 +104,7 @@ interface Payload {
98
104
  url: string;
99
105
  };
100
106
  responseSelections: {
107
+ invert: boolean;
101
108
  responseMatch: string;
102
109
  xPath?: string;
103
110
  jsonPath?: string;
@@ -116,6 +123,11 @@ interface Payload {
116
123
  };
117
124
  geoLocation?: string;
118
125
  matchType?: string;
126
+ injectionType: string;
127
+ disableRequestReplay: boolean;
128
+ parameters: {
129
+ [key: string]: string | undefined;
130
+ };
119
131
  }
120
132
  interface Context {
121
133
  contextAddress: string;
@@ -155,6 +167,17 @@ type NoReturn = void;
155
167
 
156
168
  declare class Reclaim {
157
169
  static verifySignedProof(proof: Proof): Promise<boolean>;
170
+ static transformForOnchain(proof: Proof): {
171
+ claimInfo: {
172
+ [k: string]: string;
173
+ };
174
+ signedClaim: {
175
+ claim: {
176
+ [k: string]: string | number;
177
+ };
178
+ signatures: string[];
179
+ };
180
+ };
158
181
  static ProofRequest: {
159
182
  new (applicationId: string, options?: ProofRequestOptions): {
160
183
  applicationId: ApplicationId;
@@ -164,6 +187,7 @@ declare class Reclaim {
164
187
  statusUrl?: string | undefined;
165
188
  context: Context;
166
189
  requestedProofs?: RequestedProofs | undefined;
190
+ providerId?: string | undefined;
167
191
  intervals: Map<string, NodeJS.Timer>;
168
192
  addContext(address: string, message: string): NoReturn;
169
193
  setAppCallbackUrl(url: string): NoReturn;
@@ -171,7 +195,7 @@ declare class Reclaim {
171
195
  setSignature(signature: Signature): NoReturn;
172
196
  getAppCallbackUrl(): AppCallbackUrl;
173
197
  getStatusUrl(): StatusUrl;
174
- getRequestedProofs(): Promise<RequestedProofs>;
198
+ getRequestedProofs(): RequestedProofs;
175
199
  generateSignature(applicationSecret: string): Promise<Signature>;
176
200
  buildProofRequest(providerId: string): Promise<RequestedProofs>;
177
201
  createVerificationRequest(): Promise<{
@@ -180,6 +204,10 @@ declare class Reclaim {
180
204
  }>;
181
205
  startSession({ onSuccessCallback, onFailureCallback }: StartSessionParams): Promise<void>;
182
206
  scheduleIntervalEndingTask(onFailureCallback: OnFailureCallback): void;
207
+ availableParams(): string[];
208
+ setParams(params: {
209
+ [key: string]: string;
210
+ }): NoReturn;
183
211
  };
184
212
  };
185
213
  }
package/dist/index.js CHANGED
@@ -679,12 +679,17 @@ var config_default = {
679
679
  chainName: "opt-goerli",
680
680
  address: "0xF93F605142Fb1Efad7Aa58253dDffF67775b4520",
681
681
  rpcUrl: "https://opt-goerli.g.alchemy.com/v2/rksDkSUXd2dyk2ANy_zzODknx_AAokui"
682
+ },
683
+ "0xaa37dc": {
684
+ chainName: "opt-sepolia",
685
+ address: "0x6D0f81BDA11995f25921aAd5B43359630E65Ca96",
686
+ rpcUrl: "https://opt-sepolia.g.alchemy.com/v2/aO1-SfG4oFRLyAiLREqzyAUu0HTCwHgs"
682
687
  }
683
688
  };
684
689
 
685
690
  // src/smart-contract.ts
686
691
  var import_ethers3 = require("ethers");
687
- var DEFAULT_CHAIN_ID = 420;
692
+ var DEFAULT_CHAIN_ID = 11155111;
688
693
  function makeBeacon(chainId) {
689
694
  chainId = chainId || DEFAULT_CHAIN_ID;
690
695
  const contract = getContract(chainId);
@@ -752,11 +757,12 @@ function getContract(chainId) {
752
757
  var import_canonicalize = __toESM(require("canonicalize"));
753
758
 
754
759
  // src/constants.ts
760
+ var BACKEND_BASE_URL = "https://api.reclaimprotocol.org";
755
761
  var constants = {
756
- "GET_PROVIDERS_BY_ID_API": "https://api.reclaimprotocol.org/api/applications/providers",
757
- "DEFAULT_RECLAIM_CALLBACK_URL": "https://api.reclaimprotocol.org/api/sdk/callback?callbackId=",
758
- "DEFAULT_RECLAIM_STATUS_URL": "https://api.reclaimprotocol.org/api/sdk/session/",
759
- "RECLAIM_SHARE_URL": "https://share.reclaimprotocol.org/instant/?template="
762
+ GET_PROVIDERS_BY_ID_API: BACKEND_BASE_URL + "/api/applications/providers",
763
+ DEFAULT_RECLAIM_CALLBACK_URL: BACKEND_BASE_URL + "/api/sdk/callback?callbackId=",
764
+ DEFAULT_RECLAIM_STATUS_URL: BACKEND_BASE_URL + "/api/sdk/session/",
765
+ RECLAIM_SHARE_URL: "https://share.reclaimprotocol.org/instant/?template="
760
766
  };
761
767
 
762
768
  // src/errors.ts
@@ -802,6 +808,30 @@ var InvalidSignatureError = class extends Error {
802
808
  this.name = "InvalidSignatureError";
803
809
  }
804
810
  };
811
+ var UpdateSessionError = class extends Error {
812
+ constructor(message) {
813
+ super(message);
814
+ this.name = "UpdateSessionError";
815
+ }
816
+ };
817
+ var CreateSessionError = class extends Error {
818
+ constructor(message) {
819
+ super(message);
820
+ this.name = "CreateSessionError";
821
+ }
822
+ };
823
+ var ProviderFailedError = class extends Error {
824
+ constructor(message) {
825
+ super(message);
826
+ this.name = "ProviderFailedError";
827
+ }
828
+ };
829
+ var InvalidParamError = class extends Error {
830
+ constructor(message) {
831
+ super(message);
832
+ this.name = "InvalidParamError";
833
+ }
834
+ };
805
835
 
806
836
  // src/utils.ts
807
837
  function validateURL(url) {
@@ -848,7 +878,7 @@ function assertValidSignedClaim(claim, expectedWitnessAddresses) {
848
878
  function getShortenedUrl(url) {
849
879
  return __async(this, null, function* () {
850
880
  try {
851
- const response = yield fetch("https://api.reclaimprotocol.org/api/sdk/shortener", {
881
+ const response = yield fetch(BACKEND_BASE_URL + "/api/sdk/shortener", {
852
882
  method: "POST",
853
883
  headers: {
854
884
  "Content-Type": "application/json"
@@ -865,6 +895,53 @@ function getShortenedUrl(url) {
865
895
  }
866
896
  });
867
897
  }
898
+ function createSession(sessionId, appId, providerId) {
899
+ return __async(this, null, function* () {
900
+ try {
901
+ const response = yield fetch(BACKEND_BASE_URL + "/api/sdk/create-session/", {
902
+ method: "POST",
903
+ headers: {
904
+ "Content-Type": "application/json"
905
+ },
906
+ body: JSON.stringify({
907
+ sessionId,
908
+ appId,
909
+ providerId
910
+ })
911
+ });
912
+ if (!response.ok) {
913
+ throw new CreateSessionError("Error creating session with sessionId: " + sessionId);
914
+ }
915
+ const res = yield response.json();
916
+ return res;
917
+ } catch (err) {
918
+ throw new CreateSessionError("Error creating session with sessionId: " + sessionId);
919
+ }
920
+ });
921
+ }
922
+ function updateSession(sessionId, status) {
923
+ return __async(this, null, function* () {
924
+ try {
925
+ const response = yield fetch(BACKEND_BASE_URL + "/api/sdk/update-session/", {
926
+ method: "POST",
927
+ headers: {
928
+ "Content-Type": "application/json"
929
+ },
930
+ body: JSON.stringify({
931
+ sessionId,
932
+ status
933
+ })
934
+ });
935
+ if (!response.ok) {
936
+ throw new UpdateSessionError("Error updating session with sessionId: " + sessionId);
937
+ }
938
+ const res = yield response.json();
939
+ return res;
940
+ } catch (err) {
941
+ throw new UpdateSessionError("Error updating session with sessionId: " + sessionId);
942
+ }
943
+ });
944
+ }
868
945
  function fetchProvidersByAppId(appId) {
869
946
  return __async(this, null, function* () {
870
947
  try {
@@ -884,6 +961,8 @@ function validateProviderIdsAndReturnProviders(providerId, providers) {
884
961
  return providers.find((provider) => providerId == provider.httpProviderId);
885
962
  }
886
963
  function generateRequestedProofs(provider, context, callbackUrl, statusUrl, sessionId) {
964
+ const providerParams = {};
965
+ provider.responseSelections.forEach((rs) => rs.responseMatch.split(/{{(.*?)}}/).filter((e, i) => i % 2).forEach((param) => providerParams[param] = void 0));
887
966
  const claims = [{
888
967
  provider: encodeURIComponent(provider.name),
889
968
  context: JSON.stringify(context),
@@ -905,8 +984,11 @@ function generateRequestedProofs(provider, context, callbackUrl, statusUrl, sess
905
984
  customInjection: provider.customInjection,
906
985
  bodySniff: provider.bodySniff,
907
986
  userAgent: provider.userAgent,
908
- geoLocation: provider.geoLocation ? provider.geoLocation : "",
909
- matchType: provider.matchType ? provider.matchType : "greedy"
987
+ geoLocation: provider.geoLocation,
988
+ matchType: provider.matchType,
989
+ injectionType: provider.injectionType,
990
+ disableRequestReplay: provider.disableRequestReplay,
991
+ parameters: providerParams
910
992
  }
911
993
  }];
912
994
  return {
@@ -982,6 +1064,25 @@ var _Reclaim = class _Reclaim {
982
1064
  return true;
983
1065
  });
984
1066
  }
1067
+ static transformForOnchain(proof) {
1068
+ const claimInfoBuilder = /* @__PURE__ */ new Map([
1069
+ ["context", proof.claimData.context],
1070
+ ["parameters", proof.claimData.parameters],
1071
+ ["provider", proof.claimData.provider]
1072
+ ]);
1073
+ const claimInfo = Object.fromEntries(claimInfoBuilder);
1074
+ const claimBuilder = /* @__PURE__ */ new Map([
1075
+ ["epoch", proof.claimData.epoch],
1076
+ ["identifier", proof.claimData.identifier],
1077
+ ["owner", proof.claimData.owner],
1078
+ ["timestampS", proof.claimData.timestampS]
1079
+ ]);
1080
+ const signedClaim = {
1081
+ claim: Object.fromEntries(claimBuilder),
1082
+ signatures: proof.signatures
1083
+ };
1084
+ return { claimInfo, signedClaim };
1085
+ }
985
1086
  };
986
1087
  _Reclaim.ProofRequest = class {
987
1088
  constructor(applicationId, options) {
@@ -1015,16 +1116,16 @@ _Reclaim.ProofRequest = class {
1015
1116
  return this.statusUrl || `${constants.DEFAULT_RECLAIM_STATUS_URL}${this.sessionId}`;
1016
1117
  }
1017
1118
  getRequestedProofs() {
1018
- return __async(this, null, function* () {
1019
- try {
1020
- if (!this.requestedProofs) {
1021
- throw new BuildProofRequestError("Call buildProofRequest(providerId: string) first!");
1022
- }
1023
- return this.requestedProofs;
1024
- } catch (err) {
1025
- throw err;
1119
+ try {
1120
+ if (!this.requestedProofs) {
1121
+ throw new BuildProofRequestError(
1122
+ "Call buildProofRequest(providerId: string) first!"
1123
+ );
1026
1124
  }
1027
- });
1125
+ return this.requestedProofs;
1126
+ } catch (err) {
1127
+ throw err;
1128
+ }
1028
1129
  }
1029
1130
  generateSignature(applicationSecret) {
1030
1131
  return __async(this, null, function* () {
@@ -1052,7 +1153,11 @@ _Reclaim.ProofRequest = class {
1052
1153
  return __async(this, null, function* () {
1053
1154
  try {
1054
1155
  let providers = yield fetchProvidersByAppId(this.applicationId);
1055
- const provider = validateProviderIdsAndReturnProviders(providerId, providers);
1156
+ const provider = validateProviderIdsAndReturnProviders(
1157
+ providerId,
1158
+ providers
1159
+ );
1160
+ this.providerId = providerId;
1056
1161
  this.requestedProofs = generateRequestedProofs(
1057
1162
  provider,
1058
1163
  this.context,
@@ -1074,7 +1179,9 @@ _Reclaim.ProofRequest = class {
1074
1179
  try {
1075
1180
  const requestedProofs = yield this.getRequestedProofs();
1076
1181
  if (!requestedProofs) {
1077
- throw new BuildProofRequestError("Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!");
1182
+ throw new BuildProofRequestError(
1183
+ "Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!"
1184
+ );
1078
1185
  }
1079
1186
  if (!this.signature) {
1080
1187
  throw new SignatureNotFoundError(
@@ -1091,6 +1198,7 @@ _Reclaim.ProofRequest = class {
1091
1198
  template = replaceAll(template, "(", "%28");
1092
1199
  template = replaceAll(template, ")", "%29");
1093
1200
  template = yield getShortenedUrl(template);
1201
+ yield createSession(this.sessionId, this.applicationId, this.providerId);
1094
1202
  return { requestUrl: template, statusUrl: this.getStatusUrl() };
1095
1203
  } catch (error) {
1096
1204
  logger.error("Error creating verification request:", error);
@@ -1106,12 +1214,21 @@ _Reclaim.ProofRequest = class {
1106
1214
  const statusUrl = this.getStatusUrl();
1107
1215
  if (statusUrl && this.sessionId) {
1108
1216
  logger.info("Starting session");
1217
+ try {
1218
+ yield updateSession(this.sessionId, "SDK_STARTED" /* SDK_STARTED */);
1219
+ } catch (e) {
1220
+ logger.error(e);
1221
+ }
1109
1222
  const interval = setInterval(() => __async(this, null, function* () {
1110
1223
  try {
1111
1224
  const res = yield fetch(statusUrl);
1112
1225
  const data = yield res.json();
1113
1226
  if (!data.session)
1114
1227
  return;
1228
+ if (data.session.status === "FAILED" /* FAILED */)
1229
+ throw new ProviderFailedError();
1230
+ if (data.session.proofs.length === 0)
1231
+ return;
1115
1232
  data.session.proofs.forEach((proof) => __async(this, null, function* () {
1116
1233
  const verified = yield _Reclaim.verifySignedProof(proof);
1117
1234
  if (!verified) {
@@ -1119,11 +1236,23 @@ _Reclaim.ProofRequest = class {
1119
1236
  }
1120
1237
  }));
1121
1238
  if (onSuccessCallback) {
1239
+ try {
1240
+ yield updateSession(this.sessionId, "SDK_RECEIVED" /* SDK_RECEIVED */);
1241
+ } catch (e) {
1242
+ logger.error(e);
1243
+ }
1122
1244
  onSuccessCallback(data.session.proofs);
1123
1245
  }
1124
1246
  clearInterval(this.intervals.get(this.sessionId));
1125
1247
  this.intervals.delete(this.sessionId);
1126
1248
  } catch (e) {
1249
+ if (!(e instanceof ProviderFailedError)) {
1250
+ try {
1251
+ yield updateSession(this.sessionId, "FAILED" /* FAILED */);
1252
+ } catch (e2) {
1253
+ logger.error(e2);
1254
+ }
1255
+ }
1127
1256
  if (onFailureCallback) {
1128
1257
  onFailureCallback(e);
1129
1258
  }
@@ -1141,14 +1270,47 @@ _Reclaim.ProofRequest = class {
1141
1270
  });
1142
1271
  }
1143
1272
  scheduleIntervalEndingTask(onFailureCallback) {
1144
- setTimeout(() => {
1273
+ setTimeout(() => __async(this, null, function* () {
1145
1274
  if (this.intervals.has(this.sessionId)) {
1146
1275
  const message = "Interval ended without receiveing proofs";
1276
+ yield updateSession(this.sessionId, "FAILED" /* FAILED */);
1147
1277
  onFailureCallback(new TimeoutError(message));
1148
1278
  logger.warn(message);
1149
1279
  clearInterval(this.intervals.get(this.sessionId));
1150
1280
  }
1151
- }, 1e3 * 60 * 5);
1281
+ }), 1e3 * 60 * 5);
1282
+ }
1283
+ availableParams() {
1284
+ const requestedProofs = this.getRequestedProofs();
1285
+ if (!requestedProofs || !this.requestedProofs) {
1286
+ throw new BuildProofRequestError(
1287
+ "Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!"
1288
+ );
1289
+ }
1290
+ return Object.keys(requestedProofs.claims[0].payload.parameters);
1291
+ }
1292
+ setParams(params) {
1293
+ try {
1294
+ const requestedProofs = this.getRequestedProofs();
1295
+ if (!requestedProofs || !this.requestedProofs) {
1296
+ throw new BuildProofRequestError(
1297
+ "Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!"
1298
+ );
1299
+ }
1300
+ const availableParams = this.availableParams();
1301
+ const paramsToSet = Object.keys(params);
1302
+ for (let i = 0; i < paramsToSet.length; i++) {
1303
+ if (!availableParams.includes(paramsToSet[i])) {
1304
+ throw new InvalidParamError(
1305
+ `Cannot Set parameter ${paramsToSet[i]} for provider ${this.providerId} available Prameters inculde : ${availableParams}`
1306
+ );
1307
+ }
1308
+ }
1309
+ this.requestedProofs.claims[0].payload.parameters = __spreadValues(__spreadValues({}, requestedProofs.claims[0].payload.parameters), params);
1310
+ } catch (error) {
1311
+ logger.error("Error Setting Params:", error);
1312
+ throw error;
1313
+ }
1152
1314
  }
1153
1315
  };
1154
1316
  var Reclaim = _Reclaim;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/witness.ts","../src/Reclaim.ts","../src/utils.ts","../src/contract-types/contracts/factories/Reclaim__factory.ts","../src/contract-types/config.json","../src/smart-contract.ts","../src/constants.ts","../src/errors.ts"],"sourcesContent":["export * from './Reclaim';\nexport * from './interfaces';","import { ethers } from 'ethers';\nimport type { WitnessData } from './interfaces';\nimport type { ClaimID, ClaimInfo, CompleteClaimData } from './types';\n\ntype BeaconState = {\n witnesses: WitnessData[];\n epoch: number;\n witnessesRequiredForClaim: number;\n nextEpochTimestampS: number;\n};\n\nexport function fetchWitnessListForClaim(\n { witnesses, witnessesRequiredForClaim, epoch }: BeaconState,\n params: string | ClaimInfo,\n timestampS: number\n) {\n const identifier =\n typeof params === 'string' ? params : getIdentifierFromClaimInfo(params);\n const completeInput = [\n identifier,\n epoch.toString(),\n witnessesRequiredForClaim.toString(),\n timestampS.toString(),\n ].join('\\n');\n const completeHashStr = ethers.keccak256(strToUint8Array(completeInput));\n const completeHash = ethers.getBytes(completeHashStr);\n const completeHashView = uint8ArrayToDataView(completeHash);\n const witnessesLeft = [...witnesses];\n const selectedWitnesses: WitnessData[] = [];\n // we'll use 32 bits of the hash to select\n // each witness\n let byteOffset = 0;\n for (let i = 0; i < witnessesRequiredForClaim; i++) {\n const randomSeed = completeHashView.getUint32(byteOffset);\n const witnessIndex = randomSeed % witnessesLeft.length;\n const witness = witnessesLeft[witnessIndex] as WitnessData;\n selectedWitnesses.push(witness);\n\n // Remove the selected witness from the list of witnesses left\n witnessesLeft[witnessIndex] = witnessesLeft[\n witnessesLeft.length - 1\n ] as WitnessData;\n witnessesLeft.pop();\n byteOffset = (byteOffset + 4) % completeHash.length;\n }\n\n return selectedWitnesses;\n}\n\nexport function getIdentifierFromClaimInfo(info: ClaimInfo): ClaimID {\n const str = `${info.provider}\\n${info.parameters}\\n${info.context || ''}`;\n return ethers.keccak256(strToUint8Array(str)).toLowerCase();\n}\n\nexport function strToUint8Array(str: string) {\n return new TextEncoder().encode(str);\n}\n\nexport function uint8ArrayToDataView(arr: Uint8Array) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\nexport function createSignDataForClaim(data: CompleteClaimData) {\n const identifier =\n 'identifier' in data ? data.identifier : getIdentifierFromClaimInfo(data);\n const lines = [\n identifier,\n data.owner.toLowerCase(),\n data.timestampS.toString(),\n data.epoch.toString(),\n ];\n\n return lines.join('\\n');\n}\n","import type { Proof, RequestedProofs, Context } from './interfaces'\nimport { getIdentifierFromClaimInfo } from './witness'\nimport type {\n AppCallbackUrl,\n ApplicationId,\n CreateVerificationRequest,\n NoReturn,\n OnFailureCallback,\n OnSuccessCallback,\n SessionId,\n Signature,\n SignedClaim,\n StatusUrl,\n ProofRequestOptions,\n StartSessionParams\n} from './types'\nimport { v4 } from 'uuid'\nimport { ethers } from 'ethers'\nimport canonicalize from 'canonicalize'\nimport {\n getWitnessesForClaim,\n assertValidSignedClaim,\n getShortenedUrl,\n fetchProvidersByAppId,\n generateRequestedProofs,\n validateProviderIdsAndReturnProviders,\n validateSignature,\n replaceAll,\n validateURL\n} from './utils'\nimport { constants } from './constants'\nimport P from 'pino'\nimport {\n BuildProofRequestError,\n ProofNotVerifiedError,\n SessionNotStartedError,\n SignatureNotFoundError,\n TimeoutError\n} from './errors'\n\nconst logger = P()\n\nexport class Reclaim {\n static async verifySignedProof (proof: Proof) {\n if (!proof.signatures.length) {\n throw new Error('No signatures')\n }\n const witnesses = await getWitnessesForClaim(\n proof.claimData.epoch,\n proof.identifier,\n proof.claimData.timestampS\n )\n\n try {\n // then hash the claim info with the encoded ctx to get the identifier\n const calculatedIdentifier = getIdentifierFromClaimInfo({\n parameters: JSON.parse(\n canonicalize(proof.claimData.parameters) as string\n ),\n provider: proof.claimData.provider,\n context: proof.claimData.context\n })\n proof.identifier = replaceAll(proof.identifier, '\"', '')\n // check if the identifier matches the one in the proof\n if (calculatedIdentifier !== proof.identifier) {\n throw new ProofNotVerifiedError('Identifier Mismatch')\n }\n\n const signedClaim: SignedClaim = {\n claim: {\n ...proof.claimData\n },\n signatures: proof.signatures.map(signature => {\n return ethers.getBytes(signature)\n })\n }\n\n // verify the witness signature\n assertValidSignedClaim(signedClaim, witnesses)\n } catch (e: Error | unknown) {\n logger.error(e)\n return false\n }\n\n return true\n }\n\n static ProofRequest = class {\n applicationId: ApplicationId\n signature?: Signature\n appCallbackUrl?: AppCallbackUrl\n sessionId: SessionId\n statusUrl?: StatusUrl\n context: Context = { contextAddress: '0x0', contextMessage: '' }\n requestedProofs?: RequestedProofs\n intervals: Map<string, NodeJS.Timer> = new Map()\n\n constructor (applicationId: string, options?: ProofRequestOptions) {\n this.applicationId = applicationId\n this.sessionId = options?.sessionId || v4().toString()\n logger.level = options?.log ? 'info' : 'silent'\n logger.info(\n `Initializing client with applicationId: ${this.applicationId} and sessionId: ${this.sessionId}`\n )\n }\n\n addContext (address: string, message: string): NoReturn {\n this.context = { contextAddress: address, contextMessage: message }\n }\n\n setAppCallbackUrl (url: string): NoReturn {\n validateURL(url)\n this.appCallbackUrl = url\n }\n\n setStatusUrl (url: string): NoReturn {\n validateURL(url)\n this.statusUrl = url\n }\n\n setSignature (signature: Signature): NoReturn {\n this.signature = signature\n }\n\n getAppCallbackUrl (): AppCallbackUrl {\n return (\n this.appCallbackUrl ||\n `${constants.DEFAULT_RECLAIM_CALLBACK_URL}${this.sessionId}`\n )\n }\n\n getStatusUrl (): StatusUrl {\n return (\n this.statusUrl ||\n `${constants.DEFAULT_RECLAIM_STATUS_URL}${this.sessionId}`\n )\n }\n\n async getRequestedProofs (): Promise<RequestedProofs> {\n try {\n if (!this.requestedProofs) {\n throw new BuildProofRequestError('Call buildProofRequest(providerId: string) first!')\n }\n return this.requestedProofs!\n } catch (err) {\n throw err\n }\n }\n\n async generateSignature (applicationSecret: string): Promise<Signature> {\n try {\n const wallet = new ethers.Wallet(applicationSecret)\n const signature: Signature = (await wallet.signMessage(\n ethers.getBytes(\n ethers.keccak256(\n new TextEncoder().encode(\n canonicalize(await this.getRequestedProofs())!\n )\n )\n )\n )) as unknown as Signature\n\n return signature\n } catch (err) {\n logger.error(err)\n throw new BuildProofRequestError(\n 'Error generating signature for applicationSecret: ' +\n applicationSecret\n )\n }\n }\n\n async buildProofRequest (providerId: string): Promise<RequestedProofs> {\n try {\n let providers = await fetchProvidersByAppId(this.applicationId)\n \n const provider = validateProviderIdsAndReturnProviders(providerId, providers)\n \n this.requestedProofs = generateRequestedProofs(\n provider,\n this.context,\n this.getAppCallbackUrl(),\n this.getStatusUrl(),\n this.sessionId\n )\n\n return this.requestedProofs\n } catch (err: Error | unknown) {\n logger.error(err)\n throw new BuildProofRequestError(\n 'Something went wrong while generating proof request'\n )\n }\n }\n\n async createVerificationRequest (): Promise<{statusUrl: StatusUrl, requestUrl: string}> {\n try {\n const requestedProofs = await this.getRequestedProofs()\n\n if (!requestedProofs) {\n throw new BuildProofRequestError('Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!')\n }\n\n if (!this.signature) {\n throw new SignatureNotFoundError(\n 'Signature is not set. Use reclaim.setSignature(signature) to set the signature'\n )\n }\n\n validateSignature(requestedProofs, this.signature, this.applicationId)\n\n const templateData = {\n ...requestedProofs,\n signature: this.signature\n }\n let template = `${constants.RECLAIM_SHARE_URL}${encodeURIComponent(\n JSON.stringify(templateData)\n )}`\n template = replaceAll(template, '(', '%28')\n template = replaceAll(template, ')', '%29')\n template = await getShortenedUrl(template)\n\n return {requestUrl: template, statusUrl: this.getStatusUrl()}\n } catch (error) {\n logger.error('Error creating verification request:', error)\n throw error\n }\n }\n\n async startSession ({\n onSuccessCallback,\n onFailureCallback\n }: StartSessionParams) {\n const statusUrl = this.getStatusUrl()\n if (statusUrl && this.sessionId) {\n logger.info('Starting session')\n // TODO: add update session API to 'STARTED' state\n const interval = setInterval(async () => {\n try {\n const res = await fetch(statusUrl)\n const data = await res.json()\n\n if (!data.session) return\n\n data.session.proofs.forEach(async (proof: Proof) => {\n const verified = await Reclaim.verifySignedProof(proof)\n if (!verified) {\n throw new ProofNotVerifiedError()\n }\n })\n if (onSuccessCallback) {\n // TODO: add update session API to 'RECEIVED' state\n onSuccessCallback(data.session.proofs)\n }\n clearInterval(this.intervals.get(this.sessionId!))\n this.intervals.delete(this.sessionId!)\n } catch (e) {\n if (onFailureCallback) {\n // TODO: add update session API to 'FAILED' state\n onFailureCallback(e as Error)\n }\n clearInterval(this.intervals.get(this.sessionId!))\n this.intervals.delete(this.sessionId!)\n }\n }, 3000)\n\n this.intervals.set(this.sessionId, interval)\n this.scheduleIntervalEndingTask(onFailureCallback)\n } else {\n const message =\n \"Session can't be started due to undefined value of statusUrl and sessionId\"\n logger.error(message)\n throw new SessionNotStartedError(message)\n }\n }\n\n scheduleIntervalEndingTask (onFailureCallback: OnFailureCallback) {\n setTimeout(() => {\n if (this.intervals.has(this.sessionId)) {\n const message = 'Interval ended without receiveing proofs'\n // TODO: add update session API to 'FAILED' state\n onFailureCallback(new TimeoutError(message))\n logger.warn(message)\n clearInterval(this.intervals.get(this.sessionId!))\n }\n }, 1000 * 60 * 5)\n }\n }\n}\n","import URL from 'url-parse'\nimport type { ApplicationId, ParsedURL, SignedClaim, Signature } from './types'\nimport type { Context, ProviderV2, RequestedClaim, RequestedProofs, WitnessData } from './interfaces'\nimport { ethers } from 'ethers'\nimport { makeBeacon } from './smart-contract'\nimport { fetchWitnessListForClaim, createSignDataForClaim } from './witness'\nimport { v4 } from 'uuid'\nimport canonicalize from 'canonicalize'\nimport { constants } from './constants'\nimport { InvalidSignatureError, ProofNotVerifiedError, ProviderAPIError } from './errors'\n\n/*\n URL utils\n*/\nexport function parse(url: string): ParsedURL {\n validateURL(url)\n\n const parsed = URL(url, /* parseQueryString */ true)\n\n for (const param in parsed.query) {\n parsed.query[param] = decodeURIComponent(parsed.query[param]!)\n }\n const queryParams = parsed.query\n\n let path = parsed.pathname || null\n let hostname = parsed.hostname || null\n let scheme = parsed.protocol || null\n\n if (scheme) {\n // Remove colon at end\n scheme = scheme.substring(0, scheme.length - 1)\n }\n\n return {\n hostname,\n path,\n queryParams,\n scheme\n }\n}\n\nexport function validateURL(url: string): void {\n if (typeof url !== 'string') {\n throw new Error(`Invalid URL: ${url}. URL must be a string.`)\n }\n if (!url) {\n throw new Error(`Invalid URL: ${url}. URL cannot be empty`)\n }\n}\n\n/*\n Witness Utils\n*/\n\nexport async function getWitnessesForClaim(\n epoch: number,\n identifier: string,\n timestampS: number\n) {\n const beacon = makeBeacon()\n if (!beacon) throw new Error('No beacon')\n const state = await beacon.getState(epoch)\n const witnessList = fetchWitnessListForClaim(state, identifier, timestampS)\n return witnessList.map((w: WitnessData) => w.id.toLowerCase())\n}\n\n/*\n Proof Utils\n*/\n\n/** recovers the addresses of those that signed the claim */\nexport function recoverSignersOfSignedClaim({\n claim,\n signatures\n}: SignedClaim) {\n const dataStr = createSignDataForClaim({ ...claim })\n return signatures.map(signature =>\n ethers.verifyMessage(dataStr, ethers.hexlify(signature)).toLowerCase()\n )\n}\n\n/**\n * Asserts that the claim is signed by the expected witnesses\n * @param claim\n * @param expectedWitnessAddresses\n */\nexport function assertValidSignedClaim(\n claim: SignedClaim,\n expectedWitnessAddresses: string[]\n) {\n const witnessAddresses = recoverSignersOfSignedClaim(claim)\n // set of witnesses whose signatures we've not seen\n const witnessesNotSeen = new Set(expectedWitnessAddresses)\n for (const witness of witnessAddresses) {\n if (witnessesNotSeen.has(witness)) {\n witnessesNotSeen.delete(witness)\n }\n }\n\n // check if all witnesses have signed\n if (witnessesNotSeen.size > 0) {\n throw new ProofNotVerifiedError(\n `Missing signatures from ${expectedWitnessAddresses.join(', ')}`\n )\n }\n}\n\nexport async function getShortenedUrl(url: string) {\n try {\n const response = await fetch('https://api.reclaimprotocol.org/api/sdk/shortener', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n fullUrl: url\n })\n })\n const res = await response.json()\n const shortenedVerificationUrl = res.result.shortUrl\n return shortenedVerificationUrl\n } catch (err) {\n return url\n }\n}\n\nexport async function fetchProvidersByAppId(appId: string) {\n try {\n const response = await fetch(`${constants.GET_PROVIDERS_BY_ID_API}/${appId}`)\n const res = await response.json()\n return res.providers.httpProvider\n } catch (err) {\n throw new ProviderAPIError('Error fetching provider with AppId: ' + appId)\n }\n}\n\nexport function validateProviderIdsAndReturnProviders(providerId: string, providers: ProviderV2[]): ProviderV2 {\n let providerExists = providers.some(provider => providerId == provider.httpProviderId)\n if(!providerExists){\n throw new ProviderAPIError(`The following provider Id is not included in your application => ${providerId}`)\n } \n return providers.find(provider => providerId == provider.httpProviderId) as ProviderV2\n}\n\nexport function generateRequestedProofs(provider: ProviderV2, context: Context, callbackUrl: string, statusUrl: string, sessionId: string): RequestedProofs {\n const claims =[{\n provider: encodeURIComponent(provider.name),\n context: JSON.stringify(context),\n templateClaimId: provider.id,\n payload: {\n metadata: {\n name: encodeURIComponent(provider.name),\n logoUrl: provider.logoUrl,\n proofCardText: provider.proofCardText,\n proofCardTitle: provider.proofCardTitle,\n },\n url: provider.url,\n urlType: provider.urlType as \"CONSTANT\" | \"REGEX\",\n method: provider.method as \"GET\" | \"POST\",\n login: {\n url: provider.loginUrl\n },\n responseSelections: provider.responseSelections,\n customInjection: provider.customInjection,\n bodySniff: provider.bodySniff,\n userAgent: provider.userAgent, \n geoLocation: provider.geoLocation ? provider.geoLocation : '',\n matchType: provider.matchType ? provider.matchType : 'greedy'\n }\n }] as RequestedClaim[];\n \n\n return {\n id: sessionId,\n sessionId: sessionId,\n name: 'web-SDK',\n callbackUrl: callbackUrl,\n statusUrl: statusUrl,\n claims: claims\n };\n}\n\nexport function validateSignature(requestedProofs: RequestedProofs, signature: Signature, applicationId: ApplicationId) {\n try {\n const appId = ethers\n .verifyMessage(\n ethers.getBytes(\n ethers.keccak256(\n new TextEncoder().encode(canonicalize(requestedProofs)!)\n )\n ),\n ethers.hexlify(signature as unknown as string)\n )\n .toLowerCase()\n\n if (ethers.getAddress(appId) !== ethers.getAddress(applicationId)) {\n throw new InvalidSignatureError(`Signature does not match the application id: ${appId}`)\n }\n } catch (err) {\n throw err\n }\n}\n\nexport function escapeRegExp(string: string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nexport function replaceAll(str: string, find: string, replace: string) {\n return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);\n}","/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n\nimport { Contract } from 'ethers';\n\nconst _abi = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: 'address',\n name: 'previousAdmin',\n type: 'address',\n },\n {\n indexed: false,\n internalType: 'address',\n name: 'newAdmin',\n type: 'address',\n },\n ],\n name: 'AdminChanged',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: 'address',\n name: 'beacon',\n type: 'address',\n },\n ],\n name: 'BeaconUpgraded',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n components: [\n {\n internalType: 'uint32',\n name: 'id',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampStart',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampEnd',\n type: 'uint32',\n },\n {\n components: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n internalType: 'struct Reclaim.Witness[]',\n name: 'witnesses',\n type: 'tuple[]',\n },\n {\n internalType: 'uint8',\n name: 'minimumWitnessesForClaimCreation',\n type: 'uint8',\n },\n ],\n indexed: false,\n internalType: 'struct Reclaim.Epoch',\n name: 'epoch',\n type: 'tuple',\n },\n ],\n name: 'EpochAdded',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: 'uint8',\n name: 'version',\n type: 'uint8',\n },\n ],\n name: 'Initialized',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: 'address',\n name: 'previousOwner',\n type: 'address',\n },\n {\n indexed: true,\n internalType: 'address',\n name: 'newOwner',\n type: 'address',\n },\n ],\n name: 'OwnershipTransferred',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: 'address',\n name: 'implementation',\n type: 'address',\n },\n ],\n name: 'Upgraded',\n type: 'event',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'witnessAddress',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n name: 'addAsWitness',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'addNewEpoch',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint32',\n name: 'epochNum',\n type: 'uint32',\n },\n {\n components: [\n {\n internalType: 'string',\n name: 'provider',\n type: 'string',\n },\n {\n internalType: 'string',\n name: 'parameters',\n type: 'string',\n },\n {\n internalType: 'string',\n name: 'context',\n type: 'string',\n },\n ],\n internalType: 'struct Claims.ClaimInfo',\n name: 'claimInfo',\n type: 'tuple',\n },\n {\n components: [\n {\n internalType: 'bytes32',\n name: 'identifier',\n type: 'bytes32',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'uint32',\n name: 'timestampS',\n type: 'uint32',\n },\n {\n internalType: 'uint256',\n name: 'epoch',\n type: 'uint256',\n },\n ],\n internalType: 'struct Claims.CompleteClaimData',\n name: 'claimData',\n type: 'tuple',\n },\n {\n internalType: 'bytes[]',\n name: 'signatures',\n type: 'bytes[]',\n },\n ],\n name: 'assertValidEpochAndSignedClaim',\n outputs: [],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'currentEpoch',\n outputs: [\n {\n internalType: 'uint32',\n name: '',\n type: 'uint32',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'epochDurationS',\n outputs: [\n {\n internalType: 'uint32',\n name: '',\n type: 'uint32',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint256',\n name: '',\n type: 'uint256',\n },\n ],\n name: 'epochs',\n outputs: [\n {\n internalType: 'uint32',\n name: 'id',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampStart',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampEnd',\n type: 'uint32',\n },\n {\n internalType: 'uint8',\n name: 'minimumWitnessesForClaimCreation',\n type: 'uint8',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint32',\n name: 'epoch',\n type: 'uint32',\n },\n ],\n name: 'fetchEpoch',\n outputs: [\n {\n components: [\n {\n internalType: 'uint32',\n name: 'id',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampStart',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampEnd',\n type: 'uint32',\n },\n {\n components: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n internalType: 'struct Reclaim.Witness[]',\n name: 'witnesses',\n type: 'tuple[]',\n },\n {\n internalType: 'uint8',\n name: 'minimumWitnessesForClaimCreation',\n type: 'uint8',\n },\n ],\n internalType: 'struct Reclaim.Epoch',\n name: '',\n type: 'tuple',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint32',\n name: 'epoch',\n type: 'uint32',\n },\n {\n internalType: 'bytes32',\n name: 'identifier',\n type: 'bytes32',\n },\n {\n internalType: 'uint32',\n name: 'timestampS',\n type: 'uint32',\n },\n ],\n name: 'fetchWitnessesForClaim',\n outputs: [\n {\n components: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n internalType: 'struct Reclaim.Witness[]',\n name: '',\n type: 'tuple[]',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'initialize',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'minimumWitnessesForClaimCreation',\n outputs: [\n {\n internalType: 'uint8',\n name: '',\n type: 'uint8',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'owner',\n outputs: [\n {\n internalType: 'address',\n name: '',\n type: 'address',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'proxiableUUID',\n outputs: [\n {\n internalType: 'bytes32',\n name: '',\n type: 'bytes32',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'witnessAddress',\n type: 'address',\n },\n ],\n name: 'removeAsWitness',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'renounceOwnership',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'newOwner',\n type: 'address',\n },\n ],\n name: 'transferOwnership',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'bool',\n name: 'isWhitelisted',\n type: 'bool',\n },\n ],\n name: 'updateWitnessWhitelist',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'newImplementation',\n type: 'address',\n },\n ],\n name: 'upgradeTo',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'newImplementation',\n type: 'address',\n },\n {\n internalType: 'bytes',\n name: 'data',\n type: 'bytes',\n },\n ],\n name: 'upgradeToAndCall',\n outputs: [],\n stateMutability: 'payable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint256',\n name: '',\n type: 'uint256',\n },\n ],\n name: 'witnesses',\n outputs: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n] as const;\n\nexport class Reclaim__factory {\n static readonly abi = _abi;\n\n static connect(address: string, signerOrProvider: any): Contract {\n return new Contract(address, _abi, signerOrProvider);\n }\n}\n","{\n \"0x1a4\": {\n \"chainName\": \"opt-goerli\",\n \"address\": \"0xF93F605142Fb1Efad7Aa58253dDffF67775b4520\",\n \"rpcUrl\": \"https://opt-goerli.g.alchemy.com/v2/rksDkSUXd2dyk2ANy_zzODknx_AAokui\"\n }\n}\n","import type { Beacon, BeaconState } from './interfaces';\nimport { Reclaim__factory as ReclaimFactory } from './contract-types';\nimport CONTRACTS_CONFIG from './contract-types/config.json';\nimport { Contract, ethers } from 'ethers';\n\nconst DEFAULT_CHAIN_ID = 420;\n\nexport function makeBeacon(chainId?: number): Beacon | undefined {\n chainId = chainId || DEFAULT_CHAIN_ID;\n const contract = getContract(chainId);\n if (contract) {\n return makeBeaconCacheable({\n async getState(epochId: number | undefined): Promise<BeaconState> {\n //@ts-ignore\n const epoch = await contract.fetchEpoch(epochId || 0);\n if (!epoch.id) {\n throw new Error(`Invalid epoch ID: ${epochId}`);\n }\n\n return {\n epoch: epoch.id,\n witnesses: epoch.witnesses.map((w: any) => ({\n id: w.addr.toLowerCase(),\n url: w.host,\n })),\n witnessesRequiredForClaim: epoch.minimumWitnessesForClaimCreation,\n nextEpochTimestampS: epoch.timestampEnd,\n };\n },\n });\n } else {\n return undefined;\n }\n}\n\nexport function makeBeaconCacheable(beacon: Beacon): Beacon {\n const cache: { [epochId: number]: Promise<BeaconState> } = {};\n\n return {\n ...beacon,\n async getState(epochId: number | undefined): Promise<BeaconState> {\n if (!epochId) {\n // TODO: add cache here\n const state = await beacon.getState();\n return state;\n }\n\n const key = epochId;\n\n if (!cache[key]) {\n cache[key] = beacon.getState(epochId);\n }\n\n return cache[key] as unknown as BeaconState;\n },\n };\n}\n\nconst existingContractsMap: { [chain: string]: Contract } = {};\n\nfunction getContract(chainId: number): Contract {\n const chainKey = `0x${chainId.toString(16)}`;\n if (!existingContractsMap[chainKey]) {\n const contractData =\n CONTRACTS_CONFIG[chainKey as keyof typeof CONTRACTS_CONFIG];\n if (!contractData) {\n throw new Error(`Unsupported chain: \"${chainKey}\"`);\n }\n\n const rpcProvider = new ethers.JsonRpcProvider(contractData.rpcUrl);\n existingContractsMap[chainKey] = ReclaimFactory.connect(\n contractData.address,\n rpcProvider\n );\n }\n\n return existingContractsMap[chainKey] as Contract;\n}\n","export const constants = {\n \"GET_PROVIDERS_BY_ID_API\": \"https://api.reclaimprotocol.org/api/applications/providers\",\n \"DEFAULT_RECLAIM_CALLBACK_URL\": 'https://api.reclaimprotocol.org/api/sdk/callback?callbackId=',\n \"DEFAULT_RECLAIM_STATUS_URL\": 'https://api.reclaimprotocol.org/api/sdk/session/',\n \"RECLAIM_SHARE_URL\": 'https://share.reclaimprotocol.org/instant/?template=',\n};","\n\nexport class TimeoutError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'TimeoutError'\n }\n}\n\n\nexport class ProofNotVerifiedError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'ProofNotVerifiedError'\n }\n}\n\nexport class SessionNotStartedError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'SessionNotStartedError'\n }\n}\n\nexport class ProviderAPIError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'ProviderAPIError'\n }\n}\n\nexport class BuildProofRequestError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'BuildProofRequest'\n }\n}\n\nexport class SignatureGeneratingError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'SignatureGeneratingError'\n }\n}\n\nexport class SignatureNotFoundError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'SignatureNotFound'\n }\n}\n\nexport class InvalidSignatureError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'InvalidSignatureError'\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;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AAEP,aAAK,UAAU,IAAI,KAAK,WAAW,QAAQ;AAC3C,aAAK,2BAA2B,iBAAiB;AAAA,MACnD,OAAO;AACL,cAAM,UACJ;AACF,eAAO,MAAM,OAAO;AACpB,cAAM,IAAI,uBAAuB,OAAO;AAAA,MAC1C;AAAA,IACF;AAAA;AAAA,EAEA,2BAA4B,mBAAsC;AAChE,eAAW,MAAM;AACf,UAAI,KAAK,UAAU,IAAI,KAAK,SAAS,GAAG;AACtC,cAAM,UAAU;AAEhB,0BAAkB,IAAI,aAAa,OAAO,CAAC;AAC3C,eAAO,KAAK,OAAO;AACnB,sBAAc,KAAK,UAAU,IAAI,KAAK,SAAU,CAAC;AAAA,MACnD;AAAA,IACF,GAAG,MAAO,KAAK,CAAC;AAAA,EAClB;AACF;AArPK,IAAM,UAAN;","names":["import_ethers","import_canonicalize","import_ethers","import_ethers","import_ethers","canonicalize","P","canonicalize"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/witness.ts","../src/Reclaim.ts","../src/utils.ts","../src/contract-types/contracts/factories/Reclaim__factory.ts","../src/contract-types/config.json","../src/smart-contract.ts","../src/constants.ts","../src/errors.ts"],"sourcesContent":["export * from './Reclaim';\nexport * from './interfaces';","import { ethers } from 'ethers';\nimport type { WitnessData } from './interfaces';\nimport type { ClaimID, ClaimInfo, CompleteClaimData } from './types';\n\ntype BeaconState = {\n witnesses: WitnessData[];\n epoch: number;\n witnessesRequiredForClaim: number;\n nextEpochTimestampS: number;\n};\n\nexport function fetchWitnessListForClaim(\n { witnesses, witnessesRequiredForClaim, epoch }: BeaconState,\n params: string | ClaimInfo,\n timestampS: number\n) {\n const identifier =\n typeof params === 'string' ? params : getIdentifierFromClaimInfo(params);\n const completeInput = [\n identifier,\n epoch.toString(),\n witnessesRequiredForClaim.toString(),\n timestampS.toString(),\n ].join('\\n');\n const completeHashStr = ethers.keccak256(strToUint8Array(completeInput));\n const completeHash = ethers.getBytes(completeHashStr);\n const completeHashView = uint8ArrayToDataView(completeHash);\n const witnessesLeft = [...witnesses];\n const selectedWitnesses: WitnessData[] = [];\n // we'll use 32 bits of the hash to select\n // each witness\n let byteOffset = 0;\n for (let i = 0; i < witnessesRequiredForClaim; i++) {\n const randomSeed = completeHashView.getUint32(byteOffset);\n const witnessIndex = randomSeed % witnessesLeft.length;\n const witness = witnessesLeft[witnessIndex] as WitnessData;\n selectedWitnesses.push(witness);\n\n // Remove the selected witness from the list of witnesses left\n witnessesLeft[witnessIndex] = witnessesLeft[\n witnessesLeft.length - 1\n ] as WitnessData;\n witnessesLeft.pop();\n byteOffset = (byteOffset + 4) % completeHash.length;\n }\n\n return selectedWitnesses;\n}\n\nexport function getIdentifierFromClaimInfo(info: ClaimInfo): ClaimID {\n const str = `${info.provider}\\n${info.parameters}\\n${info.context || ''}`;\n return ethers.keccak256(strToUint8Array(str)).toLowerCase();\n}\n\nexport function strToUint8Array(str: string) {\n return new TextEncoder().encode(str);\n}\n\nexport function uint8ArrayToDataView(arr: Uint8Array) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\nexport function createSignDataForClaim(data: CompleteClaimData) {\n const identifier =\n 'identifier' in data ? data.identifier : getIdentifierFromClaimInfo(data);\n const lines = [\n identifier,\n data.owner.toLowerCase(),\n data.timestampS.toString(),\n data.epoch.toString(),\n ];\n\n return lines.join('\\n');\n}\n","import type { Proof, RequestedProofs, Context } from './interfaces'\nimport { getIdentifierFromClaimInfo } from './witness'\nimport type {\n AppCallbackUrl,\n ApplicationId,\n NoReturn,\n OnFailureCallback,\n SessionId,\n Signature,\n SignedClaim,\n StatusUrl,\n ProofRequestOptions,\n StartSessionParams\n} from './types'\nimport { SessionStatus } from './types'\nimport { v4 } from 'uuid'\nimport { ethers } from 'ethers'\nimport canonicalize from 'canonicalize'\nimport {\n getWitnessesForClaim,\n assertValidSignedClaim,\n getShortenedUrl,\n fetchProvidersByAppId,\n generateRequestedProofs,\n validateProviderIdsAndReturnProviders,\n validateSignature,\n replaceAll,\n validateURL,\n updateSession,\n createSession\n} from './utils'\nimport { constants } from './constants'\nimport P from 'pino'\nimport {\n BuildProofRequestError,\n InvalidParamError,\n ProofNotVerifiedError,\n ProviderFailedError,\n SessionNotStartedError,\n SignatureNotFoundError,\n TimeoutError\n} from './errors'\n\nconst logger = P()\n\nexport class Reclaim {\n static async verifySignedProof(proof: Proof) {\n if (!proof.signatures.length) {\n throw new Error('No signatures')\n }\n const witnesses = await getWitnessesForClaim(\n proof.claimData.epoch,\n proof.identifier,\n proof.claimData.timestampS\n )\n\n try {\n // then hash the claim info with the encoded ctx to get the identifier\n const calculatedIdentifier = getIdentifierFromClaimInfo({\n parameters: JSON.parse(\n canonicalize(proof.claimData.parameters) as string\n ),\n provider: proof.claimData.provider,\n context: proof.claimData.context\n })\n proof.identifier = replaceAll(proof.identifier, '\"', '')\n // check if the identifier matches the one in the proof\n if (calculatedIdentifier !== proof.identifier) {\n throw new ProofNotVerifiedError('Identifier Mismatch')\n }\n\n const signedClaim: SignedClaim = {\n claim: {\n ...proof.claimData\n },\n signatures: proof.signatures.map(signature => {\n return ethers.getBytes(signature)\n })\n }\n\n // verify the witness signature\n assertValidSignedClaim(signedClaim, witnesses)\n } catch (e: Error | unknown) {\n logger.error(e)\n return false\n }\n\n return true\n }\n static transformForOnchain(proof: Proof) {\n const claimInfoBuilder = new Map([\n ['context', proof.claimData.context],\n ['parameters', proof.claimData.parameters],\n ['provider', proof.claimData.provider],\n ]);\n const claimInfo = Object.fromEntries(claimInfoBuilder);\n const claimBuilder = new Map<string, number | string>([\n ['epoch', proof.claimData.epoch],\n ['identifier', proof.claimData.identifier],\n ['owner', proof.claimData.owner],\n ['timestampS', proof.claimData.timestampS],\n ]);\n const signedClaim = {\n claim: Object.fromEntries(claimBuilder),\n signatures: proof.signatures,\n };\n return { claimInfo, signedClaim };\n }\n static ProofRequest = class {\n applicationId: ApplicationId\n signature?: Signature\n appCallbackUrl?: AppCallbackUrl\n sessionId: SessionId\n statusUrl?: StatusUrl\n context: Context = { contextAddress: '0x0', contextMessage: '' }\n requestedProofs?: RequestedProofs\n providerId?: string\n intervals: Map<string, NodeJS.Timer> = new Map()\n\n constructor(applicationId: string, options?: ProofRequestOptions) {\n this.applicationId = applicationId\n this.sessionId = options?.sessionId || v4().toString()\n logger.level = options?.log ? 'info' : 'silent'\n logger.info(\n `Initializing client with applicationId: ${this.applicationId} and sessionId: ${this.sessionId}`\n )\n }\n\n addContext(address: string, message: string): NoReturn {\n this.context = { contextAddress: address, contextMessage: message }\n }\n\n setAppCallbackUrl(url: string): NoReturn {\n validateURL(url)\n this.appCallbackUrl = url\n }\n\n setStatusUrl(url: string): NoReturn {\n validateURL(url)\n this.statusUrl = url\n }\n\n setSignature(signature: Signature): NoReturn {\n this.signature = signature\n }\n\n getAppCallbackUrl(): AppCallbackUrl {\n return (\n this.appCallbackUrl ||\n `${constants.DEFAULT_RECLAIM_CALLBACK_URL}${this.sessionId}`\n )\n }\n\n getStatusUrl(): StatusUrl {\n return (\n this.statusUrl ||\n `${constants.DEFAULT_RECLAIM_STATUS_URL}${this.sessionId}`\n )\n }\n\n getRequestedProofs(): RequestedProofs {\n try {\n if (!this.requestedProofs) {\n throw new BuildProofRequestError(\n 'Call buildProofRequest(providerId: string) first!'\n )\n }\n return this.requestedProofs!\n } catch (err) {\n throw err\n }\n }\n\n async generateSignature(applicationSecret: string): Promise<Signature> {\n try {\n const wallet = new ethers.Wallet(applicationSecret)\n const signature: Signature = (await wallet.signMessage(\n ethers.getBytes(\n ethers.keccak256(\n new TextEncoder().encode(\n canonicalize(await this.getRequestedProofs())!\n )\n )\n )\n )) as unknown as Signature\n\n return signature\n } catch (err) {\n logger.error(err)\n throw new BuildProofRequestError(\n 'Error generating signature for applicationSecret: ' +\n applicationSecret\n )\n }\n }\n\n async buildProofRequest(providerId: string): Promise<RequestedProofs> {\n try {\n\n let providers = await fetchProvidersByAppId(this.applicationId)\n\n const provider = validateProviderIdsAndReturnProviders(\n providerId,\n providers\n )\n this.providerId = providerId\n this.requestedProofs = generateRequestedProofs(\n provider,\n this.context,\n this.getAppCallbackUrl(),\n this.getStatusUrl(),\n this.sessionId\n )\n\n return this.requestedProofs\n } catch (err: Error | unknown) {\n logger.error(err)\n throw new BuildProofRequestError(\n 'Something went wrong while generating proof request'\n )\n }\n }\n\n async createVerificationRequest(): Promise<{\n statusUrl: StatusUrl\n requestUrl: string\n }> {\n try {\n const requestedProofs = await this.getRequestedProofs()\n\n if (!requestedProofs) {\n throw new BuildProofRequestError(\n 'Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!'\n )\n }\n\n if (!this.signature) {\n throw new SignatureNotFoundError(\n 'Signature is not set. Use reclaim.setSignature(signature) to set the signature'\n )\n }\n\n validateSignature(requestedProofs, this.signature, this.applicationId)\n\n const templateData = {\n ...requestedProofs,\n signature: this.signature\n }\n let template = `${constants.RECLAIM_SHARE_URL}${encodeURIComponent(\n JSON.stringify(templateData)\n )}`\n template = replaceAll(template, '(', '%28')\n template = replaceAll(template, ')', '%29')\n template = await getShortenedUrl(template)\n\n await createSession(this.sessionId, this.applicationId, this.providerId!)\n return { requestUrl: template, statusUrl: this.getStatusUrl() }\n } catch (error) {\n logger.error('Error creating verification request:', error)\n throw error\n }\n }\n\n async startSession({\n onSuccessCallback,\n onFailureCallback\n }: StartSessionParams) {\n const statusUrl = this.getStatusUrl()\n if (statusUrl && this.sessionId) {\n logger.info('Starting session')\n try {\n await updateSession(this.sessionId, SessionStatus.SDK_STARTED)\n } catch (e) {\n logger.error(e)\n }\n const interval = setInterval(async () => {\n try {\n const res = await fetch(statusUrl)\n const data = await res.json()\n\n if (!data.session) return\n if (data.session.status === SessionStatus.FAILED) throw new ProviderFailedError()\n if (data.session.proofs.length === 0) return\n\n data.session.proofs.forEach(async (proof: Proof) => {\n const verified = await Reclaim.verifySignedProof(proof)\n if (!verified) {\n throw new ProofNotVerifiedError()\n }\n })\n if (onSuccessCallback) {\n try {\n await updateSession(this.sessionId, SessionStatus.SDK_RECEIVED)\n } catch (e) {\n logger.error(e)\n }\n onSuccessCallback(data.session.proofs)\n }\n clearInterval(this.intervals.get(this.sessionId!))\n this.intervals.delete(this.sessionId!)\n } catch (e) {\n if (!(e instanceof ProviderFailedError)) {\n try {\n await updateSession(this.sessionId, SessionStatus.FAILED)\n } catch (e) {\n logger.error(e)\n }\n }\n if (onFailureCallback) {\n onFailureCallback(e as Error)\n }\n clearInterval(this.intervals.get(this.sessionId!))\n this.intervals.delete(this.sessionId!)\n }\n }, 3000)\n\n this.intervals.set(this.sessionId, interval)\n this.scheduleIntervalEndingTask(onFailureCallback)\n } else {\n const message =\n \"Session can't be started due to undefined value of statusUrl and sessionId\"\n logger.error(message)\n throw new SessionNotStartedError(message)\n }\n }\n\n scheduleIntervalEndingTask(onFailureCallback: OnFailureCallback) {\n setTimeout(async () => {\n if (this.intervals.has(this.sessionId)) {\n const message = 'Interval ended without receiveing proofs'\n await updateSession(this.sessionId, SessionStatus.FAILED)\n onFailureCallback(new TimeoutError(message))\n logger.warn(message)\n clearInterval(this.intervals.get(this.sessionId!))\n }\n }, 1000 * 60 * 5)\n }\n\n availableParams(): string[] {\n const requestedProofs = this.getRequestedProofs();\n\n if (!requestedProofs || !this.requestedProofs) {\n throw new BuildProofRequestError(\n 'Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!'\n );\n }\n return Object.keys(requestedProofs.claims[0].payload.parameters)\n }\n\n setParams(params: { [key: string]: string }): NoReturn {\n try {\n const requestedProofs = this.getRequestedProofs();\n\n if (!requestedProofs || !this.requestedProofs) {\n throw new BuildProofRequestError(\n 'Requested proofs are not built yet. Call buildProofRequest(providerId: string) first!'\n );\n }\n const availableParams = this.availableParams()\n const paramsToSet = Object.keys(params)\n for (let i = 0; i < paramsToSet.length; i++) {\n if (!availableParams.includes(paramsToSet[i])) {\n throw new InvalidParamError(\n `Cannot Set parameter ${paramsToSet[i]} for provider ${this.providerId} available Prameters inculde : ${availableParams}`\n );\n }\n }\n this.requestedProofs.claims[0].payload.parameters = { ...requestedProofs.claims[0].payload.parameters, ...params }\n\n } catch (error) {\n logger.error('Error Setting Params:', error);\n throw error;\n }\n }\n }\n}\n","import URL from 'url-parse'\nimport type { ApplicationId, ParsedURL, SignedClaim, Signature, SessionStatus } from './types'\nimport type { Context, ProviderV2, RequestedClaim, RequestedProofs, WitnessData } from './interfaces'\nimport { ethers } from 'ethers'\nimport { makeBeacon } from './smart-contract'\nimport { fetchWitnessListForClaim, createSignDataForClaim } from './witness'\nimport canonicalize from 'canonicalize'\nimport { BACKEND_BASE_URL, constants } from './constants'\nimport { CreateSessionError, InvalidSignatureError, ProofNotVerifiedError, ProviderAPIError, UpdateSessionError } from './errors'\n\n/*\n URL utils\n*/\nexport function parse(url: string): ParsedURL {\n validateURL(url)\n\n const parsed = URL(url, /* parseQueryString */ true)\n\n for (const param in parsed.query) {\n parsed.query[param] = decodeURIComponent(parsed.query[param]!)\n }\n const queryParams = parsed.query\n\n let path = parsed.pathname || null\n let hostname = parsed.hostname || null\n let scheme = parsed.protocol || null\n\n if (scheme) {\n // Remove colon at end\n scheme = scheme.substring(0, scheme.length - 1)\n }\n\n return {\n hostname,\n path,\n queryParams,\n scheme\n }\n}\n\nexport function validateURL(url: string): void {\n if (typeof url !== 'string') {\n throw new Error(`Invalid URL: ${url}. URL must be a string.`)\n }\n if (!url) {\n throw new Error(`Invalid URL: ${url}. URL cannot be empty`)\n }\n}\n\n/*\n Witness Utils\n*/\n\nexport async function getWitnessesForClaim(\n epoch: number,\n identifier: string,\n timestampS: number\n) {\n const beacon = makeBeacon()\n if (!beacon) throw new Error('No beacon')\n const state = await beacon.getState(epoch)\n const witnessList = fetchWitnessListForClaim(state, identifier, timestampS)\n return witnessList.map((w: WitnessData) => w.id.toLowerCase())\n}\n\n/*\n Proof Utils\n*/\n\n/** recovers the addresses of those that signed the claim */\nexport function recoverSignersOfSignedClaim({\n claim,\n signatures\n}: SignedClaim) {\n const dataStr = createSignDataForClaim({ ...claim })\n return signatures.map(signature =>\n ethers.verifyMessage(dataStr, ethers.hexlify(signature)).toLowerCase()\n )\n}\n\n/**\n * Asserts that the claim is signed by the expected witnesses\n * @param claim\n * @param expectedWitnessAddresses\n */\nexport function assertValidSignedClaim(\n claim: SignedClaim,\n expectedWitnessAddresses: string[]\n) {\n const witnessAddresses = recoverSignersOfSignedClaim(claim)\n // set of witnesses whose signatures we've not seen\n const witnessesNotSeen = new Set(expectedWitnessAddresses)\n for (const witness of witnessAddresses) {\n if (witnessesNotSeen.has(witness)) {\n witnessesNotSeen.delete(witness)\n }\n }\n\n // check if all witnesses have signed\n if (witnessesNotSeen.size > 0) {\n throw new ProofNotVerifiedError(\n `Missing signatures from ${expectedWitnessAddresses.join(', ')}`\n )\n }\n}\n\nexport async function getShortenedUrl(url: string) {\n try {\n const response = await fetch(BACKEND_BASE_URL + '/api/sdk/shortener', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n fullUrl: url\n })\n })\n const res = await response.json()\n const shortenedVerificationUrl = res.result.shortUrl\n return shortenedVerificationUrl\n } catch (err) {\n return url\n }\n}\n\nexport async function createSession(sessionId: string, appId: string, providerId: string) {\n try {\n const response = await fetch(BACKEND_BASE_URL + '/api/sdk/create-session/', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n sessionId,\n appId,\n providerId\n })\n })\n if (!response.ok) {\n throw new CreateSessionError('Error creating session with sessionId: ' + sessionId)\n }\n const res = await response.json()\n return res\n } catch (err) {\n throw new CreateSessionError('Error creating session with sessionId: ' + sessionId)\n }\n}\n\nexport async function updateSession(sessionId: string, status: SessionStatus) {\n try {\n const response = await fetch(BACKEND_BASE_URL + '/api/sdk/update-session/', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n sessionId,\n status\n })\n })\n if (!response.ok) {\n throw new UpdateSessionError('Error updating session with sessionId: ' + sessionId)\n }\n const res = await response.json()\n return res\n } catch (err) {\n throw new UpdateSessionError('Error updating session with sessionId: ' + sessionId)\n }\n}\n\nexport async function fetchProvidersByAppId(appId: string) {\n try {\n const response = await fetch(`${constants.GET_PROVIDERS_BY_ID_API}/${appId}`)\n const res = await response.json()\n return res.providers.httpProvider\n } catch (err) {\n throw new ProviderAPIError('Error fetching provider with AppId: ' + appId)\n }\n}\n\nexport function validateProviderIdsAndReturnProviders(providerId: string, providers: ProviderV2[]): ProviderV2 {\n let providerExists = providers.some(provider => providerId == provider.httpProviderId)\n if (!providerExists) {\n throw new ProviderAPIError(`The following provider Id is not included in your application => ${providerId}`)\n }\n return providers.find(provider => providerId == provider.httpProviderId) as ProviderV2\n}\n\nexport function generateRequestedProofs(provider: ProviderV2, context: Context, callbackUrl: string, statusUrl: string, sessionId: string): RequestedProofs {\n const providerParams: { [key: string]: string | undefined } = {}\n provider.responseSelections.forEach(rs => rs.responseMatch.split(/{{(.*?)}}/).filter((e, i) => i % 2).forEach(param => providerParams[param] = undefined))\n const claims = [{\n provider: encodeURIComponent(provider.name),\n context: JSON.stringify(context),\n templateClaimId: provider.id,\n payload: {\n metadata: {\n name: encodeURIComponent(provider.name),\n logoUrl: provider.logoUrl,\n proofCardText: provider.proofCardText,\n proofCardTitle: provider.proofCardTitle,\n },\n url: provider.url,\n urlType: provider.urlType as \"CONSTANT\" | \"REGEX\",\n method: provider.method as \"GET\" | \"POST\",\n login: {\n url: provider.loginUrl\n },\n responseSelections: provider.responseSelections,\n customInjection: provider.customInjection,\n bodySniff: provider.bodySniff,\n userAgent: provider.userAgent,\n geoLocation: provider.geoLocation,\n matchType: provider.matchType,\n injectionType: provider.injectionType,\n disableRequestReplay: provider.disableRequestReplay,\n parameters: providerParams\n }\n }] as RequestedClaim[];\n\n\n return {\n id: sessionId,\n sessionId: sessionId,\n name: 'web-SDK',\n callbackUrl: callbackUrl,\n statusUrl: statusUrl,\n claims: claims\n };\n}\n\nexport function validateSignature(requestedProofs: RequestedProofs, signature: Signature, applicationId: ApplicationId) {\n try {\n const appId = ethers\n .verifyMessage(\n ethers.getBytes(\n ethers.keccak256(\n new TextEncoder().encode(canonicalize(requestedProofs)!)\n )\n ),\n ethers.hexlify(signature as unknown as string)\n )\n .toLowerCase()\n\n if (ethers.getAddress(appId) !== ethers.getAddress(applicationId)) {\n throw new InvalidSignatureError(`Signature does not match the application id: ${appId}`)\n }\n } catch (err) {\n throw err\n }\n}\n\nexport function escapeRegExp(string: string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nexport function replaceAll(str: string, find: string, replace: string) {\n return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);\n}","/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n\nimport { Contract } from 'ethers';\n\nconst _abi = [\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: 'address',\n name: 'previousAdmin',\n type: 'address',\n },\n {\n indexed: false,\n internalType: 'address',\n name: 'newAdmin',\n type: 'address',\n },\n ],\n name: 'AdminChanged',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: 'address',\n name: 'beacon',\n type: 'address',\n },\n ],\n name: 'BeaconUpgraded',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n components: [\n {\n internalType: 'uint32',\n name: 'id',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampStart',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampEnd',\n type: 'uint32',\n },\n {\n components: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n internalType: 'struct Reclaim.Witness[]',\n name: 'witnesses',\n type: 'tuple[]',\n },\n {\n internalType: 'uint8',\n name: 'minimumWitnessesForClaimCreation',\n type: 'uint8',\n },\n ],\n indexed: false,\n internalType: 'struct Reclaim.Epoch',\n name: 'epoch',\n type: 'tuple',\n },\n ],\n name: 'EpochAdded',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: 'uint8',\n name: 'version',\n type: 'uint8',\n },\n ],\n name: 'Initialized',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: 'address',\n name: 'previousOwner',\n type: 'address',\n },\n {\n indexed: true,\n internalType: 'address',\n name: 'newOwner',\n type: 'address',\n },\n ],\n name: 'OwnershipTransferred',\n type: 'event',\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: 'address',\n name: 'implementation',\n type: 'address',\n },\n ],\n name: 'Upgraded',\n type: 'event',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'witnessAddress',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n name: 'addAsWitness',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'addNewEpoch',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint32',\n name: 'epochNum',\n type: 'uint32',\n },\n {\n components: [\n {\n internalType: 'string',\n name: 'provider',\n type: 'string',\n },\n {\n internalType: 'string',\n name: 'parameters',\n type: 'string',\n },\n {\n internalType: 'string',\n name: 'context',\n type: 'string',\n },\n ],\n internalType: 'struct Claims.ClaimInfo',\n name: 'claimInfo',\n type: 'tuple',\n },\n {\n components: [\n {\n internalType: 'bytes32',\n name: 'identifier',\n type: 'bytes32',\n },\n {\n internalType: 'address',\n name: 'owner',\n type: 'address',\n },\n {\n internalType: 'uint32',\n name: 'timestampS',\n type: 'uint32',\n },\n {\n internalType: 'uint256',\n name: 'epoch',\n type: 'uint256',\n },\n ],\n internalType: 'struct Claims.CompleteClaimData',\n name: 'claimData',\n type: 'tuple',\n },\n {\n internalType: 'bytes[]',\n name: 'signatures',\n type: 'bytes[]',\n },\n ],\n name: 'assertValidEpochAndSignedClaim',\n outputs: [],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'currentEpoch',\n outputs: [\n {\n internalType: 'uint32',\n name: '',\n type: 'uint32',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'epochDurationS',\n outputs: [\n {\n internalType: 'uint32',\n name: '',\n type: 'uint32',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint256',\n name: '',\n type: 'uint256',\n },\n ],\n name: 'epochs',\n outputs: [\n {\n internalType: 'uint32',\n name: 'id',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampStart',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampEnd',\n type: 'uint32',\n },\n {\n internalType: 'uint8',\n name: 'minimumWitnessesForClaimCreation',\n type: 'uint8',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint32',\n name: 'epoch',\n type: 'uint32',\n },\n ],\n name: 'fetchEpoch',\n outputs: [\n {\n components: [\n {\n internalType: 'uint32',\n name: 'id',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampStart',\n type: 'uint32',\n },\n {\n internalType: 'uint32',\n name: 'timestampEnd',\n type: 'uint32',\n },\n {\n components: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n internalType: 'struct Reclaim.Witness[]',\n name: 'witnesses',\n type: 'tuple[]',\n },\n {\n internalType: 'uint8',\n name: 'minimumWitnessesForClaimCreation',\n type: 'uint8',\n },\n ],\n internalType: 'struct Reclaim.Epoch',\n name: '',\n type: 'tuple',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint32',\n name: 'epoch',\n type: 'uint32',\n },\n {\n internalType: 'bytes32',\n name: 'identifier',\n type: 'bytes32',\n },\n {\n internalType: 'uint32',\n name: 'timestampS',\n type: 'uint32',\n },\n ],\n name: 'fetchWitnessesForClaim',\n outputs: [\n {\n components: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n internalType: 'struct Reclaim.Witness[]',\n name: '',\n type: 'tuple[]',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'initialize',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'minimumWitnessesForClaimCreation',\n outputs: [\n {\n internalType: 'uint8',\n name: '',\n type: 'uint8',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'owner',\n outputs: [\n {\n internalType: 'address',\n name: '',\n type: 'address',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [],\n name: 'proxiableUUID',\n outputs: [\n {\n internalType: 'bytes32',\n name: '',\n type: 'bytes32',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'witnessAddress',\n type: 'address',\n },\n ],\n name: 'removeAsWitness',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [],\n name: 'renounceOwnership',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'newOwner',\n type: 'address',\n },\n ],\n name: 'transferOwnership',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'bool',\n name: 'isWhitelisted',\n type: 'bool',\n },\n ],\n name: 'updateWitnessWhitelist',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'newImplementation',\n type: 'address',\n },\n ],\n name: 'upgradeTo',\n outputs: [],\n stateMutability: 'nonpayable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'address',\n name: 'newImplementation',\n type: 'address',\n },\n {\n internalType: 'bytes',\n name: 'data',\n type: 'bytes',\n },\n ],\n name: 'upgradeToAndCall',\n outputs: [],\n stateMutability: 'payable',\n type: 'function',\n },\n {\n inputs: [\n {\n internalType: 'uint256',\n name: '',\n type: 'uint256',\n },\n ],\n name: 'witnesses',\n outputs: [\n {\n internalType: 'address',\n name: 'addr',\n type: 'address',\n },\n {\n internalType: 'string',\n name: 'host',\n type: 'string',\n },\n ],\n stateMutability: 'view',\n type: 'function',\n },\n] as const;\n\nexport class Reclaim__factory {\n static readonly abi = _abi;\n\n static connect(address: string, signerOrProvider: any): Contract {\n return new Contract(address, _abi, signerOrProvider);\n }\n}\n","{\n \"0x1a4\": {\n \"chainName\": \"opt-goerli\",\n \"address\": \"0xF93F605142Fb1Efad7Aa58253dDffF67775b4520\",\n \"rpcUrl\": \"https://opt-goerli.g.alchemy.com/v2/rksDkSUXd2dyk2ANy_zzODknx_AAokui\"\n },\n \"0xaa37dc\": {\n \"chainName\": \"opt-sepolia\",\n \"address\": \"0x6D0f81BDA11995f25921aAd5B43359630E65Ca96\",\n \"rpcUrl\": \"https://opt-sepolia.g.alchemy.com/v2/aO1-SfG4oFRLyAiLREqzyAUu0HTCwHgs\"\n}\n\n}\n","import type { Beacon, BeaconState } from './interfaces';\nimport { Reclaim__factory as ReclaimFactory } from './contract-types';\nimport CONTRACTS_CONFIG from './contract-types/config.json';\nimport { Contract, ethers } from 'ethers';\n\nconst DEFAULT_CHAIN_ID = 11155111;\n\nexport function makeBeacon(chainId?: number): Beacon | undefined {\n chainId = chainId || DEFAULT_CHAIN_ID;\n const contract = getContract(chainId);\n if (contract) {\n return makeBeaconCacheable({\n async getState(epochId: number | undefined): Promise<BeaconState> {\n //@ts-ignore\n const epoch = await contract.fetchEpoch(epochId || 0);\n if (!epoch.id) {\n throw new Error(`Invalid epoch ID: ${epochId}`);\n }\n\n return {\n epoch: epoch.id,\n witnesses: epoch.witnesses.map((w: any) => ({\n id: w.addr.toLowerCase(),\n url: w.host,\n })),\n witnessesRequiredForClaim: epoch.minimumWitnessesForClaimCreation,\n nextEpochTimestampS: epoch.timestampEnd,\n };\n },\n });\n } else {\n return undefined;\n }\n}\n\nexport function makeBeaconCacheable(beacon: Beacon): Beacon {\n const cache: { [epochId: number]: Promise<BeaconState> } = {};\n\n return {\n ...beacon,\n async getState(epochId: number | undefined): Promise<BeaconState> {\n if (!epochId) {\n // TODO: add cache here\n const state = await beacon.getState();\n return state;\n }\n\n const key = epochId;\n\n if (!cache[key]) {\n cache[key] = beacon.getState(epochId);\n }\n\n return cache[key] as unknown as BeaconState;\n },\n };\n}\n\nconst existingContractsMap: { [chain: string]: Contract } = {};\n\nfunction getContract(chainId: number): Contract {\n const chainKey = `0x${chainId.toString(16)}`;\n if (!existingContractsMap[chainKey]) {\n const contractData =\n CONTRACTS_CONFIG[chainKey as keyof typeof CONTRACTS_CONFIG];\n if (!contractData) {\n throw new Error(`Unsupported chain: \"${chainKey}\"`);\n }\n\n const rpcProvider = new ethers.JsonRpcProvider(contractData.rpcUrl);\n existingContractsMap[chainKey] = ReclaimFactory.connect(\n contractData.address,\n rpcProvider\n );\n }\n\n return existingContractsMap[chainKey] as Contract;\n}\n","// export const BACKEND_BASE_URL = \"http://localhost:3003\"\nexport const BACKEND_BASE_URL = \"https://api.reclaimprotocol.org\"\nexport const constants = {\n GET_PROVIDERS_BY_ID_API:\n BACKEND_BASE_URL + '/api/applications/providers',\n DEFAULT_RECLAIM_CALLBACK_URL:\n BACKEND_BASE_URL + '/api/sdk/callback?callbackId=',\n DEFAULT_RECLAIM_STATUS_URL:\n BACKEND_BASE_URL + '/api/sdk/session/',\n RECLAIM_SHARE_URL: 'https://share.reclaimprotocol.org/instant/?template=',\n};\n","\n\nexport class TimeoutError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'TimeoutError'\n }\n}\n\n\nexport class ProofNotVerifiedError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'ProofNotVerifiedError'\n }\n}\n\nexport class SessionNotStartedError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'SessionNotStartedError'\n }\n}\n\nexport class ProviderAPIError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'ProviderAPIError'\n }\n}\n\nexport class BuildProofRequestError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'BuildProofRequest'\n }\n}\n\nexport class SignatureGeneratingError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'SignatureGeneratingError'\n }\n}\n\nexport class SignatureNotFoundError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'SignatureNotFound'\n }\n}\n\nexport class InvalidSignatureError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'InvalidSignatureError'\n }\n}\n\n\nexport class UpdateSessionError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'UpdateSessionError'\n }\n}\n\nexport class CreateSessionError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'CreateSessionError'\n }\n}\n\nexport class ProviderFailedError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'ProviderFailedError'\n }\n}\nexport class InvalidParamError extends Error {\n constructor(message?: string) {\n super(message)\n this.name = 'InvalidParamError'\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAuB;AAWhB,SAAS,yBACd,EAAE,WAAW,2BAA2B,MAAM,GAC9C,QACA,YACA;AACA,QAAM,aACJ,OAAO,WAAW,WAAW,SAAS,2BAA2B,MAAM;AACzE,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA,MAAM,SAAS;AAAA,IACf,0BAA0B,SAAS;AAAA,IACnC,WAAW,SAAS;AAAA,EACtB,EAAE,KAAK,IAAI;AACX,QAAM,kBAAkB,qBAAO,UAAU,gBAAgB,aAAa,CAAC;AACvE,QAAM,eAAe,qBAAO,SAAS,eAAe;AACpD,QAAM,mBAAmB,q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,kCAAkC,eAAe;AAAA,UAC3H;AAAA,QACJ;AAAA,MACJ;AACA,WAAK,gBAAgB,OAAO,CAAC,EAAE,QAAQ,aAAa,kCAAK,gBAAgB,OAAO,CAAC,EAAE,QAAQ,aAAe;AAAA,IAE9G,SAAS,OAAO;AACZ,aAAO,MAAM,yBAAyB,KAAK;AAC3C,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;AAzUG,IAAM,UAAN;","names":["import_ethers","import_canonicalize","import_ethers","import_ethers","import_ethers","canonicalize","P","canonicalize","e"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reclaimprotocol/js-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Designed to request proofs from the Reclaim protocol and manage the flow of claims and witness interactions.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Do not edit this file with editors other than draw.io -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="413px" height="137px" viewBox="-0.5 -0.5 413 137" content="&lt;mxfile host=&quot;app.diagrams.net&quot; modified=&quot;2023-12-12T10:56:37.870Z&quot; agent=&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36&quot; etag=&quot;5c-IEuCihH7OA-rWiBcE&quot; version=&quot;22.1.7&quot; type=&quot;google&quot;&gt;&lt;diagram name=&quot;Page-1&quot; id=&quot;Bim3TOI_uKPudQwilAti&quot;&gt;zZbLjtsgFIafxstGBwO+LJvMdCpVlapm0XZJbRqjcUyEya1PXzxAbIaZKholTZXEsX8OmPP93BK8WB8eFNs0n2XN2ySF+pDguyRNUVZm5m9Qjl7JcquslKidNgpL8Zs7EZy6FTXvg0AtZavFJhQr2XW80oHGlJL7MOyXbMO3btiKR8KyYm2sfhO1bqxapPmof+Ri1fg3m5RtyZr5YJdJ37Ba7icSvk/wQkmp7d36sODtQM9zsfU+vFJ66pjinT6nQmor7Fi7dbl95VXLxNqIy7tPrpP66DPfN0Lz5YZVw/Pe2Jvgea+VfDyBMCnM4164ju240vwwkVyvHrhcc62OJsSXUmKr7EfAuePbTNhiF8acpatTS2PW5sYl/jIEHEHYmgF2w9yxS9TPD4CIBULoOjBIBKNineyEGf3DPLwZlLSEM6DAdaDQCArXDVf97XC8QzfE4dud8IhIVFu140M8ekLAlH4/rLxGMKPJxMx5V3vlZyurx0E6CP3dPMOMApQII1JiCpm5usIfrj3DTR1PkRnGhNDSfn3pEAp/Y93Lrap4sAyaXq6452QlXgdbQeyH4i3TYhfuDC/BfapqMmbHScBGik73EftT++fZga5rB5oBIJICoe6TTeyAWZFCaRZnXOA8z7LQHVKWeUlzioxHZZFZIy9hD/nH9riWvwzCOAsxCWdhDs+stA2+2dh4e77wPAMAArQgBFF/zQNzSwQpzjAYk81MpPi5vXlOswKMscMPXcpd+l+4S0Nz3SHujeaax/FYZ8PH0zG+/wM=&lt;/diagram&gt;&lt;/mxfile&gt;" style="background-color: rgb(255, 255, 255);"><defs/><g><rect x="165" y="1" width="77" height="34" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-width="2" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 75px; height: 1px; padding-top: 18px; margin-left: 166px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Reclaim SDK</div></div></div></foreignObject><text x="204" y="22" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">Reclaim SDK</text></switch></g><rect x="148" y="101" width="111" height="34" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-width="2" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 109px; height: 1px; padding-top: 118px; margin-left: 149px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">uuid</div></div></div></foreignObject><text x="203" y="122" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">uuid</text></switch></g><rect x="301" y="101" width="110" height="34" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-width="2" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 108px; height: 1px; padding-top: 118px; margin-left: 302px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">canonicalize</div></div></div></foreignObject><text x="356" y="122" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">canonicalize</text></switch></g><rect x="1" y="101" width="110" height="34" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-width="2" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 108px; height: 1px; padding-top: 118px; margin-left: 2px;"><div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">ethers</div></div></div></foreignObject><text x="56" y="122" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">ethers</text></switch></g><path d="M 203.57 35 Q 203.57 35 203.57 92.88" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 203.57 99.88 L 200.07 92.88 L 207.07 92.88 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><path d="M 242 28.88 Q 351 71 354.65 92.99" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 355.79 99.9 L 351.2 93.56 L 358.1 92.42 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><path d="M 165 31.96 Q 61 70 57.11 93" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 55.94 99.9 L 53.66 92.41 L 60.56 93.58 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
@@ -1 +0,0 @@
1
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1039" height="762"><desc>participant%20AppClip%2FInstanApp%0Aparticipant%20User%0Aparticipant%20SDK%20Sample%20Web%20App%0Aparticipant%20Reclaim%20SDK%0A%0AUser-%3ESDK%20Sample%20Web%20App%3A%20ask%20to%20provide%20proof%0A%0ASDK%20Sample%20Web%20App-%3EReclaim%20SDK%3A%20requestProof(request%2C%20AppCallbackUrl)%0Aactivate%20Reclaim%20SDK%0AReclaim%20SDK-%3EReclaim%20SDK%3A%20Validate%20request%0AReclaim%20SDK-%3EReclaim%20SDK%3A%20Generate%20Template%20Instance%0AReclaim%20SDK--%3ESDK%20Sample%20Web%20App%3A%20TemplateInstance%0Adeactivate%20Reclaim%20SDK%0ASDK%20Sample%20Web%20App-%3ESDK%20Sample%20Web%20App%3A%20Generate%20QrCode%20from%20template%0A%0AUser--%3ESDK%20Sample%20Web%20App%3A%20Scan%20QrCode%0A%0ASDK%20Sample%20Web%20App--%3EAppClip%2FInstanApp%3A%20Open%20AppClip%2FInstanApp%0A%0AAppClip%2FInstanApp-%3EAppClip%2FInstanApp%3A%20complete%20verification%20task%0A%0AAppClip%2FInstanApp-%3ESDK%20Sample%20Web%20App%3A%20Submit%20Proof%20using%20AppCallbackUrl%0A%0ASDK%20Sample%20Web%20App--%3EUser%3A%20notify%20user%20(proof%20received)%0A</desc><defs/><g><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g><rect fill="white" stroke="none" x="0" y="0" width="1039" height="762"/></g><g/><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 59.284222437999986 L 88.59873290331642 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 59.284222437999986 L 285.4386060077435 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 59.284222437999986 L 506.7163531173789 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 814.1986855920534 59.284222437999986 L 814.1986855920534 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/></g><g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 8.795878700000003 11.786477457999997 L 168.40158710663283 11.786477457999997 L 168.40158710663283 59.284222437999986 L 8.795878700000003 59.284222437999986 L 8.795878700000003 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="27.88293547900001" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">AppClip/InstanApp</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 250.87553604514974 11.786477457999997 L 320.00167597033726 11.786477457999997 L 320.00167597033726 59.284222437999986 L 250.87553604514974 59.284222437999986 L 250.87553604514974 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="269.96259282414974" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">User</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 413.6099863408203 11.786477457999997 L 599.8227198939375 11.786477457999997 L 599.8227198939375 59.284222437999986 L 413.6099863408203 59.284222437999986 L 413.6099863408203 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="432.6970431198203" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">SDK Sample Web App</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 751.5289643233073 11.786477457999997 L 876.8684068607995 11.786477457999997 L 876.8684068607995 59.284222437999986 L 751.5289643233073 59.284222437999986 L 751.5289643233073 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="770.6160211023073" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Reclaim SDK</text></g></g><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 805.4028068920534 166.593942578 L 822.9945642920534 166.593942578 L 822.9945642920534 360.103273978 L 805.4028068920534 360.103273978 L 805.4028068920534 166.593942578" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g><g><rect fill="white" stroke="none" x="329.0615110575416" y="94.46773723799998" width="134.03193701003906" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="331.70027466754163" y="110.30031889799997" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">ask to provide proof</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 117.33702185799999 L 492.2324728580456 117.33702185799999" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,117.33702185799999) translate(-506.7163531173789,-117.33702185799999)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 110.00712294133332 L 506.7163531173789 117.33702185799999 L 492.05655528404554 124.66692077466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="527.5332660407123" y="143.724657958" width="257.05262792800784" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="530.1720296507123" y="159.557239618" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">requestProof(request, AppCallbackUrl)</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 166.593942578 L 790.9189266327201 166.593942578" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(805.4028068920534,166.593942578) translate(-805.4028068920534,-166.593942578)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 790.7430090587201 159.26404366133332 L 805.4028068920534 166.593942578 L 790.7430090587201 173.92384149466668 Z"/></g></g><g><g><rect fill="white" stroke="none" x="843.8114772153867" y="192.981578678" width="110.14505041335937" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="846.4502408253867" y="208.81416033800002" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Validate request</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 822.9945642920534 215.850863298 L 893.3615938920534 215.850863298 L 893.3615938920534 238.720147918 L 837.4784445513867 238.720147918" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(822.9945642920534,238.720147918) translate(-822.9945642920534,-238.720147918)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 837.6543621253867 231.39024900133333 L 822.9945642920534 238.720147918 L 837.6543621253867 246.0500468346667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="843.8114772153867" y="265.107784018" width="189.45071447585937" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="846.4502408253867" y="280.94036567800003" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Generate Template Instance</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 822.9945642920534 287.97706863800005 L 893.3615938920534 287.97706863800005 L 893.3615938920534 310.846353258 L 837.4784445513867 310.846353258" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(822.9945642920534,310.846353258) translate(-822.9945642920534,-310.846353258)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 837.6543621253867 303.5164543413334 L 822.9945642920534 310.846353258 L 837.6543621253867 318.1762521746667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="595.9691486090717" y="337.23398935800003" width="120.18086279128906" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="598.6079122190716" y="353.06657101800005" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">TemplateInstance</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 805.4028068920534 360.103273978 L 521.2002333767123 360.103273978" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(506.7163531173789,360.103273978) translate(-506.7163531173789,-360.103273978)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 521.3761509507123 352.77337506133335 L 506.7163531173789 360.103273978 L 521.3761509507123 367.43317289466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="527.5332660407123" y="386.490910078" width="215.49939001296875" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="530.1720296507123" y="402.32349173800003" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Generate QrCode from template</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 409.36019469800004 L 577.0833827173789 409.36019469800004 L 577.0833827173789 432.229479318 L 521.2002333767123 432.229479318" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,432.229479318) translate(-506.7163531173789,-432.229479318)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 521.3761509507123 424.89958040133337 L 506.7163531173789 432.229479318 L 521.3761509507123 439.55937823466667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="349.0292768656471" y="458.617115418" width="94.09640539382812" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="351.6680404756471" y="474.44969707800004" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Scan QrCode</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 481.486400038 L 492.2324728580456 481.486400038" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(506.7163531173789,481.486400038) translate(-506.7163531173789,-481.486400038)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 474.15650112133335 L 506.7163531173789 481.486400038 L 492.05655528404554 488.81629895466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="214.33519327974216" y="507.874036138" width="166.64469946121093" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="216.97395688974217" y="523.706617798" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Open AppClip/InstanApp</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 530.743320758 L 103.08261316264975 530.743320758" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(88.59873290331642,530.743320758) translate(-88.59873290331642,-530.743320758)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 103.25853073664975 523.4134218413333 L 88.59873290331642 530.743320758 L 103.25853073664975 538.0732196746667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="109.41564582664975" y="557.130956858" width="169.86584509109375" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="112.05440943664975" y="572.963538518" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">complete verification task</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 580.0002414779999 L 158.9657625033164 580.0002414779999 L 158.9657625033164 602.8695260979999 L 103.08261316264975 602.8695260979999" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(88.59873290331642,602.8695260979999) translate(-88.59873290331642,-602.8695260979999)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 103.25853073664975 595.5396271813332 L 88.59873290331642 602.8695260979999 L 103.25853073664975 610.1994250146666 Z"/></g></g><g><g><rect fill="white" stroke="none" x="180.53779948091403" y="629.257162198" width="234.23948705886718" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="183.17656309091404" y="645.0897438579999" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Submit Proof using AppCallbackUrl</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 652.126446818 L 492.2324728580456 652.126446818" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,652.126446818) translate(-506.7163531173789,-652.126446818)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 644.7965479013333 L 506.7163531173789 652.126446818 L 492.05655528404554 659.4563457346667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="306.2555189310768" y="678.514082918" width="179.64392126296875" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="308.8942825410768" y="694.346664578" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">notify user (proof received)</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 701.383367538 L 299.9224862670768 701.383367538" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(285.4386060077435,701.383367538) translate(-285.4386060077435,-701.383367538)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 300.09840384107684 694.0534686213333 L 285.4386060077435 701.383367538 L 300.09840384107684 708.7132664546667 Z"/></g></g></g><g/><g/><g/><g/></g></svg>
@@ -1 +0,0 @@
1
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1039" height="690"><desc>participant%20AppClip%2FInstanApp%0Aparticipant%20User%0Aparticipant%20SDK%20Sample%20Web%20App%0Aparticipant%20Reclaim%20SDK%0A%0AUser-%3ESDK%20Sample%20Web%20App%3A%20ask%20to%20provide%20proof%0A%0ASDK%20Sample%20Web%20App-%3EReclaim%20SDK%3A%20requestProof(request%2C%20AppCallbackUrl)%0Aactivate%20Reclaim%20SDK%0AReclaim%20SDK-%3EReclaim%20SDK%3A%20Generate%20Template%20Instance%0AReclaim%20SDK--%3ESDK%20Sample%20Web%20App%3A%20TemplateInstance%0Adeactivate%20Reclaim%20SDK%0A%0ASDK%20Sample%20Web%20App-%3ESDK%20Sample%20Web%20App%3A%20Generate%20QrCode%20from%20template%0A%0AUser--%3ESDK%20Sample%20Web%20App%3A%20Scan%20QrCode%0A%0ASDK%20Sample%20Web%20App--%3EAppClip%2FInstanApp%3A%20Open%20AppClip%2FInstanApp%0A%0AAppClip%2FInstanApp-%3EAppClip%2FInstanApp%3A%20complete%20verification%20task%0A%0AAppClip%2FInstanApp-%3ESDK%20Sample%20Web%20App%3A%20Submit%20Proof%20using%20AppCallbackUrl%0A%0ASDK%20Sample%20Web%20App--%3EUser%3A%20notify%20user%20(proof%20received)%0A</desc><defs/><g><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g><rect fill="white" stroke="none" x="0" y="0" width="1039" height="690"/></g><g/><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 59.284222437999986 L 88.59873290331642 690.8283130980001" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 59.284222437999986 L 285.4386060077435 690.8283130980001" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 59.284222437999986 L 506.7163531173789 690.8283130980001" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 814.1986855920534 59.284222437999986 L 814.1986855920534 690.8283130980001" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/></g><g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 8.795878700000003 11.786477457999997 L 168.40158710663283 11.786477457999997 L 168.40158710663283 59.284222437999986 L 8.795878700000003 59.284222437999986 L 8.795878700000003 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="27.88293547900001" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">AppClip/InstanApp</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 250.87553604514974 11.786477457999997 L 320.00167597033726 11.786477457999997 L 320.00167597033726 59.284222437999986 L 250.87553604514974 59.284222437999986 L 250.87553604514974 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="269.96259282414974" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">User</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 413.6099863408203 11.786477457999997 L 599.8227198939375 11.786477457999997 L 599.8227198939375 59.284222437999986 L 413.6099863408203 59.284222437999986 L 413.6099863408203 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="432.6970431198203" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">SDK Sample Web App</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 751.5289643233073 11.786477457999997 L 876.8684068607995 11.786477457999997 L 876.8684068607995 59.284222437999986 L 751.5289643233073 59.284222437999986 L 751.5289643233073 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="770.6160211023073" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Reclaim SDK</text></g></g><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 805.4028068920534 166.593942578 L 822.9945642920534 166.593942578 L 822.9945642920534 287.977068638 L 805.4028068920534 287.977068638 L 805.4028068920534 166.593942578" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g><g><rect fill="white" stroke="none" x="329.0615110575416" y="94.46773723799998" width="134.03193701003906" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="331.70027466754163" y="110.30031889799997" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">ask to provide proof</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 117.33702185799999 L 492.2324728580456 117.33702185799999" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,117.33702185799999) translate(-506.7163531173789,-117.33702185799999)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 110.00712294133332 L 506.7163531173789 117.33702185799999 L 492.05655528404554 124.66692077466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="527.5332660407123" y="143.724657958" width="257.05262792800784" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="530.1720296507123" y="159.557239618" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">requestProof(request, AppCallbackUrl)</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 166.593942578 L 790.9189266327201 166.593942578" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(805.4028068920534,166.593942578) translate(-805.4028068920534,-166.593942578)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 790.7430090587201 159.26404366133332 L 805.4028068920534 166.593942578 L 790.7430090587201 173.92384149466668 Z"/></g></g><g><g><rect fill="white" stroke="none" x="843.8114772153867" y="192.981578678" width="189.45071447585937" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="846.4502408253867" y="208.81416033800002" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Generate Template Instance</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 822.9945642920534 215.850863298 L 893.3615938920534 215.850863298 L 893.3615938920534 238.720147918 L 837.4784445513867 238.720147918" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(822.9945642920534,238.720147918) translate(-822.9945642920534,-238.720147918)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 837.6543621253867 231.39024900133333 L 822.9945642920534 238.720147918 L 837.6543621253867 246.0500468346667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="595.9691486090717" y="265.107784018" width="120.18086279128906" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="598.6079122190716" y="280.94036567800003" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">TemplateInstance</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 805.4028068920534 287.977068638 L 521.2002333767123 287.977068638" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(506.7163531173789,287.977068638) translate(-506.7163531173789,-287.977068638)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 521.3761509507123 280.64716972133334 L 506.7163531173789 287.977068638 L 521.3761509507123 295.30696755466664 Z"/></g></g><g><g><rect fill="white" stroke="none" x="527.5332660407123" y="314.364704738" width="215.49939001296875" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="530.1720296507123" y="330.197286398" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Generate QrCode from template</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 337.23398935800003 L 577.0833827173789 337.23398935800003 L 577.0833827173789 360.103273978 L 521.2002333767123 360.103273978" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,360.103273978) translate(-506.7163531173789,-360.103273978)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 521.3761509507123 352.77337506133335 L 506.7163531173789 360.103273978 L 521.3761509507123 367.43317289466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="349.0292768656471" y="386.490910078" width="94.09640539382812" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="351.6680404756471" y="402.32349173800003" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Scan QrCode</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 409.360194698 L 492.2324728580456 409.360194698" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(506.7163531173789,409.360194698) translate(-506.7163531173789,-409.360194698)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 402.03029578133334 L 506.7163531173789 409.360194698 L 492.05655528404554 416.69009361466664 Z"/></g></g><g><g><rect fill="white" stroke="none" x="214.33519327974216" y="435.747830798" width="166.64469946121093" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="216.97395688974217" y="451.580412458" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Open AppClip/InstanApp</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 458.61711541799997 L 103.08261316264975 458.61711541799997" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(88.59873290331642,458.61711541799997) translate(-88.59873290331642,-458.61711541799997)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 103.25853073664975 451.2872165013333 L 88.59873290331642 458.61711541799997 L 103.25853073664975 465.9470143346666 Z"/></g></g><g><g><rect fill="white" stroke="none" x="109.41564582664975" y="485.004751518" width="169.86584509109375" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="112.05440943664975" y="500.837333178" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">complete verification task</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 507.874036138 L 158.9657625033164 507.874036138 L 158.9657625033164 530.743320758 L 103.08261316264975 530.743320758" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(88.59873290331642,530.743320758) translate(-88.59873290331642,-530.743320758)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 103.25853073664975 523.4134218413333 L 88.59873290331642 530.743320758 L 103.25853073664975 538.0732196746667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="180.53779948091403" y="557.130956858" width="234.23948705886718" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="183.17656309091404" y="572.963538518" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Submit Proof using AppCallbackUrl</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 580.000241478 L 492.2324728580456 580.000241478" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,580.000241478) translate(-506.7163531173789,-580.000241478)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 572.6703425613333 L 506.7163531173789 580.000241478 L 492.05655528404554 587.3301403946667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="306.2555189310768" y="606.387877578" width="179.64392126296875" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="308.8942825410768" y="622.220459238" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">notify user (proof received)</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 629.2571621980001 L 299.9224862670768 629.2571621980001" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(285.4386060077435,629.2571621980001) translate(-285.4386060077435,-629.2571621980001)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 300.09840384107684 621.9272632813334 L 285.4386060077435 629.2571621980001 L 300.09840384107684 636.5870611146668 Z"/></g></g></g><g/><g/><g/><g/></g></svg>
@@ -1 +0,0 @@
1
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1039" height="762"><desc>%0A%0Aparticipant%20AppClip%2FInstanApp%0Aparticipant%20User%0Aparticipant%Reclaim%0Aparticipant%20Reclaim%20SDK%0A%0AUser-%3EApp%3A%20ask%20to%20provide%20proof%0A%0AApp-%3EReclaim%20SDK%3A%20requestProof(request%2C%20AppCallbackUrl)%0Aactivate%20Reclaim%20SDK%0AReclaim%20SDK-%3EReclaim%20SDK%3A%20Validate%20request%0AReclaim%20SDK-%3EReclaim%20SDK%3A%20Generate%20Template%20Instance%0AReclaim%20SDK--%3EApp%3A%20TemplateInstance%0Adeactivate%20Reclaim%20SDK%0AApp-%3EApp%3A%20Generate%20QrCode%20from%20template%0A%0A%0AUser--%3EApp%3A%20Scan%20QrCode%0A%0AApp--%3EAppClip%2FInstanApp%3A%20Open%20AppClip%2FInstanApp%0A%0AAppClip%2FInstanApp-%3EAppClip%2FInstanApp%3A%20complete%20verification%20task%0A%0A%0AAppClip%2FInstanApp-%3EApp%3A%20Submit%20Proof%20using%20AppCallbackUrl%0A%0A%0AApp--%3EUser%3A%20notify%20user%20(proof%20received)%0A</desc><defs/><g><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g/><g><rect fill="white" stroke="none" x="0" y="0" width="1039" height="762"/></g><g/><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 59.284222437999986 L 88.59873290331642 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 59.284222437999986 L 285.4386060077435 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 59.284222437999986 L 506.7163531173789 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 814.1986855920534 59.284222437999986 L 814.1986855920534 762.954518438" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="13.532121076923076,5.863919133333333"/></g><g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 8.795878700000003 11.786477457999997 L 168.40158710663283 11.786477457999997 L 168.40158710663283 59.284222437999986 L 8.795878700000003 59.284222437999986 L 8.795878700000003 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="27.88293547900001" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">AppClip/InstanApp</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 250.87553604514974 11.786477457999997 L 320.00167597033726 11.786477457999997 L 320.00167597033726 59.284222437999986 L 250.87553604514974 59.284222437999986 L 250.87553604514974 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="269.96259282414974" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">User</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 474.5870676396484 11.786477457999997 L 538.8456385951093 11.786477457999997 L 538.8456385951093 59.284222437999986 L 474.5870676396484 59.284222437999986 L 474.5870676396484 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="493.67412441864843" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">App</text></g><path fill="none" stroke="none"/><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 751.5289643233073 11.786477457999997 L 876.8684068607995 11.786477457999997 L 876.8684068607995 59.284222437999986 L 751.5289643233073 59.284222437999986 L 751.5289643233073 11.786477457999997 Z" stroke-miterlimit="10" stroke-width="2.814681184" stroke-dasharray=""/></g><g><g/><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="770.6160211023073" y="41.692465037999995" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Reclaim SDK</text></g></g><g><path fill="white" stroke="black" paint-order="fill stroke markers" d=" M 805.4028068920534 166.593942578 L 822.9945642920534 166.593942578 L 822.9945642920534 360.103273978 L 805.4028068920534 360.103273978 L 805.4028068920534 166.593942578" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g><g><rect fill="white" stroke="none" x="329.0615110575416" y="94.46773723799998" width="134.03193701003906" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="331.70027466754163" y="110.30031889799997" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">ask to provide proof</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 117.33702185799999 L 492.2324728580456 117.33702185799999" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,117.33702185799999) translate(-506.7163531173789,-117.33702185799999)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 110.00712294133332 L 506.7163531173789 117.33702185799999 L 492.05655528404554 124.66692077466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="527.5332660407123" y="143.724657958" width="257.05262792800784" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="530.1720296507123" y="159.557239618" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">requestProof(request, AppCallbackUrl)</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 166.593942578 L 790.9189266327201 166.593942578" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(805.4028068920534,166.593942578) translate(-805.4028068920534,-166.593942578)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 790.7430090587201 159.26404366133332 L 805.4028068920534 166.593942578 L 790.7430090587201 173.92384149466668 Z"/></g></g><g><g><rect fill="white" stroke="none" x="843.8114772153867" y="192.981578678" width="110.14505041335937" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="846.4502408253867" y="208.81416033800002" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Validate request</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 822.9945642920534 215.850863298 L 893.3615938920534 215.850863298 L 893.3615938920534 238.720147918 L 837.4784445513867 238.720147918" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(822.9945642920534,238.720147918) translate(-822.9945642920534,-238.720147918)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 837.6543621253867 231.39024900133333 L 822.9945642920534 238.720147918 L 837.6543621253867 246.0500468346667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="843.8114772153867" y="265.107784018" width="189.45071447585937" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="846.4502408253867" y="280.94036567800003" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Generate Template Instance</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 822.9945642920534 287.97706863800005 L 893.3615938920534 287.97706863800005 L 893.3615938920534 310.846353258 L 837.4784445513867 310.846353258" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(822.9945642920534,310.846353258) translate(-822.9945642920534,-310.846353258)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 837.6543621253867 303.5164543413334 L 822.9945642920534 310.846353258 L 837.6543621253867 318.1762521746667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="595.9691486090717" y="337.23398935800003" width="120.18086279128906" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="598.6079122190716" y="353.06657101800005" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">TemplateInstance</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 805.4028068920534 360.103273978 L 521.2002333767123 360.103273978" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(506.7163531173789,360.103273978) translate(-506.7163531173789,-360.103273978)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 521.3761509507123 352.77337506133335 L 506.7163531173789 360.103273978 L 521.3761509507123 367.43317289466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="527.5332660407123" y="386.490910078" width="215.49939001296875" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="530.1720296507123" y="402.32349173800003" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Generate QrCode from template</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 409.36019469800004 L 577.0833827173789 409.36019469800004 L 577.0833827173789 432.229479318 L 521.2002333767123 432.229479318" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,432.229479318) translate(-506.7163531173789,-432.229479318)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 521.3761509507123 424.89958040133337 L 506.7163531173789 432.229479318 L 521.3761509507123 439.55937823466667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="349.0292768656471" y="458.617115418" width="94.09640539382812" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="351.6680404756471" y="474.44969707800004" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Scan QrCode</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 285.4386060077435 481.486400038 L 492.2324728580456 481.486400038" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(506.7163531173789,481.486400038) translate(-506.7163531173789,-481.486400038)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 474.15650112133335 L 506.7163531173789 481.486400038 L 492.05655528404554 488.81629895466665 Z"/></g></g><g><g><rect fill="white" stroke="none" x="214.33519327974216" y="507.874036138" width="166.64469946121093" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="216.97395688974217" y="523.706617798" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Open AppClip/InstanApp</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 530.743320758 L 103.08261316264975 530.743320758" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(88.59873290331642,530.743320758) translate(-88.59873290331642,-530.743320758)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 103.25853073664975 523.4134218413333 L 88.59873290331642 530.743320758 L 103.25853073664975 538.0732196746667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="109.41564582664975" y="557.130956858" width="169.86584509109375" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="112.05440943664975" y="572.963538518" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">complete verification task</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 580.0002414779999 L 158.9657625033164 580.0002414779999 L 158.9657625033164 602.8695260979999 L 103.08261316264975 602.8695260979999" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(88.59873290331642,602.8695260979999) translate(-88.59873290331642,-602.8695260979999)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 103.25853073664975 595.5396271813332 L 88.59873290331642 602.8695260979999 L 103.25853073664975 610.1994250146666 Z"/></g></g><g><g><rect fill="white" stroke="none" x="180.53779948091403" y="629.257162198" width="234.23948705886718" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="183.17656309091404" y="645.0897438579999" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">Submit Proof using AppCallbackUrl</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 88.59873290331642 652.126446818 L 492.2324728580456 652.126446818" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray=""/><g transform="translate(506.7163531173789,652.126446818) translate(-506.7163531173789,-652.126446818)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 492.05655528404554 644.7965479013333 L 506.7163531173789 652.126446818 L 492.05655528404554 659.4563457346667 Z"/></g></g><g><g><rect fill="white" stroke="none" x="306.2555189310768" y="678.514082918" width="179.64392126296875" height="22.86928462"/></g><text fill="black" stroke="none" font-family="sans-serif" font-size="11pt" font-style="normal" font-weight="normal" text-decoration="normal" x="308.8942825410768" y="694.346664578" text-anchor="start" dominant-baseline="alphabetic" xml:space="preserve">notify user (proof received)</text></g><g><path fill="none" stroke="black" paint-order="fill stroke markers" d=" M 506.7163531173789 701.383367538 L 299.9224862670768 701.383367538" stroke-miterlimit="10" stroke-width="1.4659797833333332" stroke-dasharray="7.0367029599999995"/><g transform="translate(285.4386060077435,701.383367538) translate(-285.4386060077435,-701.383367538)"><path fill="black" stroke="none" paint-order="stroke fill markers" d=" M 300.09840384107684 694.0534686213333 L 285.4386060077435 701.383367538 L 300.09840384107684 708.7132664546667 Z"/></g></g></g><g/><g/><g/><g/></g></svg>