feat: encrypt login and install request #852

This commit is contained in:
Jacky 2025-02-07 21:10:11 +08:00
parent 8e523258b5
commit 20531971cf
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
16 changed files with 265 additions and 108 deletions

22
api/crypto/crypto.go Normal file
View file

@ -0,0 +1,22 @@
package crypto
import (
"net/http"
"github.com/0xJacky/Nginx-UI/api"
"github.com/0xJacky/Nginx-UI/internal/sign"
"github.com/gin-gonic/gin"
)
// GetPublicKey generates a new ED25519 key pair and registers it in the cache
func GetPublicKey(c *gin.Context) {
sign, err := sign.GetCryptoParams()
if err != nil {
api.ErrHandler(c, err)
return
}
c.JSON(http.StatusOK, gin.H{
"public_key": sign.PublicKey,
})
}