Sha256: 6cd199655b05d4ce4fb72d664cefe384cccd72288add104bd687e1c24c2c5830

Contents?: true

Size: 1.46 KB

Versions: 102

Compression:

Stored size: 1.46 KB

Contents

/*   RSence
 *   Copyright 2009 Riassence Inc.
 *   http://riassence.com/
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this software package. If not, contact licensing@riassence.com
 */

/*** = Description
  ** COMM.Session is the session key manager.
  **
  ** COMM.Session is used by COMM.Transporter to generate key hashes for
  ** the session management of COMM.Transporter's keys.
  **
  ** The server expects this exact algorithm and refuses to serve unless
  ** the SHA1 hash sum of the keys matches.
  **
  ** Uses a +SHA+ instance for generation.
  **
  ** +COMM.Queue+ runs as a single instance, don't try to reconstruct it.
***/
//var//RSence.COMM
COMM.Session = HClass.extend({
  
/** The constructor takes no arguments.
  **/
  constructor: function(){
    var _this = this;
    _this.sha = SHA.nu(8);
    _this.sha_key = _this.sha.hexSHA1(((new Date().getTime())*Math.random()*1000).toString());
    _this.ses_key = '0:.o.:'+_this.sha_key;
    _this.req_num = 0;
  },
  
/** = Description
  * Generates a new SHA1 sum using a combination of
  * the previous sum and the +_newKey+ given.
  *
  * Sets +self.ses_key+ and +self.sha_key+
  *
  * = Parameters:
  * +_newKey+:: A key set by the server.
  *
  **/
  newKey: function(_sesKey){
    var _this = this,
        _shaKey = _this.sha.hexSHA1(_sesKey+_this.sha_key);
    _this.req_num++;
    _this.ses_key = _this.req_num+':.o.:'+_shaKey;
    _this.sha_key = _shaKey;
  }
}).nu();

Version data entries

102 entries across 102 versions & 2 rubygems

Version Path
rsence-pre-2.3.0.12 js/comm/session/session.js
rsence-pre-2.3.0.11 js/comm/session/session.js
rsence-pre-2.3.0.10 js/comm/session/session.js
rsence-pre-2.3.0.9 js/comm/session/session.js
rsence-pre-2.3.0.8 js/comm/session/session.js
rsence-pre-2.3.0.7 js/comm/session/session.js
rsence-pre-2.3.0.6 js/comm/session/session.js
rsence-pre-2.3.0.5 js/comm/session/session.js
rsence-pre-2.3.0.4 js/comm/session/session.js
rsence-pre-2.3.0.3 js/comm/session/session.js
rsence-pre-2.3.0.2 js/comm/session/session.js
rsence-pre-2.3.0.1 js/comm/session/session.js
rsence-pre-2.3.0.0 js/comm/session/session.js
rsence-2.2.5 js/comm/session/session.js
rsence-2.2.4 js/comm/session/session.js
rsence-2.2.3 js/comm/session/session.js
rsence-2.2.2 js/comm/session/session.js
rsence-pre-2.2.2.1 js/comm/session/session.js
rsence-pre-2.2.2.0 js/comm/session/session.js
rsence-2.2.1 js/comm/session/session.js