Auths
Last updated
Last updated
Sismo Connect can be used to authenticate a user from multiple sources, either from web2 or web3.
The AuthRequest
is an object with the following properties:
AuthType
(required): defines the type of authentication required. The following authType are currently supported:
VAULT
: Sismo Connect returns the user's vaultId for the application that requested it. It is a deterministic anonymous identifier (hash(userVaultSecret, AppId, ..))
See more information about Vault Identifiers .
GITHUB
: Sismo Connect returns the user's GitHub account id.
TWITTER
Sismo Connect returns the user's Twitter account id.
EVM_ACCOUNT
: Sismo Connect returns the user's Ethereum address.
TELEGRAM
: Sismo Connect returns the user's Telegram account id.
userId
(optional): requests the user to have a predefined account.
isOptional
(optional): by default set to false
. Allows the user to optionally authenticate with this AuthType
.
AuthRequests are passed as props of the SismoConnectButton
either through:
the auth
props for one authentication request: AuthRequest
or,
the auths
props for several authentication requests: AuthRequest[]
Responses are received through either:
the onResponse: (response: SismoConnectResponse) => void
callback for offchain verification or,
the onResponseBytes (response: string) => void
callback for onchain verification.
Once a user has generated a ZKP on the Data Vault app, your application must verify it. This can be achieved in onchain smart contracts or offchain back ends.
One or multiple AuthRequests 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,
the result.getUserId()
can be called as shown below to get the userId of the corresponding type.
Authentication requests are made in the front end using either the or the . Requests are then verified either in a back end 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.
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.