Claims
Last updated
Last updated
Sismo Connect can be used to request zero-knowledge proofs (ZKPs) that attest group membership from users.
The ClaimRequest
holds all the information needed to generate such a proof. It has the following properties:
groupId
(required): the group identifier that the user must prove membership of in order to generate the proof. The groupId can be found in the .
value
(optional): by default set to “1”. Querying a specific value restricts eligibility to users belonging to the group with the minimum specified value or matching the exact value.
claimType
(optional): by default ClaimType.GTE
. Defines the type of group membership required. The following claim types are currently supported:
ClaimType.GTE
: the user must prove that they own an account with at least the requested value.
ClaimType.EQ
: the user must prove that he owns an account with the exact requested value.
groupTimestamp
(optional): set to “latest” by default. Groups are composed of snapshots generated either once, daily, or weekly. Each Group Snapshot generated has a timestamp associated with them. By default, the selected group is the latest Group Snapshot generated. But you are free to select a Group Snapshot with a different timestamp than the latest generated one.
isOptional
(optional): by default set to false
. If set to true
the user can optionally prove their group membership.
isSelectableByUser
(optional): by default set to false
and only available for ClaimType.GTE
. This allows users to selectively choose the value used to generate the proof.
ClaimRequests are passed as props to the SismoConnectButton
either through:
the claim
props for one claim request: ClaimRequest
or,
the claims
props for several claim requests: ClaimRequest[]
Responses are received through either:
the onResponse: (response: SismoConnectResponse) => void
callback for offchain verification or,
the onResponseBytes (response: string) => void
callback for onchain verification.
One ClaimRequest - code example
Multiple AuthRequests - code example
One or multiple claim requests can be verified offchain on a backend server using the sismoConnect.verify()
method available on a SismoConnect
instance.
If the proof is valid sismoConnect.verify()
returns a result
of type SismoConnectVerifiedResult
else it will throw an error.
One ClaimRequest - code example
Multiple ClaimRequests - code example
Claim requests are made in the front end using either the or the .
Requests are then verified either in a backend using the or in a smart contract using the .
The SismoConnectButton
React component is available from the . It is a wrapper of the .
The useSismoConnect
hook is available from the . It is a wrapper of the . The useSismoConnect
hook exposes the sismoConnect
variable.
The exposes a SismoConnect
variable.
Once a user has generated the proof on the Data Vault app, your application must verify it. This can be made either offchain in your backend or onchain in your smart contract. The exposes a SismoConnect
variable.
If you are using Nextjs, you will need to add this config in the next.config.js
file to be able to verify the proof. You can find more information .
The exposes a Sismo Connect Library, which can be inherited by your contract either using Foundry or Hardhat.