📝 Articles🗞 News 👓Tutorials 🤔 UI/UX thoughts
useRenderCount
- cuz you should use browser tooling to properly track unnecessary renders, to handy useDebounce
, useFetch
or usePrevious
.
Last one is quite a help in function components where you dont get prev values out of the box like with some lifecycle methods in class components.
https://usehooks.com/id
(duh) and also what's called hmac.
The QR itself on mobile is a combination of userId-hmac-totp
The first 2 are used to check if the user is the one they claim to be (aka you can hack userId, but you won't find out their hmac unless you know the secret key), this prevents random people generating QR codes and checking in on site for their friends.
The last totp part really is just One Time Password mechanism using OTPAuth. It refreshes every 10 seconds and rerenders the QR code, similar how you'd expect authenticator apps to work, except contained within QR.
This prevents users to screenshot and share their QR codes with friends for them to check in for you.
And that's it really. You get your fairly secured QR rendering and scanning mechanism, can now use it almost anywhere: office, sites, restaurants, parking, gyms, you name it.