Files
mayfly-go/server/internal/common/api/common.go

26 lines
507 B
Go
Raw Normal View History

package api
import (
2025-04-23 20:36:32 +08:00
"mayfly-go/internal/pkg/utils"
"mayfly-go/pkg/biz"
2023-01-14 16:29:52 +08:00
"mayfly-go/pkg/req"
)
type Common struct {
}
func (c *Common) ReqConfs() *req.Confs {
reqs := [...]*req.Conf{
// 获取公钥
req.NewGet("/public-key", c.RasPublicKey).DontNeedToken(),
}
return req.NewConfs("/common", reqs[:]...)
}
2023-01-14 16:29:52 +08:00
func (i *Common) RasPublicKey(rc *req.Ctx) {
2025-04-23 20:36:32 +08:00
publicKeyStr, err := utils.GetRsaPublicKey()
biz.ErrIsNilAppendErr(err, "rsa - failed to genenrate public key")
rc.ResData = publicKeyStr
}