TGViewer
TheFrontEnd🔥 TheFrontEnd🔥 @thefrontend · 10.4K subscribers
Post #1041 4.92K
​​#learn #tools

I've recently had a proper deep dive into all QR code related stuff.

We needed to get a "check in" system on site with really poor Internet connection. People would come and scan their QR codes from the mobile app using tablet with a simple Web app.

Turns out it's not that difficult once you get a grasp of it.

I've used react-native-qr-svg on mobile to quickly render QR codes. And react-qr-reader on the web.

Now, each user on the server gets a unique 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.
  • 👏 9
  • ❤ 1
  • 🔥 1
More from @thefrontend
  1. Oct 3, 2023#thoughts Today I had a pleasure (not really) getting to think about how far should I go i…
  2. Sep 19, 2023#tools Wow, this is golden 10/10 🔥 https://www.refactornow.dev/roast Your personal AI cod…
  3. Sep 18, 2023#news What's all the hype around ditching typescript recently? 🔗 Link Like how is it surp…
  4. Sep 2, 2023Just found an alternative to megadraft. Lexical. A completely different approach, super fl…
  5. Aug 19, 2023Best JS framework to date! Spoiler: ⛔️⛔️⛔️⛔️⛔️
  6. Aug 17, 2023#learn The quickest explanation on hex vs rgb I've seen + also how you can derive one from…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →