feat: Implement content-based offer IDs with SHA-256 hashing

- Added hash-id.ts utility for SHA-256 content hashing
- Offer IDs now generated from hash of {sdp, topics} (sorted)
- Removed peerId from hash (inferred from authentication)
- Server generates deterministic IDs for idempotent offer creation
- Updated SQLite and D1 storage implementations
- Removed optional id field from CreateOfferRequest
- Same offer content always produces same ID

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-16 16:34:28 +01:00
commit fe912e6a94
27 changed files with 4178 additions and 0 deletions

27
package.json Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "@xtr-dev/rondevu-server",
"version": "0.1.0",
"description": "Topic-based peer discovery and signaling server for distributed P2P applications",
"main": "dist/index.js",
"scripts": {
"build": "node build.js",
"typecheck": "tsc",
"dev": "ts-node src/index.ts",
"start": "node dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "npx wrangler deploy src/worker.ts --var VERSION:$(git rev-parse --short HEAD)"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20251014.0",
"@types/better-sqlite3": "^7.6.13",
"@types/node": "^24.9.2",
"esbuild": "^0.25.11",
"ts-node": "^10.9.2",
"typescript": "^5.9.3"
},
"dependencies": {
"@hono/node-server": "^1.19.6",
"better-sqlite3": "^12.4.1",
"hono": "^4.10.4"
}
}