Skip to content

Commit 145eaa8

Browse files
committed
New release: cardano-signer 1.20.1
## Release Notes / Change-Logs * CIP100 Verification and Canonize - Bugfix: Corrected a bug where doublequotes that are already escaped in the body content to form the canonized body array were escaped again. This only affects the --json-extended output, but not the verification itself.
1 parent 2b93f99 commit 145eaa8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/cardano-signer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//define name and version
22
const appname = "cardano-signer"
3-
const version = "1.20.0"
3+
const version = "1.20.1"
44

55
//external dependencies
66
const CardanoWasm = require("@emurgo/cardano-serialization-lib-nodejs")
@@ -475,8 +475,8 @@ function getHash(content, digestLengthBytes = 32) { //hashes a given hex-string
475475
function generateIcarusMasterKey(entropy, passphrase) {
476476
const xprv = crypto.pbkdf2Sync(passphrase,entropy,4096,96,'sha512')
477477
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
480480
return xprv;
481481
}
482482

@@ -1872,7 +1872,7 @@ async function main() {
18721872
//split the canonized data into an array, remove the last element, do a loop for each element
18731873
var canonized_array = [];
18741874
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
18761876
})
18771877
var content = `{ "workMode": "${workMode}", "canonizedHash": "${canonized_hash}", "body": ` + JSON.stringify(jsonld_data["body"]) + `, "canonizedBody": [ ${canonized_array} ] }`;
18781878
} else { //generate content in text format
@@ -1992,7 +1992,7 @@ async function main() {
19921992
//split the canonized data into an array, remove the last element, do a loop for each element
19931993
var canonized_array = [];
19941994
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
19961996
})
19971997
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} ] }`;
19981998
} else { //generate content in text format

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cardano-signer",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "cardano-signer signs a given data(hex/text/file) with a signing key(hex/bech/file) or verify the signature via a public key(hex/bech/file). it can also produce a cip-8/cip-30/cip-36 conform payload signing/verification. can produce ed25519 keys from mnemonic for payment, staking, drep, constitutional commitee cold/hot keys, etc...",
55
"main": "cardano-signer.js",
66
"scripts": {

0 commit comments

Comments
 (0)