ref: authenticate handler

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

View File

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