Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 978 Bytes

README.md

File metadata and controls

19 lines (17 loc) · 978 Bytes

An idea for eliminating the need for a database when using OTP (One-Time Password) in .NET

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 OTP Schema

  1. Generate Random Code (Password)
  2. Create and Serialize OTP JSON Object
  3. Encrypt OTP JSON Object

Verify OTP Schema

  1. Decrypt Key
  2. Deserialize OTP JSON Object
  3. Check the accuracy of the information