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 committed 2022-04-30 16:30:07 +02:00
1 parent d1c31e0fd4
commit 6db02148ea
3 files changed
+57 -2

No files matched your search

+12
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
}