crypto.go 427 B

12345678910111213141516171819202122
  1. package crypto
  2. import (
  3. "net/http"
  4. "github.com/0xJacky/Nginx-UI/internal/crypto"
  5. "github.com/gin-gonic/gin"
  6. "github.com/uozi-tech/cosy"
  7. )
  8. // GetPublicKey generates a new ED25519 key pair and registers it in the cache
  9. func GetPublicKey(c *gin.Context) {
  10. params, err := crypto.GetCryptoParams()
  11. if err != nil {
  12. cosy.ErrHandler(c, err)
  13. return
  14. }
  15. c.JSON(http.StatusOK, gin.H{
  16. "public_key": params.PublicKey,
  17. })
  18. }