Skip to content

KintareStudio/OpenP2P

Repository files navigation

OpenP2P (OpenKintare)

A public instance is available at https://openp2p.kintare.studio — ready to use in your mods.

Drop-in server replacement for Mojang's Signaling, P2P, and Presence services derived from KintareSignaling — for use since the official infrastructure is unavailable for now.

Requirements

  • Node.js 22+
  • A running coturn server (Required for NAT traversal and TTL credentials)

Setup

Required environment variables

  • SIGNALING_BASE public base URL used by the discovery endpoint
  • TURN_DOMAIN hostname of your TURN server
  • TURN_PORT port of your TURN server
  • TURN_REST_SECRET shared secret for TURN REST credentials

Production

  1. Create a docker-compose.yml (example — adjust values for your environment):
services:
  openp2p:
    image: ghcr.io/kintarestudio/openp2p
    restart: unless-stopped
    ports:
      - "3007:3007"
    volumes:
      - ./data:/app/data
    environment:
      # Server
      PORT: 3007
      SIGNALING_BASE: http://localhost:3007

      # Auth
      API_PUBLIC_KEYS: https://api.minecraftservices.com/publickeys # You can use custom Authservers if they bundle a pmid and pfd.id onto their tokens.
      AUTH_REFRESH_SECONDS: 172800

      # SQLite
      FRIENDS_DB_PATH: ./data/openp2p.sqlite

      # TURN
      TURN_DOMAIN: turn.example.com
      TURN_PORT: 3478
      TURN_REST_SECRET: CHANGE_ME
      TURN_REST_TTL_SECONDS: 604800

      # TURN health checks
      TURN_HEALTH_CHECK_INTERVAL_SECONDS: 10
      TURN_HEALTH_CHECK_TIMEOUT_SECONDS: 3
  1. start it:
docker compose up -d
  1. Put it behind a trusted reverse proxy.

DEVELOPMENT:

  1. Install dependencies
npm install
  1. Run in dev
npm run dev

Features

Health

  • GET /health — returns service status including TURN health

Discovery

  • GET /api/v1.0/configuration/java — requires x-mojangauth
    • Always returns a Request-Id header (echoes the request value if it's a valid UUID, otherwise generates a new one)
    • Returns Session-Id only if provided in the request
    • Includes turnUrls in the response body

WebSocket signaling

  • WS /ws/v1.0/messaging/connect/java — requires x-mojangauth
    • One active connection per player; new connections replace the previous one
    • Disconnects after 60s if no data is sent since connect, or after 120s of inactivity

Friends

  • POST /friends — registers or replaces the authenticated player's friend list

Presence

  • POST /presence — updates the caller's presence and returns the current presence of online friends

API reference

POST /friends

{
  "friends": [
    { "profileId": "61699b2ed3274a019f1e0ea8c3f06bc6", "name": "Dinnerbone" }
  ],
  "incomingRequests": [
    { "profileId": "853c80ef3c3749fdaa49938b674adae6", "name": "jeb_" }
  ],
  "outgoingRequests": [
    { "profileId": "069a79f444e94726a5befca90e38aaf5", "name": "Notch" }
  ],
  "empty": false
}

POST /presence

{
  "status": "PLAYING_HOSTED_SERVER",
  "joinInfo": {
    "value": null,
    "invites": ["069a79f4-44e9-4726-a5be-fca90e38aaf5"]
  }
}

Valid status values: ONLINE, OFFLINE, PLAYING_OFFLINE, PLAYING_REALMS, PLAYING_SERVER, PLAYING_HOSTED_SERVER

About

Drop-in server replacement for Mojang's Signaling, P2P, and Presence services.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors