docs/content/guides/developer/cryptography/zklogin-integration/zklogin-example.mdx
The Sui community created an example to facilitate a comprehensive understanding of each step involved in Sui zkLogin for developers.
This example breaks down the complete process of Sui zkLogin into seven steps, as follows:
Each step includes corresponding code snippets, providing instructions on how to obtain the required data for each step.
The example runs in Sui Devnet. All data the user generates is stored locally on the client-side (browser). The acquisition of the zero-knowledge proof (ZK proof) is done through a call to the Mysten Labs-maintained proving service. Therefore, running the example does not require an additional deployed backend server (or a Docker container).
The following table lists the storage location for key data the example uses:
| Data | Storage location |
|---|---|
| Ephemeral key pair | window.sessionStorage |
| Randomness | window.sessionStorage |
| User salt | window.localStorage |
| Max epoch | window.localStorage |
The user salt is stored long-term in the browser's localStorage. Consequently, provided the localStorage is not cleared manually, you can use the same JWT (in this example, logging in with the same Google account) to access the corresponding zkLogin address generated from the current salt value at any time.
:::caution
Changing browsers or devices results in the inability to access previously generated Sui zkLogin addresses, even when using the same JWT.
:::
ZK Proof request failure:
Request test tokens failure:
Any suggestions are welcome on the project's GitHub repo through raised issues, and of course, pull requests are highly appreciated.