function _getChannel(callback) {
    this._log.trace("Requesting channel.");
    let request = this._newRequest(this._serverURL + "new_channel");
    request.get(Utils.bind2(this, function handleChannel(error) {
      if (this._finished) {
        return;
      }

      if (error) {
        this._log.error("Error acquiring channel ID. " + error);
        this.abort(JPAKE_ERROR_CHANNEL);
        return;
      }
      if (request.response.status != 200) {
        this._log.error("Error acquiring channel ID. Server responded with HTTP "
                        + request.response.status);
        this.abort(JPAKE_ERROR_CHANNEL);
        return;
      }

      try {
        this._channel = JSON.parse(request.response.body);
      } catch (ex) {
        this._log.error("Server responded with invalid JSON.");
        this.abort(JPAKE_ERROR_CHANNEL);
        return;
      }
      this._log.debug("Using channel " + this._channel);
      this._channelURL = this._serverURL + this._channel;

      // Don't block on UI code.
      let pin = this._secret + this._channel;
      Utils.nextTick(function() { this.controller.displayPIN(pin); }, this);
      callback();
    }));
  }
/*
   * Steps of J-PAKE procedure
   */
Steps of J-PAKE procedure
Steps of J - PAKE procedure
function _getChannel(callback) {
    this._log.trace("Requesting channel.");
    let request = this._newRequest(this._serverURL + "new_channel");
    request.get(Utils.bind2(this, function handleChannel(error) {
      if (this._finished) {
        return;
      }
      if (error) {
        this._log.error("Error acquiring channel ID. " + error);
        this.abort(JPAKE_ERROR_CHANNEL);
        return;
      }
      if (request.response.status != 200) {
        this._log.error("Error acquiring channel ID. Server responded with HTTP "
                        + request.response.status);
        this.abort(JPAKE_ERROR_CHANNEL);
        return;
      }
      try {
        this._channel = JSON.parse(request.response.body);
      } catch (ex) {
        this._log.error("Server responded with invalid JSON.");
        this.abort(JPAKE_ERROR_CHANNEL);
        return;
      }
      this._log.debug("Using channel " + this._channel);
      this._channelURL = this._serverURL + this._channel;
      let pin = this._secret + this._channel;
      Utils.nextTick(function() { this.controller.displayPIN(pin); }, this);
      callback();
    }));
  }
function _getChannel ( callback ) { this . _log . trace ( "Requesting channel." ) ; let request = this . _newRequest ( this . _serverURL + "new_channel" ) ; request . get ( Utils . bind2 ( this , function handleChannel ( error ) { if ( this . _finished ) { return ; } if ( error ) { this . _log . error ( "Error acquiring channel ID. " + error ) ; this . abort ( JPAKE_ERROR_CHANNEL ) ; return ; } if ( request . response . status != 200 ) { this . _log . error ( "Error acquiring channel ID. Server responded with HTTP " + request . response . status ) ; this . abort ( JPAKE_ERROR_CHANNEL ) ; return ; } try { this . _channel = JSON . parse ( request . response . body ) ; } catch ( ex ) { this . _log . error ( "Server responded with invalid JSON." ) ; this . abort ( JPAKE_ERROR_CHANNEL ) ; return ; } this . _log . debug ( "Using channel " + this . _channel ) ; this . _channelURL = this . _serverURL + this . _channel ; let pin = this . _secret + this . _channel ; Utils . nextTick ( function ( ) { this . controller . displayPIN ( pin ) ; } , this ) ; callback ( ) ; } ) ) ; }
Steps of J-PAKE procedure
Steps of J - PAKE procedure
// Don't block on UI code.