Don't assume first value is non-url format.
The first entry can be OTP shared secret or the URL. This fixes
@@ -50,7 +50,12 @@ func (s *Action) OTP(ctx context.Context, c *cli.Context) error {
secKey = sec.Password()
}
+ if strings.HasPrefix(secKey, "otpauth://") {
+ otp, label, err = twofactor.FromURL(secKey)
+ } else {
otp, err = twofactor.NewGoogleTOTP(secKey)
+ }
+
if err != nil {
return s.exitError(ctx, ExitUnknown, err, "No OTP entry found for %s", name)
}
