uniwrtc 1.9.0 → 2.0.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniwrtc",
3
- "version": "1.9.0",
3
+ "version": "2.0.0",
4
4
  "description": "A universal WebRTC signaling service",
5
5
  "main": "server.js",
6
6
  "type": "module",
package/src/main.js CHANGED
@@ -711,6 +711,11 @@ async function connectNostr() {
711
711
  log(`Ignoring non-answer in signal-answer from ${peerId.substring(0, 6)}...`, 'warning');
712
712
  return;
713
713
  }
714
+ // Perfect negotiation guard: only accept an answer when we have a local offer
715
+ if (pc.signalingState !== 'have-local-offer') {
716
+ log(`Ignoring answer; unexpected signaling state: ${pc.signalingState}`, 'warning');
717
+ return;
718
+ }
714
719
  await pc.setRemoteDescription(new RTCSessionDescription(payload.sdp));
715
720
  await flushPendingIce(peerId);
716
721
  }