2022-07-18 20:36:31 +08:00
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
2025-04-23 20:36:32 +08:00
|
|
|
"mayfly-go/internal/pkg/utils"
|
2022-07-18 20:36:31 +08:00
|
|
|
"mayfly-go/pkg/biz"
|
2023-01-14 16:29:52 +08:00
|
|
|
"mayfly-go/pkg/req"
|
2022-07-18 20:36:31 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Common struct {
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-16 23:29:18 +08:00
|
|
|
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()
|
2024-12-16 23:29:18 +08:00
|
|
|
biz.ErrIsNilAppendErr(err, "rsa - failed to genenrate public key")
|
2022-07-18 20:36:31 +08:00
|
|
|
rc.ResData = publicKeyStr
|
|
|
|
|
}
|