From 1971555a91c0cb0c848fba1d9e1f9029b3158355 Mon Sep 17 00:00:00 2001 From: Shishir S Tambe Date: Fri, 30 Jan 2026 11:21:18 +0000 Subject: [PATCH 1/2] docs(js-sdk): add comprehensive sdk methods reference for issue #15 --- content/docs/js-sdk/meta.json | 3 +- content/docs/js-sdk/sdk-methods.mdx | 100 ++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 content/docs/js-sdk/sdk-methods.mdx diff --git a/content/docs/js-sdk/meta.json b/content/docs/js-sdk/meta.json index 36c6683..7df4646 100644 --- a/content/docs/js-sdk/meta.json +++ b/content/docs/js-sdk/meta.json @@ -4,6 +4,7 @@ "installation", "preparing-request", "generating-proof", - "verifying-proofs" + "verifying-proofs", + "sdk-methods" ] } diff --git a/content/docs/js-sdk/sdk-methods.mdx b/content/docs/js-sdk/sdk-methods.mdx new file mode 100644 index 0000000..9509aac --- /dev/null +++ b/content/docs/js-sdk/sdk-methods.mdx @@ -0,0 +1,100 @@ +--- +title: SDK Methods Reference +description: Detailed technical reference for the Reclaim Protocol JS-SDK methods, including parameters and return types. +--- + +# ReclaimProofRequest + +[cite_start]The `ReclaimProofRequest` class is the core component used to initialize, configure, and trigger the proof generation process[cite: 39, 40]. + +## Methods Overview + +| Method | Description | +| :--- | :--- | +| `init()` | [cite_start]Creates a new SDK instance[cite: 2]. | +| `setContext()` | [cite_start]Adds user-specific identifiers to the request[cite: 12]. | +| `setParams()` | [cite_start]Sets expected values for data extraction[cite: 15]. | +| `triggerReclaimFlow()` | [cite_start]Opens the verification UI for the user[cite: 41]. | + +## init() + +The `init` method is a static asynchronous function used to initialize the Reclaim SDK. It creates a `ReclaimProofRequest` instance that holds your configuration. + +### Parameters + +| Parameter | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| `appId` | `string` | Yes | [cite_start]Your unique Application ID generated from the Reclaim DevTool. | +| `appSecret` | `string` | Yes | Your Application Secret. [cite_start]**Security Note:** This should only be used on the backend. | +| `providerId` | `string` | Yes | [cite_start]The unique identifier for the data provider you want the user to verify. | +| `options` | `object` | No | [cite_start]Advanced configuration object (e.g., `metadata`, `preferredLocale`)[cite: 11, 72, 78]. | + +### Return Value +**Type:** `Promise` +[cite_start]Returns a "Promise" that resolves to a new instance of the `ReclaimProofRequest` class once initialization is complete[cite: 2, 39]. + +### Example +```javascript +const reclaimProofRequest = await ReclaimProofRequest.init( + process.env.RECLAIM_APP_ID, + process.env.RECLAIM_APP_SECRET, + 'your-provider-id' +); + +## setContext() + +Adds context to the proof request. This helps you identify and verify the request when the proof is sent back to your callback endpoint. + +### Parameters + +| Parameter | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| `contextAddress` | `string` | Yes | [cite_start]A unique identifier for the user (e.g., a wallet address or email). | +| `contextMessage` | `string` | Yes | [cite_start]A message or stringified JSON containing additional session data. | + +### Example +```javascript +reclaimProofRequest.setContext('user-wallet-address', 'session-id-12345'); + +### 3. The Writing: `setParams()` +This is a "Validation" method. It tells the SDK exactly what data to look for. + +**Add this to your file:** + +```markdown +## setParams() + +Defines the expected values for the parameters being extracted. If the extracted data from the provider does not match these parameters, the proof generation will fail. + +### Parameters + +| Parameter | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| `params` | `Record` | Yes | A key-value object where keys match the template's parameter names. | + +### Example +```javascript +reclaimProofRequest.setParams({ + userName: "John Doe", + membershipType: "Premium" +}); + +### setAppCallbackUrl() + +Specifies a backend URL where the Reclaim Protocol will send the proof results once the user completes the verification. + +| Parameter | Type | Required | Description | Default | +| :--- | :--- | :--- | :--- | :--- | +| `url` | `string` | **Yes** | Your backend endpoint URL (e.g., `https://api.your-app.com/callback`). | - | +| `useJson` | `boolean` | No | If `true`, the proof is sent as raw JSON. If `false`, it is urlencoded. | `false` | + +```javascript +reclaimProofRequest.setAppCallbackUrl('https://my-backend.com/reclaim-webhook', true); + + +// Server-side initialization +const reclaimProofRequest = await ReclaimProofRequest.init( + process.env.RECLAIM_APP_ID, + process.env.RECLAIM_APP_SECRET, + 'your-provider-id' +); \ No newline at end of file From 1982b5cc8177d9f6cbdb6f3c298200a1baf018b4 Mon Sep 17 00:00:00 2001 From: Shishir S Tambe Date: Fri, 30 Jan 2026 12:33:10 +0000 Subject: [PATCH 2/2] docs(js-sdk): add comprehensive sdk methods reference and callback documentation --- content/docs/js-sdk/sdk-methods.mdx | 48 +++++++++++++---------------- package-lock.json | 4 +-- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/content/docs/js-sdk/sdk-methods.mdx b/content/docs/js-sdk/sdk-methods.mdx index 9509aac..5ce9544 100644 --- a/content/docs/js-sdk/sdk-methods.mdx +++ b/content/docs/js-sdk/sdk-methods.mdx @@ -5,16 +5,16 @@ description: Detailed technical reference for the Reclaim Protocol JS-SDK method # ReclaimProofRequest -[cite_start]The `ReclaimProofRequest` class is the core component used to initialize, configure, and trigger the proof generation process[cite: 39, 40]. +The `ReclaimProofRequest` class is the core component used to initialize, configure, and trigger the proof generation process. ## Methods Overview | Method | Description | | :--- | :--- | -| `init()` | [cite_start]Creates a new SDK instance[cite: 2]. | -| `setContext()` | [cite_start]Adds user-specific identifiers to the request[cite: 12]. | -| `setParams()` | [cite_start]Sets expected values for data extraction[cite: 15]. | -| `triggerReclaimFlow()` | [cite_start]Opens the verification UI for the user[cite: 41]. | +| `init()` | Creates a new SDK instance. | +| `setContext()` | Adds user-specific identifiers to the request. | +| `setParams()` | Sets expected values for data extraction. | +| `setAppCallbackUrl()` | Define backend URL for Reclaim to POST proofs upon verification. | ## init() @@ -24,14 +24,14 @@ The `init` method is a static asynchronous function used to initialize the Recla | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | -| `appId` | `string` | Yes | [cite_start]Your unique Application ID generated from the Reclaim DevTool. | -| `appSecret` | `string` | Yes | Your Application Secret. [cite_start]**Security Note:** This should only be used on the backend. | -| `providerId` | `string` | Yes | [cite_start]The unique identifier for the data provider you want the user to verify. | -| `options` | `object` | No | [cite_start]Advanced configuration object (e.g., `metadata`, `preferredLocale`)[cite: 11, 72, 78]. | +| `appId` | `string` | Yes | Your unique Application ID generated from the Reclaim DevTool. | +| `appSecret` | `string` | Yes | Your Application Secret. **Security Note:** This should only be used on the backend. | +| `providerId` | `string` | Yes | The unique identifier for the data provider you want the user to verify. | +| `options` | `object` | No | Advanced configuration object (e.g., `metadata`, `preferredLocale`). | ### Return Value **Type:** `Promise` -[cite_start]Returns a "Promise" that resolves to a new instance of the `ReclaimProofRequest` class once initialization is complete[cite: 2, 39]. +Returns a "Promise" that resolves to a new instance of the `ReclaimProofRequest` class once initialization is complete. ### Example ```javascript @@ -40,7 +40,7 @@ const reclaimProofRequest = await ReclaimProofRequest.init( process.env.RECLAIM_APP_SECRET, 'your-provider-id' ); - +``` ## setContext() Adds context to the proof request. This helps you identify and verify the request when the proof is sent back to your callback endpoint. @@ -49,19 +49,15 @@ Adds context to the proof request. This helps you identify and verify the reques | Parameter | Type | Required | Description | | :--- | :--- | :--- | :--- | -| `contextAddress` | `string` | Yes | [cite_start]A unique identifier for the user (e.g., a wallet address or email). | -| `contextMessage` | `string` | Yes | [cite_start]A message or stringified JSON containing additional session data. | +| `contextAddress` | `string` | Yes | A unique identifier for the user (e.g., a wallet address or email). | +| `contextMessage` | `string` | Yes | A message or stringified JSON containing additional session data. | ### Example ```javascript reclaimProofRequest.setContext('user-wallet-address', 'session-id-12345'); +``` -### 3. The Writing: `setParams()` -This is a "Validation" method. It tells the SDK exactly what data to look for. - -**Add this to your file:** -```markdown ## setParams() Defines the expected values for the parameters being extracted. If the extracted data from the provider does not match these parameters, the proof generation will fail. @@ -78,23 +74,21 @@ reclaimProofRequest.setParams({ userName: "John Doe", membershipType: "Premium" }); +``` -### setAppCallbackUrl() +## setAppCallbackUrl() Specifies a backend URL where the Reclaim Protocol will send the proof results once the user completes the verification. +### Parameters + | Parameter | Type | Required | Description | Default | | :--- | :--- | :--- | :--- | :--- | | `url` | `string` | **Yes** | Your backend endpoint URL (e.g., `https://api.your-app.com/callback`). | - | | `useJson` | `boolean` | No | If `true`, the proof is sent as raw JSON. If `false`, it is urlencoded. | `false` | +### Example + ```javascript reclaimProofRequest.setAppCallbackUrl('https://my-backend.com/reclaim-webhook', true); - - -// Server-side initialization -const reclaimProofRequest = await ReclaimProofRequest.init( - process.env.RECLAIM_APP_ID, - process.env.RECLAIM_APP_SECRET, - 'your-provider-id' -); \ No newline at end of file +``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index bbfe115..80747e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "reclaim-fumadocs", - "version": "0.0.0", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "reclaim-fumadocs", - "version": "0.0.0", + "version": "0.1.0", "hasInstallScript": true, "dependencies": { "@theguild/remark-mermaid": "^0.2.0",