mirror of
https://github.com/go-gitea/gitea
synced 2025-07-06 10:37:20 +00:00
Update github.com/pquerna/otp from untagged to v1.2.0 (#11358)
This commit is contained in:
13
vendor/github.com/pquerna/otp/otp.go
generated
vendored
13
vendor/github.com/pquerna/otp/otp.go
generated
vendored
@ -54,17 +54,19 @@ type Key struct {
|
||||
// NewKeyFromURL creates a new Key from an TOTP or HOTP url.
|
||||
//
|
||||
// The URL format is documented here:
|
||||
// https://code.google.com/p/google-authenticator/wiki/KeyUriFormat
|
||||
// https://github.com/google/google-authenticator/wiki/Key-Uri-Format
|
||||
//
|
||||
func NewKeyFromURL(orig string) (*Key, error) {
|
||||
u, err := url.Parse(orig)
|
||||
s := strings.TrimSpace(orig)
|
||||
|
||||
u, err := url.Parse(s)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Key{
|
||||
orig: orig,
|
||||
orig: s,
|
||||
url: u,
|
||||
}, nil
|
||||
}
|
||||
@ -136,6 +138,11 @@ func (k *Key) Secret() string {
|
||||
return q.Get("secret")
|
||||
}
|
||||
|
||||
// URL returns the OTP URL as a string
|
||||
func (k *Key) URL() string {
|
||||
return k.url.String()
|
||||
}
|
||||
|
||||
// Algorithm represents the hashing function to use in the HMAC
|
||||
// operation needed for OTPs.
|
||||
type Algorithm int
|
||||
|
Reference in New Issue
Block a user