Skip to content

Commit c25a9c0

Browse files
author
madhavanmalolan
committed
fixing setParams doc
1 parent 6311373 commit c25a9c0

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

content/docs/js-sdk/generating-proof.mdx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,3 @@ Automatically trigger the optimal verification flow based on user's platform. Sh
164164
```
165165
reclaimProofRequest.triggerReclaimFlow(options)
166166
```
167-
168-
## Passing variables through the proof object
169-
170-
You can add custom key-value parameters to the proof request. These parameters will be included in the verified proof and can be used for application-specific metadata. However, the parameters are not cryptographically bound to the proof. If they are edited by a malicious user, there is no way to detect. So we recommend putting only metadata in parameters that are not strictly mission critical. This is useful to pass variables into the proof object instead of having to maintain state separately. For mission critical variables that should not be possible for the user to edit, please refer [`setContext`](preparing-request#set-context) instead.
171-
172-
```
173-
reclaimProofRequest.setParams({
174-
action: "account_verification",
175-
timestamp: Date.now(),
176-
...
177-
});
178-
```
179-
180-
181-
182-

content/docs/js-sdk/preparing-request.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This is the simplest version of creating a proof request.
1717
import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk';
1818
```
1919

20-
## Create an endpoint to build the `Proof Request` on your backend
20+
## Setup a request on the backend
2121
```javascript
2222
const reclaimProofRequest = await ReclaimProofRequest.init(
2323
'APP_ID',
@@ -84,6 +84,18 @@ reclaimProofRequest.setContext('address', 'message')
8484
- `address` : this is usually a unique identifier for the user. This could be an email address, a wallet address, or just a session id
8585
- `message` : this is an open field where you can add any other information that you want passed around from the build request to the callback endpoint. You can stringify jsons here for convenience.
8686

87+
## Set Parameters
88+
If you already know what the value of the extracted parameter is supposed to be, you can set that using `setParams`.
89+
For example, if you know that the user's name before hand - and you want them to prove something from a website and you need the name to match exactly, you should use set the name in the params.
90+
91+
If the extracted parameter doesn't match the set parameter, the proof generation will fail.
92+
```
93+
reclaimProofRequest.setParams({
94+
name : "John Doe"
95+
})
96+
```
97+
98+
8799
## Set Callback
88100
```
89101
reclaimProofRequest.setAppCallbackUrl(url)

content/docs/js-sdk/verifying-proofs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Critical step to make sure user is not trying to defraud your app
44
---
55

66
# Why do I need to verify, when the proof has already been generated?
7-
The [proof generation](/js-sdk/generating-proof) is a client side operation to protect the privacy and security of the user. However, if the user is malicious and you don't verify the proof on the backend, the user could use browser injections to trick your webapp to call `onSuccess` callback even without creating a valid proof. So, you must force your frontend to upload the proof generated or claimed to have been generated and verify them before you take the user to the next step in your business logic.
7+
The [proof generation](/js-sdk/generating-proof) is a client side operation. On Success Callback is only responsible for notifying when the proof is generated successfully. All the proofs generated should be verified on your backend as a malicious user can bypass any check you add on the frontend.
88

99
Verifying proofs is a very simple light weight operation. You can think of it as verifying the digital signatures to make sure the data is tamper resistant.
1010

0 commit comments

Comments
 (0)