mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 16:30:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			508 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			508 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package api
 | 
						|
 | 
						|
import (
 | 
						|
	"mayfly-go/pkg/biz"
 | 
						|
	"mayfly-go/pkg/req"
 | 
						|
	"mayfly-go/pkg/utils/cryptox"
 | 
						|
)
 | 
						|
 | 
						|
type Common struct {
 | 
						|
}
 | 
						|
 | 
						|
func (c *Common) ReqConfs() *req.Confs {
 | 
						|
	reqs := [...]*req.Conf{
 | 
						|
		// 获取公钥
 | 
						|
		req.NewGet("/public-key", c.RasPublicKey).DontNeedToken(),
 | 
						|
	}
 | 
						|
 | 
						|
	return req.NewConfs("/common", reqs[:]...)
 | 
						|
}
 | 
						|
 | 
						|
func (i *Common) RasPublicKey(rc *req.Ctx) {
 | 
						|
	publicKeyStr, err := cryptox.GetRsaPublicKey()
 | 
						|
	biz.ErrIsNilAppendErr(err, "rsa - failed to genenrate public key")
 | 
						|
	rc.ResData = publicKeyStr
 | 
						|
}
 |