otp

package
v0.105.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "otp <secret>",
	Short: "Generate OTP code from TOTP secret",
	Args:  cobra.ExactArgs(1),
	Run: func(c *cobra.Command, args []string) {
		code, err := totp.GenerateCode(args[0], time.Now())
		if err != nil {
			log.Fatal("Error generating OTP: ", err)
		}
		if FlagWithDash {
			fmt.Printf("%s-%s\n", code[:3], code[3:])
		} else {
			fmt.Println(code)
		}
	},
}
View Source
var FlagWithDash bool

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL