diff options
-rw-r--r-- | auth.go | 4 | ||||
-rw-r--r-- | utils.go | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -62,7 +62,7 @@ func generateAuthorizationURL() (string, error) { * hacky atomics or having a multiple goroutines to handle * authentication, neither of which are desirable. */ - nonce, err := random(tokenLength) + nonce, err := randomBytes(tokenLength) if err != nil { return "", err } @@ -189,7 +189,7 @@ func handleAuth(w http.ResponseWriter, req *http.Request) { return } - cookieValue, err := random(tokenLength) + cookieValue, err := randomBytes(tokenLength) if err != nil { wstr(w, http.StatusInternalServerError, err.Error()) return @@ -51,7 +51,7 @@ func wstr(w http.ResponseWriter, code int, msg string) { * encoded string. It's divided by three because we're using base64 and it's * ideal to ensure that the entropy remains consistent throughout the string. */ -func random(sz int) (string, error) { +func randomBytes(sz int) (string, error) { r := make([]byte, 3*sz) _, err := rand.Read(r) if err != nil { |