feat: add EIP712 verification, auth service implemention and jwt gen

This commit is contained in:
2025-09-07 14:35:40 +03:30
parent 6d16a6ea8c
commit 5c5df48644
10 changed files with 244 additions and 62 deletions
+1 -7
View File
@@ -11,9 +11,7 @@ type UserSession struct {
Base
UserID uuid.UUID
User *User
WalletID uuid.UUID
IP string
Agent string
WalletID string
ExpireAt time.Time
}
@@ -28,8 +26,6 @@ func CastSessionToStorage(s domain.UserSession) *UserSession {
UserID: s.UserID,
User: CastUserToStorage(s.User),
WalletID: s.WalletID,
IP: s.IPaddress,
Agent: s.Agent,
ExpireAt: s.ExpiresAt,
}
}
@@ -40,8 +36,6 @@ func CastSessionToDomain(s UserSession) *domain.UserSession {
UserID: s.UserID,
User: *CastUserToDomain(*s.User),
WalletID: s.WalletID,
IPaddress: s.IP,
Agent: s.Agent,
ExpiresAt: s.ExpireAt,
CreatedAt: s.CreatedAt,
UpdatedAt: s.UpdatedAt,
+8
View File
@@ -48,3 +48,11 @@ func (r *UserRepository) Update(ctx context.Context, user *domain.User) error {
func (r *UserRepository) Delete(ctx context.Context, id uuid.UUID) error {
return r.db.WithContext(ctx).Delete(&types.User{}, "id = ?", id).Error
}
func (r *UserRepository) GetByPubKey(ctx context.Context, pubKey string) (*domain.User, error) {
var user types.User
if err := r.db.WithContext(ctx).First(&user, "pub_key = ?", pubKey).Error; err != nil {
return nil, err
}
return types.CastUserToDomain(user), nil
}