.unified totp

This commit is contained in:
afkarxyz
2026-04-13 22:43:35 +07:00
parent 5a3f819cef
commit e23fa2a48e
3 changed files with 36 additions and 196 deletions
+1 -18
View File
@@ -15,9 +15,6 @@ import (
"time"
"sort"
"github.com/pquerna/otp"
"github.com/pquerna/otp/totp"
)
var SpotifyError = errors.New("spotify error")
@@ -40,21 +37,7 @@ func NewSpotifyClient() *SpotifyClient {
}
func (c *SpotifyClient) generateTOTP() (string, int, error) {
secret := "GM3TMMJTGYZTQNZVGM4DINJZHA4TGOBYGMZTCMRTGEYDSMJRHE4TEOBUG4YTCMRUGQ4DQOJUGQYTAMRRGA2TCMJSHE3TCMBY"
version := 61
key, err := otp.NewKeyFromURL(fmt.Sprintf("otpauth://totp/secret?secret=%s", secret))
if err != nil {
return "", 0, err
}
totpCode, err := totp.GenerateCode(key.Secret(), time.Now())
if err != nil {
return "", 0, err
}
return totpCode, version, nil
return generateSpotifyTOTP(time.Now())
}
func (c *SpotifyClient) getAccessToken() error {