fix(session-coordinator): 保存 WalletName 和 InviteCode 到数据库

- CreateSessionInput 添加 WalletName 和 InviteCode 字段
- gRPC handler 从请求中读取并传递这些字段
- CreateSession use case 在创建会话时设置这些字段

修复: 通过邀请码查询会话时找不到记录的问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-29 03:07:44 -08:00
parent 591dc50eb9
commit 21985abde5
3 changed files with 16 additions and 0 deletions

View File

@ -159,6 +159,8 @@ func (s *SessionCoordinatorServer) CreateSession(
Participants: participants,
MessageHash: req.MessageHash,
ExpiresIn: time.Duration(req.ExpiresInSeconds) * time.Second,
WalletName: req.WalletName,
InviteCode: req.InviteCode,
}
// Parse and set keygen_session_id if provided (for signing sessions)

View File

@ -55,6 +55,8 @@ type CreateSessionInput struct {
ExpiresIn time.Duration
DelegateUserShare *DelegateUserShare // For sign sessions with delegate party
KeygenSessionID uuid.UUID // For sign sessions: which keygen session's shares to use
WalletName string // For co_managed_keygen: wallet name
InviteCode string // For co_managed_keygen: invite code for participants
}
// ParticipantInfo contains information about a participant

View File

@ -138,6 +138,18 @@ func (uc *CreateSessionUseCase) Execute(
zap.String("keygen_session_id", req.KeygenSessionID.String()))
}
// 4.2 Set wallet name and invite code for co_managed_keygen sessions
if req.WalletName != "" {
session.WalletName = req.WalletName
}
if req.InviteCode != "" {
session.InviteCode = req.InviteCode
logger.Info("Co-managed keygen session created with invite code",
zap.String("session_id", session.ID.String()),
zap.String("wallet_name", req.WalletName),
zap.String("invite_code", req.InviteCode))
}
// 5. Add participants and generate join tokens
tokens := make(map[string]string)
if len(req.Participants) == 0 {