Loop/Architecture/Fingerprint Validation: Difference between revisions

Line 135: Line 135:
== Proof-of-Concept Monkeypatch Shim ==
== Proof-of-Concept Monkeypatch Shim ==


(I presume this can be adapted to work with Chrome)
This is a very simple example that shows how to override the setLocalDescription and setRemoteDescription methods as required to implement this design. It has been verified not to interfere with the OpenTok SDK's proper functioning. This version is Firefox-specific; however, it can presumably be modified to work in Chrome by simply checking for and using the "webkit" prefix as necessary.


   window._originalRTCPeerConnection = window.mozRTCPeerConnection;
   window._originalRTCPeerConnection = window.mozRTCPeerConnection;
Line 142: Line 142:
     var setDescriptionShim = function(sdp, success, failure, pc, localRemote) {
     var setDescriptionShim = function(sdp, success, failure, pc, localRemote) {
       var fingerprint = /a=fingerprint:([^\r\n]*)/.exec(sdp.sdp)[1];
       var fingerprint = /a=fingerprint:([^\r\n]*)/.exec(sdp.sdp)[1];
      // Note: This is where the fingerprint exfiltration and verification would
      // be enqueued using setTimeout().
       console.log(localRemote + " fingerprint = " + fingerprint);
       console.log(localRemote + " fingerprint = " + fingerprint);
       pc["_originalSet" + localRemote + "Description"](sdp, success, failure);
       pc["_originalSet" + localRemote + "Description"](sdp, success, failure);
Confirmed users
632

edits