@joclaim/browser-extension-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./src/types/index";
2
+ export { default } from "./src/types/index";
package/package.json ADDED
@@ -0,0 +1,168 @@
1
+ {
2
+ "name": "@joclaim/browser-extension-sdk",
3
+ "version": "0.1.0",
4
+ "module": "build/ReclaimExtensionSDK.bundle.js",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./build/ReclaimExtensionSDK.bundle.js",
8
+ "types": "./index.d.ts"
9
+ },
10
+ "./background": "./build/background/background.bundle.js",
11
+ "./content": "./build/content/content.bundle.js",
12
+ "./offscreen": "./build/offscreen/offscreen.bundle.js",
13
+ "./interceptor/network": "./build/interceptor/network-interceptor.bundle.js",
14
+ "./interceptor/injection": "./build/interceptor/injection-scripts.bundle.js",
15
+ "./download-circuits": "./build/scripts/download-circuits.js"
16
+ },
17
+ "types": "./index.d.ts",
18
+ "files": [
19
+ "build/",
20
+ "src/types/",
21
+ "index.d.ts"
22
+ ],
23
+ "scripts": {
24
+ "prebuild": "prettier --write .",
25
+ "build": "NODE_ENV=production node webpack-build-utils/build.js",
26
+ "test": "echo \"Error: no test specified\" && exit 1",
27
+ "postinstall1": "./script.sh",
28
+ "format": "prettier --write .",
29
+ "prepublishOnly": "npm run build"
30
+ },
31
+ "keywords": [
32
+ "reclaimprotocol",
33
+ "reclaim",
34
+ "sdk",
35
+ "browser-extension-sdk",
36
+ "browser-extension",
37
+ "webextension",
38
+ "manifest-v3",
39
+ "chrome-extension",
40
+ "firefox-extension",
41
+ "content-script",
42
+ "background-service-worker",
43
+ "offscreen-document",
44
+ "zero-knowledge",
45
+ "zkp",
46
+ "proofs",
47
+ "proof-generation",
48
+ "verification",
49
+ "identity",
50
+ "attestor",
51
+ "verifiable-claims",
52
+ "network-interceptor",
53
+ "vite",
54
+ "crx",
55
+ "ethers",
56
+ "typescript"
57
+ ],
58
+ "author": "sajjad21990",
59
+ "license": "MIT",
60
+ "dependencies": {
61
+ "@extism/extism": "^1.0.3",
62
+ "@joclaim/attestor-core": "0.1.0",
63
+ "@joclaim/tls": "0.1.0",
64
+ "browserify-zlib": "^0.2.0",
65
+ "buffer": "^6.0.3",
66
+ "child_process": "^1.0.2",
67
+ "crypto-browserify": "3.12.1",
68
+ "ethers": "^6.13.1",
69
+ "jsonpath-plus": "^10.3.0",
70
+ "os-browserify": "^0.3.0",
71
+ "p-queue": "^8.0.1",
72
+ "path-browserify": "1.0.1",
73
+ "process": "^0.11.10",
74
+ "react": "^18.2.0",
75
+ "react-dom": "^18.2.0",
76
+ "react-redux": "^8.1.2",
77
+ "react-router": "^6.15.0",
78
+ "react-router-dom": "^6.15.0",
79
+ "redux": "^4.2.1",
80
+ "redux-logger": "^3.0.6",
81
+ "redux-thunk": "^2.4.2",
82
+ "@joclaim/snarkjs": "0.1.0",
83
+ "stream-browserify": "^3.0.0",
84
+ "tailwindcss": "^3.3.3",
85
+ "web-vitals": "^2.1.4",
86
+ "web3": "^4.10.0"
87
+ },
88
+ "devDependencies": {
89
+ "@babel/core": "^7.20.12",
90
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
91
+ "@babel/preset-env": "^7.20.2",
92
+ "@babel/preset-react": "^7.18.6",
93
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
94
+ "@types/chrome": "^0.0.202",
95
+ "@types/node": "^20.4.10",
96
+ "@types/react": "^18.0.26",
97
+ "@types/react-dom": "^18.0.10",
98
+ "@types/react-router-dom": "^5.3.3",
99
+ "@types/redux-logger": "^3.0.9",
100
+ "@types/webextension-polyfill": "^0.10.7",
101
+ "assert": "^2.1.0",
102
+ "babel-eslint": "^10.1.0",
103
+ "babel-loader": "^9.1.2",
104
+ "babel-preset-react-app": "^10.0.1",
105
+ "browserify-zlib": "^0.2.0",
106
+ "clean-webpack-plugin": "^4.0.0",
107
+ "constants-browserify": "^1.0.0",
108
+ "copy-webpack-plugin": "^11.0.0",
109
+ "crypto-browserify": "^3.12.0",
110
+ "css-loader": "^6.7.3",
111
+ "eslint": "^8.31.0",
112
+ "eslint-config-prettier": "^9.0.0",
113
+ "eslint-config-react-app": "^7.0.1",
114
+ "eslint-plugin-flowtype": "^8.0.3",
115
+ "eslint-plugin-import": "^2.27.4",
116
+ "eslint-plugin-jsx-a11y": "^6.7.1",
117
+ "eslint-plugin-prettier": "^5.0.0",
118
+ "eslint-plugin-react": "^7.32.0",
119
+ "eslint-plugin-react-hooks": "^4.6.0",
120
+ "file-loader": "^6.2.0",
121
+ "fs-extra": "^11.1.0",
122
+ "html-loader": "^4.2.0",
123
+ "html-webpack-plugin": "^5.5.0",
124
+ "https-browserify": "^1.0.0",
125
+ "node-polyfill-webpack-plugin": "4.1.0",
126
+ "os-browserify": "^0.3.0",
127
+ "path-browserify": "^1.0.1",
128
+ "postcss-loader": "^7.3.3",
129
+ "postcss-preset-env": "^9.1.1",
130
+ "prettier": "^3.0.2",
131
+ "react-refresh": "^0.14.0",
132
+ "react-refresh-typescript": "^2.0.7",
133
+ "sass": "^1.57.1",
134
+ "sass-loader": "^13.2.0",
135
+ "source-map-loader": "^3.0.1",
136
+ "stream-browserify": "^3.0.0",
137
+ "stream-http": "^3.2.0",
138
+ "style-loader": "^3.3.1",
139
+ "terser-webpack-plugin": "^5.3.6",
140
+ "text-encoding": "^0.7.0",
141
+ "ts-loader": "^9.4.2",
142
+ "typescript": "^4.9.4",
143
+ "url": "^0.11.3",
144
+ "util": "^0.12.5",
145
+ "vm-browserify": "^1.1.2",
146
+ "webextension-polyfill": "^0.10.0",
147
+ "webpack": "^5.75.0",
148
+ "webpack-bundle-analyzer": "^4.10.2",
149
+ "webpack-cli": "^4.10.0",
150
+ "webpack-dev-server": "5.2.2",
151
+ "webpack-ext-reloader": "^1.1.12",
152
+ "zip-webpack-plugin": "^4.0.1"
153
+ },
154
+ "overrides": {
155
+ "koffi": false,
156
+ "re2": false,
157
+ "snarkjs": false
158
+ },
159
+ "browser": {
160
+ "fs": false,
161
+ "child_process": false,
162
+ "koffi": false,
163
+ "re2": false,
164
+ "worker_threads": false,
165
+ "snarkjs": false,
166
+ "node:url": "url/"
167
+ }
168
+ }
package/readme.md ADDED
@@ -0,0 +1,436 @@
1
+ # Reclaim Protocol Browser Extension SDK — Integration Guide
2
+
3
+ Lightweight SDK to trigger Reclaim verification flows from **your website** or **your own extension UI (popup/panel)**.
4
+ It wires content ↔ background, opens the provider tab, generates proofs via an **offscreen** document (WebAssembly), and emits completion events.
5
+
6
+ > Chrome **Manifest V3** compatible (Vite/CRA builds included).
7
+
8
+ ---
9
+
10
+ ## Table of Contents
11
+
12
+ 1. [Install](#install)
13
+ 2. [One-time Asset Setup](#one-time-asset-setup)
14
+ 3. [Manifest (MV3) — Security & Permissions](#manifest-mv3--security--permissions)
15
+ 4. [Manifest (MV3) — Required Entries](#manifest-mv3--required-entries)
16
+ 5. [Load the SDK Content Bridge](#load-the-sdk-content-bridge)
17
+ 6. [Common Step (Both Approaches): Initialize Background](#common-step-both-approaches-initialize-background)
18
+ 7. [Approach 1: Use the SDK **inside your own extension** (popup/panel)](#approach-1-use-the-sdk-inside-your-own-extension-popuppanel)
19
+ 8. [Approach 2: Basic setup in your extension + **start from a web app**](#approach-2-basic-setup-in-your-extension--start-from-a-web-app)
20
+ 9. [Optional: Don’t expose keys client-side — generate a request config on your server](#optional-dont-expose-keys-client-side--generate-a-request-config-on-your-server)
21
+ 10. [Vite/CRX specifics](#vitecrx-specifics)
22
+ 11. [Troubleshooting](#troubleshooting)
23
+ 12. [Checklist](#checklist)
24
+ 13. [Types](#types)
25
+
26
+ ---
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ npm i @reclaimprotocol/browser-extension-sdk
32
+ ```
33
+
34
+ ---
35
+
36
+ ## One-time Asset Setup
37
+
38
+ Copies the SDK’s **prebuilt classic bundles** into your extension’s `public/` (so they are **not** re-bundled; Chrome content scripts must be classic, not ESM).
39
+
40
+ **package.json**
41
+
42
+ ```json
43
+ {
44
+ "scripts": {
45
+ "reclaim-extension-setup": "node node_modules/@reclaimprotocol/browser-extension-sdk/build/scripts/install-assets.js --public-dir=public"
46
+ }
47
+ }
48
+ ```
49
+
50
+ **Run**
51
+
52
+ ```bash
53
+ npm run reclaim-extension-setup
54
+ ```
55
+
56
+ This ensures the following exist in your final build (no hashing, no ESM):
57
+
58
+ - `reclaim-browser-extension-sdk/content/content.bundle.js`
59
+ - `reclaim-browser-extension-sdk/offscreen/offscreen.html`
60
+ - `reclaim-browser-extension-sdk/offscreen/offscreen.bundle.js`
61
+ - `reclaim-browser-extension-sdk/interceptor/network-interceptor.bundle.js`
62
+ - `reclaim-browser-extension-sdk/interceptor/injection-scripts.bundle.js`
63
+ - `reclaim-browser-extension-sdk/content/components/reclaim-provider-verification-popup.(css|html)`
64
+
65
+ ---
66
+
67
+ ## Manifest (MV3) — Security & Permissions
68
+
69
+ Add **before** other entries:
70
+
71
+ ```json
72
+ {
73
+ "content_security_policy": {
74
+ "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'; worker-src 'self';"
75
+ },
76
+ "host_permissions": ["<all_urls>"],
77
+ "permissions": ["offscreen", "cookies"]
78
+ }
79
+ ```
80
+
81
+ If you use **dynamic** content script registration (recommended for Vite/CRA), add `"scripting"`:
82
+
83
+ ```json
84
+ {
85
+ "permissions": ["offscreen", "cookies", "scripting"]
86
+ }
87
+ ```
88
+
89
+ **Why these:**
90
+
91
+ - **CSP** enables WebAssembly for proof generation.
92
+ - **host_permissions** lets the SDK interact with provider sites.
93
+ - **offscreen** is required for background proof generation.
94
+ - **cookies** gives access to provider auth cookies.
95
+ - **scripting** is required for **dynamic** content script registration.
96
+
97
+ ---
98
+
99
+ ## Manifest (MV3) — Required Entries
100
+
101
+ ### Web-accessible resources
102
+
103
+ ```json
104
+ {
105
+ "web_accessible_resources": [
106
+ {
107
+ "resources": [
108
+ "reclaim-browser-extension-sdk/offscreen/offscreen.html",
109
+ "reclaim-browser-extension-sdk/offscreen/offscreen.bundle.js",
110
+ "reclaim-browser-extension-sdk/interceptor/network-interceptor.bundle.js",
111
+ "reclaim-browser-extension-sdk/interceptor/injection-scripts.bundle.js",
112
+ "reclaim-browser-extension-sdk/content/components/reclaim-provider-verification-popup.css",
113
+ "reclaim-browser-extension-sdk/content/components/reclaim-provider-verification-popup.html"
114
+ ],
115
+ "matches": ["<all_urls>"]
116
+ }
117
+ ]
118
+ }
119
+ ```
120
+
121
+ **What they’re for**
122
+
123
+ - `offscreen.*`: proof generation + WebAssembly
124
+ - `interceptor/*`: network interception for provider auth
125
+ - `content/components/*`: built-in verification popup UI
126
+
127
+ ---
128
+
129
+ ## Load the SDK Content Bridge
130
+
131
+ Choose **one**: **static** (manifest) or **dynamic** (service worker).
132
+
133
+ ### Static (manifest)
134
+
135
+ ```json
136
+ {
137
+ "content_scripts": [
138
+ {
139
+ "js": ["reclaim-browser-extension-sdk/content/content.bundle.js", "yourContent.js"],
140
+ "run_at": "document_start",
141
+ "matches": ["<all_urls>"]
142
+ }
143
+ ]
144
+ }
145
+ ```
146
+
147
+ ### Dynamic (service worker)
148
+
149
+ ```ts
150
+ // background (service_worker)
151
+ chrome.runtime.onInstalled.addListener(() => {
152
+ chrome.scripting.registerContentScripts(
153
+ [
154
+ {
155
+ id: "reclaim-sdk",
156
+ matches: ["<all_urls>"],
157
+ js: ["reclaim-browser-extension-sdk/content/content.bundle.js"],
158
+ runAt: "document_start",
159
+ world: "ISOLATED",
160
+ },
161
+ ],
162
+ () => void chrome.runtime.lastError,
163
+ );
164
+ });
165
+
166
+ chrome.scripting.getRegisteredContentScripts((scripts) => {
167
+ if (!scripts?.find((s) => s.id === "reclaim-sdk")) {
168
+ chrome.scripting.registerContentScripts(
169
+ [
170
+ {
171
+ id: "reclaim-sdk",
172
+ matches: ["<all_urls>"],
173
+ js: ["reclaim-browser-extension-sdk/content/content.bundle.js"],
174
+ runAt: "document_start",
175
+ world: "ISOLATED",
176
+ },
177
+ ],
178
+ () => void chrome.runtime.lastError,
179
+ );
180
+ }
181
+ });
182
+ ```
183
+
184
+ > Dynamic registration requires `"scripting"` permission.
185
+
186
+ ---
187
+
188
+ ## Common step (both approaches): Initialize Background
189
+
190
+ ```js
191
+ // background entry (service_worker)
192
+ import { reclaimExtensionSDK } from "@reclaimprotocol/browser-extension-sdk";
193
+
194
+ reclaimExtensionSDK.initializeBackground(); // idempotent
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Approach 1: Use the SDK **inside your own extension** (popup/panel)
200
+
201
+ **Minimal popup markup**
202
+
203
+ ```html
204
+ <!-- popup.html -->
205
+ <div>
206
+ <input id="appId" placeholder="Application ID" />
207
+ <input id="appSecret" placeholder="Application Secret" />
208
+ <input id="providerId" placeholder="Provider ID" />
209
+ <button id="start">Start Verification</button>
210
+ <pre id="out"></pre>
211
+
212
+ <script src="popup.js" type="module"></script>
213
+ </div>
214
+ ```
215
+
216
+ ```js
217
+ // popup.js
218
+ import { reclaimExtensionSDK } from "@reclaimprotocol/browser-extension-sdk";
219
+
220
+ document.getElementById("start").onclick = async () => {
221
+ const appId = document.getElementById("appId").value.trim();
222
+ const appSecret = document.getElementById("appSecret").value.trim();
223
+ const providerId = document.getElementById("providerId").value.trim();
224
+
225
+ const out = document.getElementById("out");
226
+ out.textContent = "";
227
+
228
+ try {
229
+ const req = await reclaimExtensionSDK.init(appId, appSecret, providerId);
230
+
231
+ request.on("started", ({ sessionId }) => console.log("started", sessionId));
232
+ req.on("completed", (p) => (out.textContent = JSON.stringify(p, null, 2)));
233
+ req.on("error", (e) => (out.textContent = `Error: ${e?.message || e}`));
234
+ } catch (e) {
235
+ out.textContent = `Error: ${e?.message || String(e)}`;
236
+ }
237
+ };
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Approach 2: Basic setup in your extension + **start from a web app**
243
+
244
+ When you trigger from a webpage, **pass your Extension ID**.
245
+
246
+ ```tsx
247
+ // Example React component (Vite)
248
+ import React, { useState } from "react";
249
+ import { reclaimExtensionSDK } from "@reclaimprotocol/browser-extension-sdk";
250
+
251
+ const APP_ID = import.meta.env.VITE_RECLAIM_APP_ID;
252
+ const APP_SECRET = import.meta.env.VITE_RECLAIM_APP_SECRET;
253
+ const EXTENSION_ID = import.meta.env.VITE_RECLAIM_EXTENSION_ID;
254
+
255
+ export default function ReclaimButton({ providerId }: { providerId: string }) {
256
+ const [loading, setLoading] = useState(false);
257
+ const [proofs, setProofs] = useState(null);
258
+ const [error, setError] = useState("");
259
+ const [statusUrl, setStatusUrl] = useState("");
260
+ const [req, setReq] = useState(null);
261
+
262
+ const start = async () => {
263
+ try {
264
+ setLoading(true);
265
+ setError("");
266
+ setProofs(null);
267
+
268
+ // Optional - You can also check if the extension is installed before starting:
269
+
270
+ // const installed = await reclaimExtensionSDK.isExtensionInstalled({
271
+ // extensionID: EXTENSION_ID,
272
+ // });
273
+
274
+ // if (!installed) {
275
+ // alert("Please install the extension first.");
276
+ // return;
277
+ // }
278
+
279
+ const request = await reclaimExtensionSDK.init(APP_ID, APP_SECRET, providerId, {
280
+ extensionID: EXTENSION_ID,
281
+ });
282
+
283
+ setReq(request);
284
+ setStatusUrl(request.getStatusUrl());
285
+
286
+ request.on("completed", (p) => {
287
+ setProofs(p);
288
+ setLoading(false);
289
+ });
290
+
291
+ request.on("error", (e) => {
292
+ setError(e?.message || String(e));
293
+ setLoading(false);
294
+ });
295
+
296
+ const p = await request.startVerification();
297
+ setProofs(p);
298
+ } catch (e) {
299
+ setError(e?.message || String(e));
300
+ setLoading(false);
301
+ }
302
+ };
303
+
304
+ return (
305
+ <div>
306
+ <button onClick={start} disabled={loading}>
307
+ {loading ? "Starting…" : "Start Verification"}
308
+ </button>
309
+
310
+ {statusUrl && (
311
+ <p>
312
+ Track status:{" "}
313
+ <a href={statusUrl} target="_blank">
314
+ status
315
+ </a>
316
+ </p>
317
+ )}
318
+ {error && <pre style={{ color: "crimson" }}>{error}</pre>}
319
+ {proofs && <pre>{JSON.stringify(proofs, null, 2)}</pre>}
320
+ </div>
321
+ );
322
+ }
323
+ ```
324
+
325
+ > **Important:** From a **web page**, the SDK cannot call `chrome.runtime.sendMessage` unless you provide `extensionID`.
326
+
327
+ ---
328
+
329
+ ## Optional: Don’t expose keys client-side — generate a request config on your server
330
+
331
+ Use **`@reclaimprotocol/js-sdk`** to generate a signed request config on the server.
332
+
333
+ **Server (Node/Express)**
334
+
335
+ ```js
336
+ const express = require("express");
337
+ const { ReclaimProofRequest } = require("@reclaimprotocol/js-sdk");
338
+
339
+ const app = express();
340
+ const port = 3000;
341
+
342
+ app.use(express.json());
343
+ app.use(express.text({ type: "*/*", limit: "50mb" }));
344
+
345
+ const BASE_URL = "https://your-domain.com";
346
+
347
+ app.get("/generate-config", async (_req, res) => {
348
+ const APP_ID = "YOUR_APPLICATION_ID";
349
+ const APP_SECRET = "YOUR_APPLICATION_SECRET";
350
+ const PROVIDER_ID = "YOUR_PROVIDER_ID";
351
+
352
+ try {
353
+ const reclaimProofRequest = await ReclaimProofRequest.init(APP_ID, APP_SECRET, PROVIDER_ID);
354
+ reclaimProofRequest.setAppCallbackUrl(`${BASE_URL}/receive-proofs`);
355
+ const reclaimProofRequestConfig = reclaimProofRequest.toJsonString();
356
+ res.json({ reclaimProofRequestConfig });
357
+ } catch (error) {
358
+ res.status(500).json({ error: "Failed to generate request config" });
359
+ }
360
+ });
361
+
362
+ app.listen(port, () => {
363
+ console.log(`Server running at http://localhost:${port}`);
364
+ });
365
+ ```
366
+
367
+ **Client (web or popup)**
368
+
369
+ ```ts
370
+ import { reclaimExtensionSDK } from "@reclaimprotocol/browser-extension-sdk";
371
+
372
+ const EXTENSION_ID = "<your_extension_id>";
373
+
374
+ async function startFromServerConfig() {
375
+ const r = await fetch("/generate-config").then((x) => x.json());
376
+ const { reclaimProofRequestConfig } = r;
377
+
378
+ const request = await reclaimExtensionSDK.fromJsonString(reclaimProofRequestConfig, {
379
+ extensionID: EXTENSION_ID,
380
+ });
381
+
382
+ request.on("started", ({ sessionId }) => console.log("started", sessionId));
383
+ request.on("completed", (p) => console.log("completed", p));
384
+ request.on("error", console.error);
385
+ }
386
+ ```
387
+
388
+ Docs: https://docs.reclaimprotocol.org/web/backend/usage
389
+
390
+ ---
391
+
392
+ ## Vite/CRX specifics
393
+
394
+ - Ensure SDK assets are copied **1:1** to your `dist` without hashing.
395
+ - Always load `content.bundle.js` (classic), not an ESM bundle.
396
+ - Use `vite-plugin-static-copy` if needed.
397
+
398
+ ```ts
399
+ import { viteStaticCopy } from "vite-plugin-static-copy";
400
+
401
+ viteStaticCopy({
402
+ targets: [
403
+ {
404
+ src: "node_modules/@reclaimprotocol/browser-extension-sdk/build/**/*",
405
+ dest: "reclaim-browser-extension-sdk",
406
+ },
407
+ ],
408
+ });
409
+ ```
410
+
411
+ ---
412
+
413
+ ## Troubleshooting
414
+
415
+ - **“Unexpected token 'export'”** → Load classic `content.bundle.js` instead of an ESM file.
416
+ - **“chrome.runtime.sendMessage called from a web page must specify Extension ID”** → Pass `{ extensionID }`.
417
+ - **Provider tab doesn’t open** → Check assets, permissions, background init, and content script registration.
418
+
419
+ ---
420
+
421
+ ## Checklist
422
+
423
+ - [x] Ran `npm run reclaim-extension-setup`
424
+ - [x] Manifest includes CSP, host_permissions, and permissions (`offscreen`, `cookies`, `scripting` if dynamic)
425
+ - [x] Added `web_accessible_resources`
426
+ - [x] Content bundle loaded (static/dynamic)
427
+ - [x] Background initialized once
428
+ - [x] Passed `extensionID` from web usage (if applicable)
429
+
430
+ ---
431
+
432
+ ## Types
433
+
434
+ ```ts
435
+ import type { reclaimExtensionSDK } from "@reclaimprotocol/browser-extension-sdk";
436
+ ```
@@ -0,0 +1 @@
1
+ declare const __SDK_VERSION__: string;
@@ -0,0 +1,61 @@
1
+ export interface InitOptions {
2
+ extensionID?: string;
3
+ providerVersion?: string;
4
+ callbackUrl?: string;
5
+ }
6
+
7
+ export interface Proofs {
8
+ [key: string]: unknown;
9
+ }
10
+
11
+ export type RequestEvents = "started" | "completed" | "error" | "progress";
12
+
13
+ export class ReclaimExtensionProofRequest {
14
+ applicationId: string;
15
+ providerId: string;
16
+ sessionId: string;
17
+ signature: string;
18
+ timestamp: string;
19
+ getStatusUrl(): string;
20
+
21
+ static fromJsonString(
22
+ json: string | Record<string, unknown>,
23
+ options?: InitOptions,
24
+ ): ReclaimExtensionProofRequest;
25
+ static fromConfig(
26
+ config: Record<string, unknown>,
27
+ options?: InitOptions,
28
+ ): ReclaimExtensionProofRequest;
29
+
30
+ setAppCallbackUrl(url: string, jsonProofResponse?: boolean): void;
31
+ setRedirectUrl(url: string): void;
32
+ addContext(address: string | number, message: string): void;
33
+ setParams(params: Record<string, unknown>): void;
34
+
35
+ on(event: RequestEvents, cb: (payload?: unknown) => void): () => void;
36
+ off(event: RequestEvents, cb: (payload?: unknown) => void): void;
37
+
38
+ startVerification(): Promise<Proofs>;
39
+ cancel(timeoutMs?: number): Promise<boolean | void>;
40
+ }
41
+
42
+ export class ReclaimExtensionSDK {
43
+ initializeBackground(): unknown;
44
+ isExtensionInstalled(opts?: { extensionID?: string; timeout?: number }): Promise<boolean>;
45
+ getVersion(): string;
46
+ init(
47
+ applicationId: string,
48
+ appSecret: string,
49
+ providerId: string,
50
+ options?: InitOptions,
51
+ ): Promise<ReclaimExtensionProofRequest>;
52
+
53
+ // Convenience wrapper that forwards to ReclaimExtensionProofRequest.fromJsonString
54
+ fromJsonString(
55
+ json: string | Record<string, unknown>,
56
+ options?: InitOptions,
57
+ ): ReclaimExtensionProofRequest;
58
+ }
59
+
60
+ export const reclaimExtensionSDK: ReclaimExtensionSDK;
61
+ export default ReclaimExtensionSDK;