WIP: stuff

This commit is contained in:
2025-04-05 14:27:36 -04:00
parent 93bc18022a
commit dd0995b241
47 changed files with 6148 additions and 474 deletions

View File

@ -169,6 +169,38 @@ func (h *Handler) UpdateProfilePicture(ctx context.Context, req *connect.Request
return res, nil
}
func (h *Handler) BeginPasskeyRegistration(ctx context.Context, req *connect.Request[userv1.BeginPasskeyRegistrationRequest]) (*connect.Response[userv1.BeginPasskeyRegistrationResponse], error) {
// Get user ID from context
userid, ok := interceptors.GetUserContext(ctx)
if !ok {
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("user not authenticated"))
}
// Get user
user := models.User{}
if err := h.db.First(&user, "id = ?", userid).Error; err != nil {
return nil, connect.NewError(connect.CodeInternal, err)
}
return connect.NewResponse(&userv1.BeginPasskeyRegistrationResponse{}), nil
}
func (h *Handler) FinishPasskeyRegistration(ctx context.Context, req *connect.Request[userv1.FinishPasskeyRegistrationRequest]) (*connect.Response[userv1.FinishPasskeyRegistrationResponse], error) {
// Get user ID from context
userid, ok := interceptors.GetUserContext(ctx)
if !ok {
return nil, connect.NewError(connect.CodeUnauthenticated, errors.New("user not authenticated"))
}
// Get user
user := models.User{}
if err := h.db.First(&user, "id = ?", userid).Error; err != nil {
return nil, connect.NewError(connect.CodeInternal, err)
}
return connect.NewResponse(&userv1.FinishPasskeyRegistrationResponse{}), nil
}
// func BeginRegistration(ctx context.Context) error {
// userid, ok := interceptors.GetUserContext(ctx)
// if !ok {