Closed DigitalDJ closed 3 years ago
Hi @DigitalDJ,
thank you for your pull request. Sadly, I'm very busy in the next two days, but I will review your pull request on Wednesday. I will notify you!
Thank you 🙂
Hi @DigitalDJ,
I just implemented Steam support right now. In my case I didnt get your pull request to work. But I have implemented the new functionality in a simliar way.
Thank you for your contribution.
This commit adds a mechanism to add transforms (in code) to the TOTP. The transform can:
a) Override the inputs to the creation of the OtpSharp's Totp object and, b) Transform / Encode the output TOTP code
Both are sometimes required to output proprietary / obscure TOTP codes.
In this commit, I have added a wrapper to OtpSharp's Totp called OtpTotp. This object is an attempt to clean up the multiple places in code where the Totp object is used in different ways. There is now a centralized place to get the TOTP string -- new OtpTotp(data).getTotpString(timestamp)
I have included a "null" transformer, called Digits. This transformer just pads out the TOTP code with zeros ('0') to the number of digits of the TOTP. I've removed places in code where this is duplicated. This is the default transform.
The other transformer I have included is for Steam Guard. Steam uses a RFC6238 TOTP, but encodes the output into a 5-digit alphanumeric TOTP. The algorithm for this transform has been reverse engineered and scattered around the web.