Sha256: 35cac6fdb9681eb2a5b514c844dae9df1a1fa811bd57948c9755bc14e2a5294d

Contents?: true

Size: 1.23 KB

Versions: 27

Compression:

Stored size: 1.23 KB

Contents

/*** = 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:1:'+_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+':1:'+_shaKey;
    _this.sha_key = _shaKey;
  }
}).nu();

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
rsence-pre-3.0.0.16 client/js/comm/session/session.js
rsence-pre-3.0.0.15 client/js/comm/session/session.js
rsence-pre-3.0.0.14 client/js/comm/session/session.js
rsence-pre-3.0.0.12 client/js/comm/session/session.js
rsence-pre-3.0.0.11 client/js/comm/session/session.js
rsence-pre-3.0.0.10 client/js/comm/session/session.js
rsence-pre-3.0.0.9 client/js/comm/session/session.js
rsence-pre-3.0.0.8 client/js/comm/session/session.js
rsence-pre-3.0.0.7 client/js/comm/session/session.js
rsence-pre-3.0.0.6 client/js/comm/session/session.js
rsence-pre-3.0.0.5 client/js/comm/session/session.js
rsence-pre-3.0.0.4 client/js/comm/session/session.js
rsence-pre-3.0.0.3 client/js/comm/session/session.js
rsence-pre-3.0.0.2 client/js/comm/session/session.js
rsence-pre-3.0.0.1 client/js/comm/session/session.js
rsence-pre-3.0.0.0 client/js/comm/session/session.js
rsence-pre-2.3.0.26 js/comm/session/session.js
rsence-pre-2.3.0.25 js/comm/session/session.js
rsence-pre-2.3.0.24 js/comm/session/session.js
rsence-pre-2.3.0.23 js/comm/session/session.js