Actions
이슈 #411
진행중
JL
JL
Supabase GoTrue 인증 전환 — wallet-based auth 제거 및 GoTrue JWT 통합
이슈 #411:
Supabase GoTrue 인증 전환 — wallet-based auth 제거 및 GoTrue JWT 통합
설명
개요¶
기존 wallet address 기반 secp256k1 challenge/verify 인증을 Supabase GoTrue(자체 호스팅)로 전환한다.
배경¶
- 기존 구조에서는 wallet private key = 사용자 identity였음
- 모바일 다중 디바이스 환경에서 private key 동기화 불가 → 근본적 문제
- wallet address는 보상 수신 주소(reward destination)로만 사용되어야 하며, 특정 사용자에 종속되지 않아야 함
변경 범위¶
인증 레이어
- GoTrue(supabase/gotrue) 서비스를 docker-compose에 추가 (port 9011)
- JWT 검증을 표준 HMAC-SHA256으로 교체 (
jsonwebtokencrate, GoTrue 호환) -
AuthContext:user_id(GoTrue UUID) +email+token_type("user" | "node") - Node 토큰은 별도 유지 (
typ: "node", sub = node_id)
프로토 / AuthService
-
AuthServiceRPC를GenerateKeypair하나로 축소 (Challenge/Verify/Register 제거) - secp256k1 챌린지는 노드 등록(NodeService)에만 남김
DB 스키마 (migrations/0006_supabase_auth_schema.sql)
-
accounts테이블 재설계:user_id UUID PK(GoTrue sub),email,display_name,profile_icon -
wallets테이블 신설:user_id → wallet_address(1:N, 보상 지갑 목록) -
nodes.owner_user_id UUID컬럼 추가 (노드 소유 사용자 추적) - 기존 wallet address 기반 계정 데이터 DROP
핸들러 변경
-
register_node: GoTrue JWT 필수,owner_user_id= JWT sub -
heartbeat/delete_node:owner_user_id기준 소유권 검증 -
get_user: wallet →wallets테이블 join으로 조회 - Admin HTTP 콘솔: challenge/verify 엔드포인트 제거, GoTrue JWT paste UI 추가
tools/client.py
- Python gRPC 테스트 클라이언트에서 Auth Challenge/Verify 메뉴 제거
GoTrue 설정 (개발)¶
GOTRUE_JWT_SECRET: JWT_SECRET 환경변수와 동일값으로 설정
GOTRUE_MAILER_AUTOCONFIRM: true
GOTRUE_SITE_URL: http://localhost:3000
Sign-up: POST :9011/signup {"email":"…","password":"…"}
Login: POST :9011/token?grant_type=password {"email":"…","password":"…"}
Actions