This commit is contained in:
aozhiwei 2024-07-13 16:51:31 +08:00
parent 81e5f65f46
commit baebc1dff0

View File

@ -1,12 +1,9 @@
package system package system
import ( import (
"crypto/md5"
"encoding/hex"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"net/http" "net/http"
"q5" . "main/global"
"time"
) )
type MetaMaskApi struct { type MetaMaskApi struct {
@ -21,9 +18,7 @@ func (this *MetaMaskApi) GetNonce(c *gin.Context) {
}) })
return return
} }
timeUnixNano := time.Now().UnixNano() nonce := GetSessionMgr().GenNonce()
sum := md5.Sum([]byte(account + "_" + q5.ToString(timeUnixNano)))
nonce := hex.EncodeToString(sum[:])
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"code": 0, "code": 0,
"message": "success", "message": "success",