bnixon67/otp — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a small Go project that can generate one time password codes for apps like authenticator apps.

I want it to support both counter based codes and time based codes, following RFC 4226 and RFC 6238. It should let another Go program pass in a shared secret and get back the current code, with sensible defaults like 6 digits and 30 second time windows, but also allow those settings to be changed.

Please keep the code simple and easy to read. Add tests that prove the generated codes match known examples from the RFCs, including different counters and timestamps. If there is already a small command line entry point, make it usable as a simple demo, where I can provide a secret and get a code back.

Don’t overbuild it. I mainly want a reliable, well tested Go library for generating HOTP and TOTP codes.

Want more depth? Deep Reverse