Browse Source

bugfix: signature computation was broken for multiline texts

master
Christian Mueller 12 years ago
parent
commit
144218ecc2
  1. 2
      API.md
  2. 4
      resources/public/js/main.js
  3. 2
      src/notehub/storage.clj

2
API.md

@ -85,6 +85,7 @@ The Signature is the MD5 hash of the following string concatenation:
pid + psk + note pid + psk + note
The signature serves as a proof, that the request is authentic and will be issued by the publisher corresponding to the provided PID. Please note, that _all_ of the values used in the signature computation, should be identical to the values passed with the request itself. The signature serves as a proof, that the request is authentic and will be issued by the publisher corresponding to the provided PID. Please note, that _all_ of the values used in the signature computation, should be identical to the values passed with the request itself.
Ensure, that your note contains only `\\n` symbols as line breaks!
The parameters specifying the theme name and fonts are optional and only impact the URLs returned back. The parameters specifying the theme name and fonts are optional and only impact the URLs returned back.
@ -126,6 +127,7 @@ The Signature is the MD5 hash of the following string concatenation:
pid + psk + noteID + note + password pid + psk + noteID + note + password
Please note, that all of the values used in the signature computation, should be identical to the values passed with the request itself. Please note, that all of the values used in the signature computation, should be identical to the values passed with the request itself.
Ensure, that your note contains only `\\n` symbols as line breaks!
The response of the server will contain the fields `longURL`, `shortURL`, `status`. The response of the server will contain the fields `longURL`, `shortURL`, `status`.

4
resources/public/js/main.js

@ -5,9 +5,7 @@ var timerDelay = iosDetected ? 800 : 400;
var show = function(elem) { elem.style.display = "block" } var show = function(elem) { elem.style.display = "block" }
var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview; var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview;
var md5 = function (input) { var md5 = hex_md5;
return hex_md5(input.replace(/[\n\r]/g, ""));
}
function md2html(input){ function md2html(input){
return marked(input); return marked(input);

2
src/notehub/storage.clj

@ -9,7 +9,7 @@
(defn sign (defn sign
"Returns the MD5 hash for the concatenation of all passed parameters" "Returns the MD5 hash for the concatenation of all passed parameters"
[& args] [& args]
(let [input (apply str args)] (let [input (sreplace (apply str args) #"\r*" "")]
(do (.reset md5Instance) (do (.reset md5Instance)
(.update md5Instance (.getBytes input)) (.update md5Instance (.getBytes input))
(apply str (apply str

Loading…
Cancel
Save