ref: authenticate handler

This commit is contained in:
AmirMahdi Qiasvand 2025-09-07 16:46:59 +03:30
parent f4e5e074d3
commit dee9ce2f64

View File

@ -59,13 +59,11 @@ func (h *AuthHandler) Authenticate(c *fiber.Ctx) error {
challenge := &domain.Challenge{
Message: messageUUID,
//TODO: fetch from cache
TimeStamp: time.Now().UTC(),
ExpiresAt: time.Now().Add(5 * time.Minute),
}
clientIP := c.IP()
userAgent := c.Get("User-Agent")
userToken, err := h.authService.Authenticate(
c.Context(),
req.PubKey,
@ -73,8 +71,8 @@ func (h *AuthHandler) Authenticate(c *fiber.Ctx) error {
challenge,
// add chainID to cfg
1,
clientIP,
userAgent,
c.IP(),
c.Get("User-Agent"),
)
if err != nil {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{