This project is a simple command-line tool created as a school project using Rust. 🎓
It's designed to generate Time-based One-Time Passwords (TOTP) by encrypting a key and generating a QR code for TOTP app registration. 🕒
- Encrypt Key: 🔒 Securely encrypts a provided hex key and saves it for TOTP generation.
- Generate QR Code: 📱 Creates a QR code to easily add the encrypted key to a TOTP app.
- Generate TOTP: 🗝️ Produces a TOTP code using the encrypted key and current time.
- Rust Programming Language 🦀
To set up this project, follow these steps:
git clone <repository-url>
cd ft_otp
cargo build --release
Execute the program with options to encrypt a key, generate a QR code, or produce a TOTP code:
./target/release/ft_otp [OPTIONS]
-g, --generate <path>
: 🔐 Encrypt and save a hex key from a specified path.-q, --qrcode <file>
: 🖼️ Specify the output file for the QR code (defaultqr.png
).-k, --key <path>
: 🗝️ Use an encrypted key file to generate the TOTP code (defaultft_otp.key
).
- To encrypt a key and generate a QR code:
./target/release/ft_otp --generate your_key_path --qrcode your_qr_code.png
- To generate a TOTP code:
./target/release/ft_otp --key your_encrypted_key_file
After generating the TOTP code with both your Rust tool and the oathtool
Docker container, you can compare the results to verify the accuracy and consistency of your implementation.
docker build -t oathtool .
cargo run && docker run oathtool $(cat key.hex)