Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Cobra CLI and Interactive Shell for otp-apiΒ #7

@ja7ad

Description

@ja7ad

We should introduce a Cobra-powered CLI for the otp-api application to allow users to interact with the OTP library and server via command-line and an optional interactive shell (REPL-like mode).

This will make the tool more flexible, allowing users to:

  • πŸ› οΈ Generate or validate TOTP/HOTP/OCRA directly from terminal
  • βš™οΈ Configure parameters (algorithm, digits, period, etc.)
  • πŸš€ Start or stop the HTTP API server
  • πŸ§ͺ Run quick test commands interactively (REPL)

πŸ“Œ Proposed CLI Structure:

otp-cli generate totp     # Generate TOTP
otp-cli generate hotp     # Generate HOTP
otp-cli generate ocra     # Generate OCRA
otp-cli validate totp     # Validate TOTP
otp-cli validate hotp     # Validate HOTP
otp-cli validate ocra     # Validate OCRA
otp-cli server start      # Start the HTTP API server
otp-cli shell             # Start interactive shell (REPL)

βœ… Why?

  • Improve developer ergonomics
  • Useful for quick debugging, testing, and scripting
  • CLI is a great companion to the API server
  • Interactive mode can serve as a teaching tool or live demo utility

🧩 Tasks:

  • Setup spf13/cobra
  • Add generate and validate subcommands
  • Add server start command to run API
  • Add interactive shell with basic command auto-complete
  • Add CLI flags for custom configuration

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions