1
0
Fork 0
forked from forgejo/forgejo

Update github.com/pquerna/otp from untagged to v1.2.0 (#11358)

This commit is contained in:
6543 2020-05-10 14:50:16 +02:00 committed by GitHub
parent 57b6f83191
commit 43bb85908d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 192 additions and 54 deletions

13
vendor/github.com/pquerna/otp/otp.go generated vendored
View file

@ -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