đĒZkAuth Module
Instance creation and imports
Devs can directly access the Zk module from our SDK by just importing the ZkAuth module from the package banana-wallet-sdk
Once you successfully import ZkAuth Module, you can start accessing the methods it exposes just by creating an instance of it.
You can create a ZkAuth Instance as:
Methods by ZkAuth module
Once the ZkInstance is ready, devs can access multiple methods provided by the ZkAuth module.
Methods offered by the ZkAuth module are:
init
getMerkleRoot
getMerkleTreeUri
checkOtp
getOtpInput
init
init
Once zkAuthInstance has successfully obtained. The init
method of zkAuth should be called once. As it generates and caches Merkle root along with other necessary entities at the core. Which later can be accessed by other methods. Due to its singular call nature, it takes nothing and returns nothing. The seed for creating the qr-code-uri
and Merkle tree is same, it is destroyed soon after the deployment.
Usage:
getMerkleRoot
getMerkleRoot
Devs can use the getMerkleRoot
method of zkAuthInstance
To access the root generated at the core when zk module has been initialized.
Usage:
getMerkleTreeUri
getMerkleTreeUri
With getMerkleTreeUri
method devs can get access to the qr-code-uri
generated by the SDK core for their user. Users can scan it using google authenticator, which further generates the OTP to validate the transactions. The URI returned by this method is an image blob which can be rendered simply by any react component as a static asset.
Usage.
checkOtp
checkOtp
checkOtp
method of zkAuthInstance
enables devs to add a pre-check before the query for the actual input for the OTP. It returns a boolean result based on the validity of OTP entered by the user.
Usage
getOtpInput
getOtpInput
getOtpInput
methods enable devs to get actual input corresponding to the OTP. If OTP is valid, they can further use to pass as a param in bananaInstance.execute
the method to validate a transaction.
Usage
If you have any questions please post them Banana SDK Discord forum.
Last updated