Time based On-Time Password / 2 factor Authentication Library

Hi,

inspired by this discussion, I started to port / implement a Timebased On-Time Password (TOTP, as defined per RFC 6238) algorithm as library for the PLC.

A very early first version is finished right now, and I decided to make it public available in my repository :

Please note, that I’ve done just some basic tests until now, so I can’t guarantee anything … but at least those basic tests looked good so far :wink:

What does the the library support?

  • 6-digit numeric time-based one time password compatibility with standard authenticator apps (like Google or Microsoft Authenticator)
  • integrated shared secret generation based on two string informations or one string information plus a certificate
  • otpauth link generation for the shared secret exchange with the authenticator app
  • usable for two-factor authentication together with AR UserRole system (not implemented, that’s just a use-case example)
  • also usable for some kind of “password of the day” use-cases (but then not with standard authenticator apps, as they just support 30s valid passwords)

In the sample task showing the basic usage of the library, additionally a QRcode can be displayed directly via the AR embedded webserver (there’s a 2nd library named WsQRlib used, that is also available in the repository).

Everything is under MIT license.

Happy coding and best regards!

@patrick.tanner, maybe it’s interesting for your use-case.

7 Likes

Wow, that was faster than expected :blush:

Thanks for your effort and sharing it with us. Currently I’m working on another project and soon on vacation :palm_tree:, so it may take some time until I can test it.

2 Likes