Add back privatekey, but automatically generate it if it does not exist

This commit is contained in:
Kristoffer Dalby 2021-11-28 09:17:18 +00:00
parent 32006f3a20
commit 34f4109fbd
4 changed files with 73 additions and 16 deletions

2
api.go
View file

@ -34,7 +34,7 @@ func (h *Headscale) KeyHandler(ctx *gin.Context) {
ctx.Data(
http.StatusOK,
"text/plain; charset=utf-8",
[]byte(MachinePublicKeyStripPrefix(*h.publicKey)),
[]byte(MachinePublicKeyStripPrefix(h.privateKey.Public())),
)
}