temporal data storage?

Options

Is there any way to store data early? 


Explanation : I am working on a verification with OTP with whatsapp, so in xano I create the verification code and is the response of that endpoint, then in my frontend I request that code and if they match the user is redirected, the only thing that has occurred to me is to create a table with the codes and save them to do this validation .... Is there a more efficient way to do this? so I don't have to save all the codes in a table?

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    edited February 2023
    Options

    You could do that mathematically by making a hash of the user, a secret and the current time rounded to, say the nearest 5 minutes. Then take the last six digits of the resulting number. YOu can issue that number and test against that number on both ends without having to store it in the middle as long as it is redeemed within the window. That way you would never have to store the number. This is the way a lot of time-based OTPs work (it's why google authenticator can work).

    However, creating a random number and storing it works pretty well too. Storing in a table is a reasonable short-term solution, with a background task to clear "too old" numbers. In the Scale plan, the Redis storage supports setting TTLs - the codes can auto-expire without any cleanup task.


    This is a very cool problem - security management is a common topic in our daily State Change Pro office hours, and this is a great case study.

  • nelson artunduaga
    Options

    @Ray Deck Heey Ray, it really is the best option! I had never thought of doing it that way. thanks!!!!