Skip to content

Commit

Permalink
debug tab | encrypt/decrypt json finished
Browse files Browse the repository at this point in the history
  • Loading branch information
mirrt authored and vineetbhargav86 committed Feb 27, 2016
1 parent b4c5106 commit 7f58d37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
6 changes: 4 additions & 2 deletions iguana/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,10 @@ <h3><span>
Permanentfile
</label>
<div class="col-sm-7 col-md-7">
<input type="text" class="form-control" id='debug_permanentfile'>
<span class='material-input'></span>
<div>
<input type="file" id='debug_permanentfile'>
<input type="text" readonly class="form-control" >
</div>
</div>
</div>
<div class="form-group">
Expand Down
27 changes: 13 additions & 14 deletions iguana/js/debugJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ dJson._checkJson = function(json) {
return false;
};

return ogj;
return obj;
};

//{"agent":"SuperNET","method":"encryptjson","passphrase":"<passphrase>","permanentfile":"<filename>","fromform":"valuefromform","fromform2":"valuefromform2",...rest of form at top level}
//{"agent":"SuperNET","method":"encryptjson","passphrase":"<passphrase>","permanentfile":"<filename>","fromform":"valuefromform", "fromform2":"valuefromform2",...rest of form at top level}
dJson.encrypt = function(credentials, json, cb) {
this._init(credentials);

var jsonObj;

if(jsonObj = this._checkJson) {
if(jsonObj = this._checkJson(json)) {
this.ENCRYPTED = true;
this.request.method = "encryptjson";

for(var attr in jsonObj) {
if(jsonObj.hasOwnProperty(attr)) {
this.request[attr] = jsonObj[attr];
Expand All @@ -54,7 +54,7 @@ dJson.encrypt = function(credentials, json, cb) {
cb(null);
};

//{"agent":"SuperNET","method":"encryptjson","passphrase":"<passphrase>","permanentfile":"<filename>"}
//{"agent":"SuperNET","method":"decryptjson","passphrase":"<passphrase>","permanentfile":"<filename>"}
dJson.decrypt = function(credentials, cb) {
this._init(credentials);

Expand All @@ -78,20 +78,19 @@ $(document).ready(function() {
permFile = $('#debug_permanentfile'),
jsonSrc = $('#debug_json_src');


$(encryptBtn).click(function(e) {
e.preventDefault();
debugJsonResult.text('');

dJson.encrypt({
passphrase: pass.val(),
permanentfile: permFile.val()
},
jsonSrc.val(),
function(response) {
debugJsonResult.text(response || 'wrong json');
}
);
passphrase: pass.val(),
permanentfile: permFile.val()
},
jsonSrc.val(),
function(response) {
debugJsonResult.text(response || 'wrong json');
});

});

$(decryptBtn).click(function(e) {
Expand Down

0 comments on commit 7f58d37

Please sign in to comment.