updated dependencies
This commit is contained in:
parent
c3076c328a
commit
407ec638fe
176 changed files with 15864 additions and 4354 deletions
8
vendor/github.com/pquerna/otp/.travis.yml
generated
vendored
8
vendor/github.com/pquerna/otp/.travis.yml
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
language: go
|
||||
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
|
||||
go:
|
||||
- "1.8"
|
||||
- "1.9"
|
||||
- "1.10"
|
||||
- "tip"
|
||||
- "1.12"
|
||||
|
|
|
|||
8
vendor/github.com/pquerna/otp/go.mod
generated
vendored
Normal file
8
vendor/github.com/pquerna/otp/go.mod
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
module github.com/pquerna/otp
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc
|
||||
github.com/stretchr/testify v1.3.0
|
||||
)
|
||||
11
vendor/github.com/pquerna/otp/go.sum
generated
vendored
Normal file
11
vendor/github.com/pquerna/otp/go.sum
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
github.com/boombuler/barcode v1.0.0 h1:s1TvRnXwL2xJRaccrdcBQMZxq6X7DvsMogtmJeHDdrc=
|
||||
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI=
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
18
vendor/github.com/pquerna/otp/hotp/hotp.go
generated
vendored
18
vendor/github.com/pquerna/otp/hotp/hotp.go
generated
vendored
|
|
@ -146,12 +146,16 @@ type GenerateOpts struct {
|
|||
AccountName string
|
||||
// Size in size of the generated Secret. Defaults to 10 bytes.
|
||||
SecretSize uint
|
||||
// Secret to store. Defaults to a randomly generated secret of SecretSize. You should generally leave this empty.
|
||||
Secret []byte
|
||||
// Digits to request. Defaults to 6.
|
||||
Digits otp.Digits
|
||||
// Algorithm to use for HMAC. Defaults to SHA1.
|
||||
Algorithm otp.Algorithm
|
||||
}
|
||||
|
||||
var b32NoPadding = base32.StdEncoding.WithPadding(base32.NoPadding)
|
||||
|
||||
// Generate creates a new HOTP Key.
|
||||
func Generate(opts GenerateOpts) (*otp.Key, error) {
|
||||
// url encode the Issuer/AccountName
|
||||
|
|
@ -174,13 +178,17 @@ func Generate(opts GenerateOpts) (*otp.Key, error) {
|
|||
// otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
|
||||
|
||||
v := url.Values{}
|
||||
secret := make([]byte, opts.SecretSize)
|
||||
_, err := rand.Read(secret)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if len(opts.Secret) != 0 {
|
||||
v.Set("secret", b32NoPadding.EncodeToString(opts.Secret))
|
||||
} else {
|
||||
secret := make([]byte, opts.SecretSize)
|
||||
_, err := rand.Read(secret)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.Set("secret", b32NoPadding.EncodeToString(secret))
|
||||
}
|
||||
|
||||
v.Set("secret", strings.TrimRight(base32.StdEncoding.EncodeToString(secret), "="))
|
||||
v.Set("issuer", opts.Issuer)
|
||||
v.Set("algorithm", opts.Algorithm.String())
|
||||
v.Set("digits", opts.Digits.String())
|
||||
|
|
|
|||
20
vendor/github.com/pquerna/otp/totp/totp.go
generated
vendored
20
vendor/github.com/pquerna/otp/totp/totp.go
generated
vendored
|
|
@ -18,8 +18,6 @@
|
|||
package totp
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/pquerna/otp"
|
||||
"github.com/pquerna/otp/hotp"
|
||||
|
||||
|
|
@ -138,12 +136,16 @@ type GenerateOpts struct {
|
|||
Period uint
|
||||
// Size in size of the generated Secret. Defaults to 20 bytes.
|
||||
SecretSize uint
|
||||
// Secret to store. Defaults to a randomly generated secret of SecretSize. You should generally leave this empty.
|
||||
Secret []byte
|
||||
// Digits to request. Defaults to 6.
|
||||
Digits otp.Digits
|
||||
// Algorithm to use for HMAC. Defaults to SHA1.
|
||||
Algorithm otp.Algorithm
|
||||
}
|
||||
|
||||
var b32NoPadding = base32.StdEncoding.WithPadding(base32.NoPadding)
|
||||
|
||||
// Generate a new TOTP Key.
|
||||
func Generate(opts GenerateOpts) (*otp.Key, error) {
|
||||
// url encode the Issuer/AccountName
|
||||
|
|
@ -170,13 +172,17 @@ func Generate(opts GenerateOpts) (*otp.Key, error) {
|
|||
// otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
|
||||
|
||||
v := url.Values{}
|
||||
secret := make([]byte, opts.SecretSize)
|
||||
_, err := rand.Read(secret)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if len(opts.Secret) != 0 {
|
||||
v.Set("secret", b32NoPadding.EncodeToString(opts.Secret))
|
||||
} else {
|
||||
secret := make([]byte, opts.SecretSize)
|
||||
_, err := rand.Read(secret)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.Set("secret", b32NoPadding.EncodeToString(secret))
|
||||
}
|
||||
|
||||
v.Set("secret", strings.TrimRight(base32.StdEncoding.EncodeToString(secret), "="))
|
||||
v.Set("issuer", opts.Issuer)
|
||||
v.Set("period", strconv.FormatUint(uint64(opts.Period), 10))
|
||||
v.Set("algorithm", opts.Algorithm.String())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue