Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Examples 6, 7, 22 and 24 are wrong #310

Closed

Description

@ibc
  RTCCertificate.generateCertificate(keygenAlgorithm).then(function(certificate){
    var cert = certificate;
    // Obtain the fingerprint of the created certificate
    dtlsParameters.fingerprints[0] = cert.fingerprint;
  }, function(){
    trace('Certificate could not be created');
  });
  // Prepare to handle remote ICE candidates
  mySignaller.onRemoteCandidate = function(remote) {
    // Figure out which IceTranport a remote candidate relates to by matching the userNameFragment/password
    var j = 0;
    for (j = 0; j < iceTransport.length; j++) {
      var transport = iceTransports[j];
      if (transport.getRemoteParameters().userNameFragment === remote.parameters.userNameFragment)
        transport.addRemoteCandidate(remote.candidate);
      }
    }  };
  // ... create RtpSender/RtpReceiver objects as illustrated in Section 6.5 Example 9.

  mySignaller.mySendInitiate({
    "ice": iceGatherer.getLocalParameters(),
    "dtls": dtlsParameters,
    // ... marshall RtpSender/RtpReceiver capabilities as illustrated in Section 6.5 Example 9.
  }, function(remote) {
    // Create the ICE and DTLS transports
    var iceTransport = new RTCIceTransport(iceGatherer);
    iceTransport.start(iceGatherer, remote.ice, RTCIceRole.controlling);
    iceTransports.push(iceTransport);
    // Construct a RTCDtlsTransport object with the same certificate and fingerprint as in the Offer
    // so that the remote peer can verify it.
    var dtlsTransport = new RTCDtlsTransport(iceTransport, cert);     // <---- There is no `cert` var
    dtlsTransport.start(remote.dtls);
    dtlsTransports.push(dtlsTransport);

    // ... configure RtpSender/RtpReceiver objects as illustrated in Section 6.5 Example 9.
  });

In var dtlsTransport = new RTCDtlsTransport(iceTransport, cert); such a cert variable does not exist in that scope. It was defined in the resolve function of the RTCCertificate.generateCertificate() returned Promise.

For this to be valid, var cert should be declared above the RTCCertificate.generateCertificate() call.

Activity

  1. ibc commented on Dec 26, 2015

    @ibc
    ContributorAuthor

    Some issue in Example 7:

      // Create the DTLS certificate
      var keygenAlgorithm = { name: "ECDSA", namedCurve: "P-256" };
      RTCCertificate.generateCertificate(keygenAlgorithm).then(function(certificate){
        var cert = certificate;
      }, function(){
        trace('Certificate could not be created');
      });
    
      // Create ICE and DTLS transports
      var ice = new RTCIceTransport(iceGatherer);
      var dtls = new RTCDtlsTransport(ice, cert);   // `cert` does not exist in this scope.
  2. ibc commented on Dec 26, 2015

    @ibc
    ContributorAuthor

    If I do not miss anything I will send a PR next week,

  3. changed the title [-]Example 6 is wrong[/-] [+]Examples 6 and 7 are wrong[/+] on Dec 26, 2015
  4. added a commit that references this issue on Dec 26, 2015
  5. aboba commented on Dec 26, 2015

    @aboba
    Contributor

    PR for this issue: #312

  6. ibc commented on Dec 27, 2015

    @ibc
    ContributorAuthor

    Great, didn't see the PR.

  7. added a commit that references this issue on Jan 2, 2016
  8. aboba commented on Jan 4, 2016

    @aboba
    Contributor

    Found similar problems in Examples 22 and 24. PR submitted to fix those as well as some respec errors: #319

  9. changed the title [-]Examples 6 and 7 are wrong[/-] [+]Examples 6, 7, 22 and 24 are wrong[/+] on Jan 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions