A Command Line OTP authenticator app written in Rust that generates time and counter based OTP codes.
gk-authenticator is built with Rust and is available via the Cargo package manager.
You must have the Rust toolchain installed to use Cargo.
Run the following command in your terminal:
cargo install gk-authenticator- Supports both Time-based OTP (TOTP) and Counter-based OTP (HOTP).
- Allows selection of various hash algorithms: SHA1 (default), SHA256, SHA384, and SHA512.
- All secret keys must be provided in Base32 encoding.
- Simple command-line interface for managing accounts.
Once installed, you can use gk-authenticator with the following commands:
Add a new authenticator account with a secret key:
# Add a TOTP account (default)
gk-authenticator add --account "GitHub" --key "JBSWY3DPEHPK3PXP"
# Add an HOTP account
gk-authenticator add --account "MyService" --key "JBSWY3DPEHPK3PXP" --hotp
# Add with custom algorithm
gk-authenticator add --account "MyApp" --key "JBSWY3DPEHPK3PXP" --algorithm sha256Options:
--account: Name of the account (required)--key,-k: Secret key in Base32 encoding (required)--totp: Use Time-based OTP (default, conflicts with --hotp)--hotp: Use Counter-based OTP (conflicts with --totp)--algorithm,-a: Hash algorithm (sha1, sha256, sha384, sha512) - default: sha1
Generate and display the OTP code for a particular account:
# View OTP with default 6-digit length
gk-authenticator view --account "GitHub"
# View OTP with custom length
gk-authenticator view --account "GitHub" --length 8Options:
--account: Name of the account (required)--length,-l: Length of the OTP code (default: 6)
Display OTP codes for all stored accounts:
# List all with default 6-digit length
gk-authenticator list
# List all with custom length
gk-authenticator list --length 8Options:
--length,-l: Length of the OTP code (default: 6)
Remove an account from storage:
gk-authenticator delete --account "GitHub"Options:
--account: Name of the account to delete (required)
Get help for any command:
# General help
gk-authenticator --help
# Help for specific command
gk-authenticator add --helpgk-authenticator stores all account data locally on your system in a JSON file:
- Location:
~/.gk-authenticator/account.json - Permissions: The file is created with restricted permissions (600) for security
- Persistence: All accounts and their settings are automatically saved after each operation
The data includes account names, secret keys, algorithm preferences, and HOTP counter values (if applicable). The application automatically creates the storage directory and file on first use.