Building and returning JWTs on login

* Created Util package for assorted items
* Currently generates an HMAC key on startup, to be changed
* JWT also includes login role
This commit is contained in:
🐙PiperYxzzy
2022-04-30 16:30:07 +02:00
parent d1c31e0fd4
commit 6db02148ea
3 changed files with 57 additions and 2 deletions

12
util/util.go Normal file
View File

@@ -0,0 +1,12 @@
package util
import "crypto/rand"
func GenerateHmac() []byte {
b := make([]byte, 64)
if _, err := rand.Read(b); err != nil {
panic(err)
}
return b
}