Digital Signature Verification
Last updated
Last updated
With Authento, you can easily implement on-chain access control using digital signatures as shown below.
[Backend] Configure the server to handle generation of digital signatures based on user KYC status retrieved using Authento API.
[Smart Contract] Implement on-chain signature verification.
[Frontend] Set up callbacks to execute the appropriate smart contract function when digital signature is successfully fetched from the backend.
On the backend, you need to set up an endpoint which handles request for digital signatures needed for on-chain verification. This can be done by:
Determine if the address owner should be allowed access to the smart contract based on the user information retrieved in step 1. If so, generate and return a digital signature along with other optional parameters such as expire timestamp.
The API response from Authento contains sensitive information and should NOT be directly relayed to the end user.
There are a few things we need to do on the smart contract:
implement a _recoverSigner function which returns the wallet used to create a particular signature.
Modify any function which requires access control to take signature (and other optional parameters used to generate the signature, such as expire timestamp) as additional argument(s).
For each of the functions modified in step 2, ensure that the _recoverSigner returns the valid address and that all other required conditions are met.
Generate an API key/secret pair from the under the Settings tab
Retrieve the KYC/AML status of the address owner using the Authento API. To learn more about the Authento API, please go to the section.
On the frontend, you should set up callbacks to execute the appropriate smart contract function upon successful signature generation. If you frontend is built using react, you can do so using the custom hook from the authento-react package.