nginx_ui/nginx-ui-dev/api/crypto/crypto.go

23 lines
432 B
Go
Raw Permalink Normal View History

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