Skip to content

Commit

Permalink
Merge pull request pquerna#9 from phylake/digits-fix
Browse files Browse the repository at this point in the history
Digits fix
  • Loading branch information
pquerna authored Sep 12, 2016
2 parents 1ff6a76 + 0b1c464 commit 5465390
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//
// key, err := totp.Generate(totp.GenerateOpts{
// Issuer: "Example.com",
// AccountName: "[email protected]"
// AccountName: "[email protected]",
// })
//
// // Convert TOTP key into a QR code encoded as a PNG image.
Expand Down
4 changes: 4 additions & 0 deletions totp/totp.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func Generate(opts GenerateOpts) (*otp.Key, error) {
opts.SecretSize = 10
}

if opts.Digits == 0 {
opts.Digits = otp.DigitsSix
}

// otpauth://totp/Example:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Example

v := url.Values{}
Expand Down

0 comments on commit 5465390

Please sign in to comment.