As I have seen, most applications use database for the OTP Verification section and assign one or more tables to OTP.
This makes sense in terms of storing and reviewing data, but increases database transactions and thus slows down the database.
What is the solution?
We can implement Generate and Verify operations in application logic!
But how?
Using cryptography, we encrypt the data we want and send it to the client as a key.
How to verify the accuracy of the information?
We decrypt the key sent to us by the client and then perform the operations required to verify the information.
- Generate Random Code (Password)
- Create and Serialize OTP JSON Object
- Encrypt OTP JSON Object
- Decrypt Key
- Deserialize OTP JSON Object
- Check the accuracy of the information