Skip to content

v4.0.0: Platform Extensions for Pito

Latest

Choose a tag to compare

@ryotagtagtag-wq ryotagtagtag-wq released this 19 Oct 03:17
· 26 commits to main since this release
7030b5b

🎯 Overview

koshi v4.0.0 extends the platform as a backend for Pito (React Native/Expo messenger) with group chat, E2E key management, read receipts, and typing indicators.

✨ New Features

👥 E2EE Group Chats (Sender Keys)

  • Create groups with up to 100 members
  • All groups are always end-to-end encrypted
  • Server only verifies signatures, never decrypts
  • Sender Keys for group E2E (MLS migration path exists)

📱 X3DH Key Management

  • Device registration with identityKey, signedPreKey, preKeySignature
  • One-time prekey consumption per session
  • Key bundle fetching for X3DH handshake

✅ Read Receipts

  • Unified table for DMs and group messages
  • WebSocket broadcast for instant cross-device sync

⌨️ Typing Indicators

  • Real-time typing start/stop for DMs and groups
  • Broadcast to conversation participants only

🔧 TypeScript SDK

npm install @ryopc/koshi
import { Group, GroupMessage, Device, KeyBundle, WSEventMap } from '@ryopc/koshi/types'

📡 New API Endpoints

Category Endpoints
Groups GET/POST /api/groups, GET/PATCH/DELETE /api/groups/:id, POST/DELETE /api/groups/:id/members, GET/POST /api/groups/:id/messages, PUT /api/groups/:id/messages/:msgId/read
Devices GET/POST /api/devices, DELETE /api/devices/:deviceId, GET /api/devices/user/:userId
Keys GET /api/keys/bundle/:userId

🔌 New WebSocket Events

Client → Server Server → Client
group:create group_created
group:update group_updated
group:delete group_deleted
group:invite group_member_added
group:leave group_member_removed
group:message group_message
group:read group_message_read
typing:start typing_start
typing:stop typing_stop
key_bundle:request key_bundle_response

🗄️ New Database Tables

  • groups - E2EE group chats
  • group_members - Membership with roles (admin/member)
  • group_messages - Encrypted group messages
  • message_read_receipts - Unified read receipts
  • user_devices - X3DH device keys
  • group_session_keys - Sender Keys

🛠️ New CLI Commands

kb groups [list|create|delete|info]
kb group <name> members [add|remove|list]
kb devices [list|remove]
kb keys [rotate|bundle]
kb admin promote <username>
kb config set <key> <value>

⚠️ Important Notes

  • PostgreSQL required for new features (not available in P2P/SQLite mode)
  • Existing APIs (DMs, posts, follows, P2P) remain unchanged
  • All groups are E2EE (isE2EE: true always)
  • E2E is client responsibility — server only relays, verifies signatures

📦 Installation

npm install -g @ryopc/koshi@4.0.0