package otp import ( "fmt" "io/ioutil" "net/url" "os" "strconv" "strings" "time" "github.com/pkg/errors" "github.com/pquerna/otp" "github.com/pquerna/otp/totp" "github.com/smallstep/cli/errs" "github.com/smallstep/cli/flags" "github.com/smallstep/cli/utils" "github.com/urfave/cli" ) func verifyCommand() cli.Command { return cli.Command{ Name: "verify", Action: cli.ActionFunc(verifyAction), Usage: "verify a one-time password", UsageText: `**step crypto otp verify** [**--secret**=] [**--period**=] [**--skew**=] [**--length**=] [**--alg**=] [*--time**=]`, Description: `**step crypto otp verify** does TOTP and HTOP`, Flags: []cli.Flag{ cli.StringFlag{ Name: "secret", Usage: `Path to file containing TOTP secret.`, }, cli.UintFlag{ Name: "period", Usage: `Number of seconds a TOTP hash is valid. Defaults to 30 seconds.`, Value: 30, }, cli.UintFlag{ Name: "skew", Usage: `Periods before or after current time to allow. Defaults to 0. Values greater than 1 require '--insecure' flag.`, Value: 0, }, cli.IntFlag{ Name: "length, digits", Usage: `Length of one-time passwords. Defaults to 6 digits.`, Value: 6, }, cli.StringFlag{ Name: "alg, algorithm", Usage: `Algorithm to use for HMAC. Defaults to SHA1. Must be one of: SHA1, SHA256, SHA512`, Value: "SHA1", }, cli.StringFlag{ Name: "time", Usage: `The to use for TOTP validation. If a