Move to crypto/rand for nonce generation (#3324)

Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
Matthias Hanel
2022-08-03 06:52:26 +02:00
committed by GitHub
parent 8ae0757e91
commit ed2cb280cc
2 changed files with 2 additions and 3 deletions

View File

@@ -14,6 +14,7 @@
package server
import (
"crypto/rand"
"encoding/base64"
)
@@ -41,6 +42,6 @@ func (s *Server) nonceRequired() bool {
func (s *Server) generateNonce(n []byte) {
var raw [nonceRawLen]byte
data := raw[:]
s.prand.Read(data)
rand.Read(data)
base64.RawURLEncoding.Encode(n, data)
}

View File

@@ -114,7 +114,6 @@ type Server struct {
stats
mu sync.RWMutex
kp nkeys.KeyPair
prand *rand.Rand
info Info
configFile string
optsMu sync.RWMutex
@@ -378,7 +377,6 @@ func NewServer(opts *Options) (*Server, error) {
kp: kp,
configFile: opts.ConfigFile,
info: info,
prand: rand.New(rand.NewSource(time.Now().UnixNano())),
opts: opts,
done: make(chan bool, 1),
start: now,