Play

trying out API

by FrictionlessPulley

JavaScript

if (typeof core === 'undefined') {
     var core = {};
 }

 core.authentication = function (url) {
     this.random = null;
     this.time = null;
     this.apikey = null;
     this.sharedkey = null;
     this.ipAddress = null;

     /*public setters*/
     this.setRandom = function (input) {
         this.random = input;
     };
     this.setApiKey = function (input) {
         this.apikey = input;
     }
     this.ipAddress = function (input) {
         this.ipAddress = input;
     }
     this.setSharedKey = function (input) {
         this.sharedkey = input;
     }
     var getprehash = function () {
         return md5(this.apikey + this.ipAddress + this.time + this.random + this.sharedKey);
     };

     var toParams = function () {

         var param = {};
         param.Random = this.random;
         param.Time = this.time;
         param.ApiKey = this.apikey;
         param.IpAddress = this.ipAddress;
         param.SharedKey = this.sharedKey;
         param.Hash = this.getprehas();
         return param;
     };
 };

$(function(){
});