Skip to content

Repository files navigation

MiID Managed DID SSO Prototype

로컬에서 다음을 동작시키는 최소 구현입니다.

  • Wallet 서버: DID 생성/공개키 조회/챌린지 서명
  • Auth Gateway 서버: 챌린지/검증/토큰/동의/보호 API
  • Service Backend/Frontend: 승인 후 SSE로 인증 성공 수신

Run

cd /Users/whyun/workspace/MiID
npm install

지갑 앱(wallet + menubar):

npm run start:wallet

게이트웨이:

npm run start:gateway

서비스 실행(브라우저 UI):

npm run start:service
# open http://localhost:3000

디버그 모드:

npm run dev:wallet
npm run dev:gaetway
npm run dev:service

승인 요청 자동 테스트:

npm run test:approval

이 스크립트는 Approved까지만 진행합니다(Active 전환 안 함). 승인은 메뉴바 UI에서 직접 수행합니다.

서비스 최종 교환(Approved -> Active) 테스트:

npm run test:finalize

승인+최종교환 한 번에:

npm run test:e2e

수동 UX 흐름용 분리 테스트:

npm run test:request   # 승인요청 생성 (메뉴바 Pending으로 확인)
npm run test:finalize  # 메뉴바에서 승인 후 최종 교환 -> Active

세션 수동 철회:

  • 메뉴바 Active Sessions 카드에서 Revoke 버튼 클릭

참고:

  • 메뉴바 앱이 Wallet 서버를 내부에서 함께 실행합니다.
  • 승인 요청 알림은 Gateway SSE(GET /v1/wallet/events)로 받기 때문에 주기 폴링을 사용하지 않습니다.
  • 메뉴바 화면에는 Pending RequestsActive Sessions(유효 인증 목록)이 표시됩니다.
  • 개발 모드(npm run dev:*)에서는 macOS 알림 설정 이름이 Electron으로 보일 수 있습니다.
  • MiID 이름으로 보이게 하려면 패키징된 앱으로 실행하세요.

macOS 앱 패키징:

npm run build:mac
open dist/MiID-darwin-arm64/MiID.app

메뉴바 앱은 기본적으로 다음을 사용합니다.

  • Gateway: http://localhost:14000
  • Wallet: http://localhost:17000
  • DID: data/wallet.json의 첫 번째 wallet DID (또는 WALLET_DID 환경변수)

메뉴바 게이트웨이 설정 우선순위:

  1. GATEWAY_URL 환경변수
  2. MIID_CONFIG_PATH로 지정한 JSON 파일
  3. apps/wallet/config.json (패키징 시 포함 가능)
  4. config/wallet.config.json (개발 기본값)
  5. fallback: http://localhost:14000

Default Ports

  • Wallet: 17000
  • Gateway: 14000
  • Service Backend: 15000
  • Service Frontend: 3000

환경변수로 변경 가능:

  • WALLET_PORT
  • GATEWAY_PORT
  • SERVICE_ID (gateway 등록 서비스 식별자, 기본 service-test)
  • SERVICE_CLIENT_ID (gateway 등록 클라이언트 ID, 기본 web-client)
  • SERVICE_CLIENT_SECRET (gateway 서비스 인증 시크릿, 기본 dev-service-secret)
  • SERVICE_REDIRECT_URI (허용 redirect uri, 기본 https://service-test.local/callback)

주요 API

Gateway:

  • POST /v1/auth/challenge
  • POST /v1/auth/reuse-session
  • POST /v1/auth/verify
  • POST /v1/token/exchange
  • POST /v1/consents
  • GET /v1/consents/:consentId
  • DELETE /v1/consents/:consentId
  • GET /v1/services/:serviceId/profile
  • GET /v1/auth/challenges/:challengeId/status
  • GET /v1/wallet/events?did=... (SSE)
  • GET /v1/service/events?challenge_id=... (SSE)
  • GET /v1/wallet/challenges?did=...
  • GET /v1/wallet/approved?did=...
  • GET /v1/wallet/sessions?did=...
  • DELETE /v1/wallet/approved/:authCode
  • DELETE /v1/wallet/sessions/:sessionId
  • POST /v1/wallet/challenges/:challengeId/approve
  • POST /v1/wallet/challenges/:challengeId/deny

서비스 인증이 필요한 엔드포인트:

  • POST /v1/auth/challenge
  • POST /v1/token/exchange
  • GET /v1/service/events?challenge_id=...

위 3개 호출 시 헤더 필요:

  • X-Client-Id: <registered client id>
  • X-Client-Secret: <registered client secret>

Wallet:

  • POST /v1/wallets
  • GET /v1/wallets/:walletId
  • GET /v1/wallets/by-did/:did
  • POST /v1/wallets/sign

Storage

실행 중 데이터는 로컬 파일로 저장됩니다.

  • data/wallet.json
  • data/gateway.json

About

My ID

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages