Fix UI's debug JSON verification

Fixes https://code.google.com/p/camlistore/issues/detail?id=163

Change-Id: I6bdd57b9c47b6465ba01336a3a5f0487889ea327
This commit is contained in:
Brad Fitzpatrick 2013-06-26 11:15:17 -07:00
parent 909d310e2f
commit da86949a92
2 changed files with 4 additions and 8 deletions

View File

@ -362,27 +362,24 @@ function(clearObj, success, opt_fail) {
};
/**
* @param {Object} sObj Signed object.
* @param {Object} signed Signed JSON blob (string) to verify.
* @param {Function} success Success callback.
* @param {?Function} opt_fail Optional fail callback.
* @private
*/
camlistore.ServerConnection.prototype.verify_ =
function(sObj, success, opt_fail) {
function(signed, success, opt_fail) {
var sigConf = this.config_.signing;
if (!sigConf || !sigConf.publicKeyBlobRef) {
this.safeFail_(opt_fail)("Missing Camli.config.signing.publicKeyBlobRef");
return;
}
var clearText = JSON.stringify(sObj);
this.sendXhr_(
sigConf.verifyHandler,
goog.bind(this.handlePost_, this,
success, this.safeFail_(opt_fail)),
"POST",
"sjson=" + encodeURIComponent(clearText),
"sjson=" + encodeURIComponent(signed),
{"Content-Type": "application/x-www-form-urlencoded"}
);
};

View File

@ -175,8 +175,7 @@ camlistore.DebugPage.prototype.doVerify_ = function() {
return;
}
var signedta = goog.dom.getElement("signedjson");
var sObj = JSON.parse(signedta.value);
this.connection_.verify_(sObj,
this.connection_.verify_(signedta.value,
function(response) {
var text = "<pre>" + response + "</pre>";
goog.dom.getElement("verifyinfo").innerHTML = text;