mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-09-13 14:29:09 +00:00
fix: correctly generates otp code from token with extra padding
This commit is contained in:
parent
ddaa090bc7
commit
c1904ca20a
2 changed files with 39 additions and 0 deletions
|
@ -33,6 +33,9 @@ func GenerateOTPCode(token string, when time.Time) (string, error) {
|
|||
// It should be uppercase always
|
||||
token = strings.ToUpper(token)
|
||||
|
||||
// Remove all the extra "=" padding at the end
|
||||
token = strings.TrimRight(token, "=")
|
||||
|
||||
secretBytes, err := base32.StdEncoding.WithPadding(base32.NoPadding).DecodeString(token)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Decoding token string: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue