encoding hmac secret base 64

This commit is contained in:
Lukas Bachschwell 2018-11-16 15:29:57 +01:00
parent 6fe3cb9bd7
commit 4b0a7ebf75
1 changed files with 4 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package tokenTools
import (
"crypto/rand"
"encoding/base64"
"fmt"
jwt "github.com/dgrijalva/jwt-go"
@ -20,7 +21,9 @@ func GenerateSecret() []byte {
// InitJWTService generate the secret to verify JWTs and store it in memory
func InitTokenToolsService() {
hmacSecret = GenerateSecret()
fmt.Println("InitJWTService", hmacSecret)
encodedSecret := base64.StdEncoding.EncodeToString(hmacSecret)
fmt.Println("InitJWTService", encodedSecret)
// TODO: This needs to be replaced with reading rsa keys, there needs to be a automatic generation of these if they do not exist
}