A simple Command Line Interface (CLI) tool to generate One-Time Password (OTP) codes based on the TOTP (Time-based One-Time Password) algorithm. This project is written in Go (Golang) and allows you to securely generate OTP codes from a shared secret.
Note 📋: I realize this project might seem over-engineered, but I'm using it as a sandbox to experiment with testing methodologies, which will ultimately be a valuable addition to my portfolio..
(TOTP and other features coming soon) 🚀
- Generate OTP codes using a secret key
- TOTP standard implementation
- Lightweight, fast, and easy to use
- Built with Go, and uses Makefile for easy build management
- Go 1.18 or higher
- Git
- Make (for building the project)
-
Using go install:
go install github.com/leonamsimoes/totp_code_generator@latest
-
Clone the repository:
git clone https://github.com/leonamsimoes/totp_code_generator.git cd totp_code_generator2a. Build the project using Make:
make build
2b. Run the executable: After building, you will have the
totp_code_generatorbinary ready to use.
To generate an OTP code, you will need to provide a secret key (in base32 encoding) as input. Here's how to use the tool:
./totp_code_generator --secret="SECRETVALUEHERE" --account [email protected] --issuer outlook --duration 60 --length 10./totp_code_generator --help./totp_code_generator --secret SECRETVALUEHERE./totp_code_generator --account [email protected]./totp_code_generator --issuer outlook./totp_code_generator --duration 60./totp_code_generator --length 10============================================
============================================
BEGIN
Code: 1617198347
END
============================================
============================================This will generate the OTP code for the provided secret using the current time-based window.
--secret(required): The base32-encoded secret key used to generate the OTP.--window(optional): The time window (in seconds) to adjust the OTP's validity. Default is 30 seconds.
OTP: 123456The OTP code will be displayed on the terminal.
-
Clone the repository:
git clone https://github.com/leonamsimoes/otp-generator-cli.git cd otp-generator-cli -
Install dependencies (if any):
make install
-
Run tests:
make test -
Build the project:
make build
If you'd like to contribute to this project, feel free to fork the repository, create a feature branch, and submit a pull request.
- Fork the repository.
- Create your feature branch (
git checkout -b feature-name). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-name). - Open a pull request.
Please ensure that your changes adhere to the coding standards and include proper tests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Project Overview: Brief description of the tool and the technology used (Go, Makefile).
- Installation: Clear instructions on cloning the repo, building, and running the project.
- Usage: Examples of commands and options.
- Development: How to contribute and run tests.
- Contributing: Instructions on contributing to the project.