small refactor and fixes

This commit is contained in:
yusing
2024-12-03 11:45:10 +08:00
parent cebc0c5405
commit 5d5c623f09
12 changed files with 46 additions and 52 deletions

View File

@@ -1,7 +1,6 @@
package common
import (
"crypto/rand"
"crypto/sha512"
"encoding/base64"
@@ -14,14 +13,6 @@ func HashPassword(pwd string) []byte {
return h.Sum(nil)
}
func generateJWTKey(size int) string {
bytes := make([]byte, size)
if _, err := rand.Read(bytes); err != nil {
log.Panic().Err(err).Msg("failed to generate jwt key")
}
return base64.StdEncoding.EncodeToString(bytes)
}
func decodeJWTKey(key string) []byte {
if key == "" {
return nil