mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
Fixing build break
This commit is contained in:
parent
801d3bf95c
commit
f3e31fe795
@ -1,7 +1,10 @@
|
|||||||
package keys
|
package keys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"encoding/base64"
|
||||||
)
|
)
|
||||||
|
|
||||||
var alphaNumericTable = []byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
var alphaNumericTable = []byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||||
@ -34,13 +37,16 @@ func GetRandomAlphaNumericFull(size int) ([]byte, error) {
|
|||||||
|
|
||||||
func GetRandomBase64(size int) ([]byte, error) {
|
func GetRandomBase64(size int) ([]byte, error) {
|
||||||
rb := make([]byte, size)
|
rb := make([]byte, size)
|
||||||
n, err := rand.Read(rb)
|
_, err := rand.Read(rb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
dest := make([]byte, n)
|
var bytesBuffer bytes.Buffer
|
||||||
base64.URLEncoding.EncodeTo(dest, rb)
|
writer := bufio.NewWriter(&bytesBuffer)
|
||||||
return dest, nil
|
encoder := base64.NewEncoder(base64.StdEncoding, writer)
|
||||||
|
encoder.Write(rb)
|
||||||
|
encoder.Close()
|
||||||
|
return bytesBuffer.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ValidateAccessKey(key []byte) bool {
|
func ValidateAccessKey(key []byte) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user