|
1 | 1 | //define name and version
|
2 | 2 | const appname = "cardano-signer"
|
3 |
| -const version = "1.20.0" |
| 3 | +const version = "1.20.1" |
4 | 4 |
|
5 | 5 | //external dependencies
|
6 | 6 | const CardanoWasm = require("@emurgo/cardano-serialization-lib-nodejs")
|
@@ -475,8 +475,8 @@ function getHash(content, digestLengthBytes = 32) { //hashes a given hex-string
|
475 | 475 | function generateIcarusMasterKey(entropy, passphrase) {
|
476 | 476 | const xprv = crypto.pbkdf2Sync(passphrase,entropy,4096,96,'sha512')
|
477 | 477 | xprv[0] &= 0b1111_1000; // clear the lowest 3 bits
|
478 |
| - xprv[31] &= 0b0001_1111; // clear the highest 3 bits |
479 |
| - xprv[31] |= 0b0100_0000; // set the 2nd higest bit |
| 478 | + xprv[31] &= 0b0001_1111; // clear the highest 3 bits (actually its 'clear the highest bit, clear the 3rd highest bit. but as we also set the 2nd highest bit, we can do it all at once) |
| 479 | + xprv[31] |= 0b0100_0000; // set the 2nd highest bit |
480 | 480 | return xprv;
|
481 | 481 | }
|
482 | 482 |
|
@@ -1872,7 +1872,7 @@ async function main() {
|
1872 | 1872 | //split the canonized data into an array, remove the last element, do a loop for each element
|
1873 | 1873 | var canonized_array = [];
|
1874 | 1874 | canonized_data.split('\n').slice(0,-1).forEach( (element) => {
|
1875 |
| - canonized_array.push('"' + String(element).replace(/[\"]/g, '\\"') + '"'); //replace the " with a \" while pushing new elements to the array |
| 1875 | + canonized_array.push('"' + String(element).replace(/\\([\s\S])|(")/g,"\\$1$2") + '"'); //escape " with \" if it not already a \" while pushing new elements to the array |
1876 | 1876 | })
|
1877 | 1877 | var content = `{ "workMode": "${workMode}", "canonizedHash": "${canonized_hash}", "body": ` + JSON.stringify(jsonld_data["body"]) + `, "canonizedBody": [ ${canonized_array} ] }`;
|
1878 | 1878 | } else { //generate content in text format
|
@@ -1992,7 +1992,7 @@ async function main() {
|
1992 | 1992 | //split the canonized data into an array, remove the last element, do a loop for each element
|
1993 | 1993 | var canonized_array = [];
|
1994 | 1994 | canonized_data.split('\n').slice(0,-1).forEach( (element) => {
|
1995 |
| - canonized_array.push('"' + String(element).replace(/[\"]/g, '\\"') + '"'); //replace the " with a \" while pushing new elements to the array |
| 1995 | + canonized_array.push('"' + String(element).replace(/\\([\s\S])|(")/g,"\\$1$2") + '"'); //escape " with \" if it not already a \" while pushing new elements to the array |
1996 | 1996 | })
|
1997 | 1997 | var content = `{ "workMode": "${workMode}", "result": ${result}, "errorMsg": "${errorStr}", "authors": ` + JSON.stringify(authors_array) + `, "canonizedHash": "${canonized_hash}", "body": ` + JSON.stringify(jsonld_data["body"]) + `, "canonizedBody": [ ${canonized_array} ] }`;
|
1998 | 1998 | } else { //generate content in text format
|
|
0 commit comments