refactor jwt secret

This commit is contained in:
2024-10-03 15:37:23 -05:00
parent 058429fff8
commit a95c0ed9b0
3 changed files with 33 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import (
"crypto/rand"
"encoding/base64"
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"go-nkode/hashset"
@@ -261,3 +262,12 @@ func GenerateRandomString(length int) string {
}
return string(b)
}
func ParseHexString(hexStr string) ([]byte, error) {
// Decode the hex string into bytes
bytes, err := hex.DecodeString(hexStr)
if err != nil {
return nil, err
}
return bytes, nil
}