feat: add EIP712 verification, auth service implemention and jwt gen
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user