rtc.io-server 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,15 @@ exports.addDefaultListeners = addDefaultListeners;
4
4
  const events_1 = require("./events");
5
5
  // The rtc.io client multiplexes all signaling (offer/answer/candidate/stream-meta)
6
6
  // over a single MESSAGE channel — these are the only events the server needs to relay.
7
+ //
8
+ // `source` is stamped server-side from the authenticated socket id, never trusted
9
+ // from the client: otherwise a room member could spoof another peer's id and inject
10
+ // offers/answers/candidates that appear to come from someone else. `target` stays
11
+ // client-controlled (it's the routing key) but must be a string.
7
12
  function rtcMessageHandler(socket, data) {
8
- socket.to(data.target).emit(events_1.RtcioEvents.MESSAGE, data);
13
+ if (!data || typeof data.target !== "string")
14
+ return;
15
+ socket.to(data.target).emit(events_1.RtcioEvents.MESSAGE, Object.assign(Object.assign({}, data), { source: socket.id }));
9
16
  }
10
17
  // Fast-path "this socket is leaving" notification. Without it, peers have to
11
18
  // wait on ICE consent freshness (~30 s, RFC 7675) to declare a vanished peer
@@ -1,9 +1,5 @@
1
1
  export declare const RtcioEvents: {
2
- readonly OFFER: "#rtcio:offer";
3
- readonly ANSWER: "#rtcio:answer";
4
- readonly CANDIDATE: "#rtcio:candidate";
5
2
  readonly MESSAGE: "#rtcio:message";
6
- readonly STREAM_META: "#rtcio:stream-meta";
7
3
  readonly INIT_OFFER: "#rtcio:init-offer";
8
4
  readonly PEER_LEFT: "#rtcio:peer-left";
9
5
  };
@@ -2,11 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RtcioEvents = void 0;
4
4
  exports.RtcioEvents = {
5
- OFFER: "#rtcio:offer",
6
- ANSWER: "#rtcio:answer",
7
- CANDIDATE: "#rtcio:candidate",
8
5
  MESSAGE: "#rtcio:message",
9
- STREAM_META: "#rtcio:stream-meta",
10
6
  INIT_OFFER: "#rtcio:init-offer",
11
7
  // Server → client. Fan out to a leaving socket's rooms so existing peers
12
8
  // can tear down their RTCPeerConnection immediately instead of waiting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rtc.io-server",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Signaling server for the rtc.io WebRTC client. Built on socket.io.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,22 +17,23 @@
17
17
  "server"
18
18
  ],
19
19
  "license": "MIT",
20
- "author": "",
20
+ "author": "solidet-com",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://github.com/<your-org>/rtc.io.git",
23
+ "url": "git+https://github.com/solidet-com/rtc.io.git",
24
24
  "directory": "rtc.io-server"
25
25
  },
26
26
  "bugs": {
27
- "url": "https://github.com/<your-org>/rtc.io/issues"
27
+ "url": "https://github.com/solidet-com/rtc.io/issues"
28
28
  },
29
- "homepage": "https://github.com/<your-org>/rtc.io#readme",
29
+ "homepage": "https://docs.rtcio.dev",
30
30
  "engines": {
31
31
  "node": ">=18"
32
32
  },
33
33
  "scripts": {
34
34
  "clean": "rm -rf dist",
35
35
  "build": "npm run clean && tsc",
36
+ "typecheck": "tsc --noEmit",
36
37
  "dev": "nodemon --watch '**/*.ts' --exec 'ts-node' ./index.ts",
37
38
  "prepack": "npm run build"
38
39
  },