Unmarshal keys in the non-deprecated way

This commit is contained in:
Kristoffer Dalby 2021-11-26 23:50:42 +00:00
parent 0012c76170
commit c38f00fab8
7 changed files with 27 additions and 40 deletions

View file

@ -15,7 +15,6 @@ import (
"github.com/gin-gonic/gin"
"github.com/patrickmn/go-cache"
"github.com/rs/zerolog/log"
"go4.org/mem"
"golang.org/x/oauth2"
"gorm.io/gorm"
"tailscale.com/types/key"
@ -192,7 +191,8 @@ func (h *Headscale) OIDCCallback(ctx *gin.Context) {
machineKeyStr, machineKeyOK := machineKeyIf.(string)
machineKey, err := key.ParseMachinePublicUntyped(mem.S(machineKeyStr))
var machineKey key.MachinePublic
err = machineKey.UnmarshalText([]byte(machineKeyStr))
if err != nil {
log.Error().
Msg("could not parse machine public key")