random string

update algorithm
consolidate MakeRandomString, RandomString & GenerateCrytoString into
one function
This commit is contained in:
Matthew R Kasun
2023-05-02 13:28:00 -04:00
parent ba396f1b5b
commit 6d6ba3aa7d
6 changed files with 19 additions and 54 deletions

View File

@@ -19,10 +19,7 @@ var jwtSecretKey []byte
func SetJWTSecret() {
currentSecret, jwtErr := FetchJWTSecret()
if jwtErr != nil {
newValue, err := GenerateCryptoString(64)
if err != nil {
logger.FatalLog("something went wrong when generating JWT signature")
}
newValue := RandomString(64)
jwtSecretKey = []byte(newValue) // 512 bit random password
if err := StoreJWTSecret(string(jwtSecretKey)); err != nil {
logger.FatalLog("something went wrong when configuring JWT authentication")