Skip to content

Commit 20bb66b

Browse files
committed
New release: cardano-signer 1.24.2
## Release Notes / Change-Logs - improved handling of integer key values when converting from json to cbor - using default path 'payment' for keygen was broken
1 parent 2d123cf commit 20bb66b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/cardano-signer.js

Lines changed: 8 additions & 6 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.24.1"
3+
const version = "1.24.2"
44

55
//external dependencies
66
const CardanoWasm = require("@emurgo/cardano-serialization-lib-nodejs")
@@ -36,6 +36,7 @@ const args = require('minimist')(process.argv.slice(3),parse_options); //slice(3
3636
const regExpHex = /^[0-9a-fA-F]+$/;
3737
const regExpHexWith0x = /^(0x)?[0-9a-fA-F]+$/;
3838
const regExpPath = /^[0-9]+H\/[0-9]+H\/[0-9]+H(\/[0-9]+H?){0,2}$/; //path: first three elements must always be hardened, max. 5 elements
39+
const regExpIntNumber = /^-?[0-9]+$/; //matches positive and optional negative integer numbers
3940

4041
//catch all exceptions that are not catched via try
4142
process.on('uncaughtException', function (error) {
@@ -586,8 +587,8 @@ const jsToMap = (obj) => {
586587
} else {
587588
const myMap = new Map();
588589
for (const [key, value] of Object.entries(obj)) {
589-
const intKey = parseInt(key);
590-
myMap.set(intKey, jsToMap(value));
590+
// check if key is a pos or neg integer number, if so, use the key as a number and not as a string
591+
if (regExpIntNumber.test(key)) { myMap.set(parseInt(key), jsToMap(value)) } else { myMap.set(key, jsToMap(value)); }
591592
}
592593
return myMap;
593594
}
@@ -1722,6 +1723,7 @@ async function main() {
17221723
var derivation_path = args['path'];
17231724
if ( typeof derivation_path === 'string' && derivation_path != '' ) { //ok, a path was provided let check
17241725
derivation_path = trimString(derivation_path.toUpperCase());
1726+
var derivation_path_arg = derivation_path
17251727

17261728
//predefined derivation paths via name
17271729
switch (derivation_path) {
@@ -1739,9 +1741,9 @@ async function main() {
17391741
if ( ! regExpPath.test(derivation_path) ) { console.error(`Error: The provided derivation --path '${derivation_path}' does not match the right format! Example: 1852H/1815H/0H/0/0`); process.exit(1); }
17401742
} else {
17411743
var derivation_path = ''; //no path provided, set the derivation_path variable to be empty
1744+
var derivation_path_arg = derivation_path
17421745
}
17431746

1744-
17451747
//load or overwrite derivation path if CIP36 vote keys are selected
17461748
if ( args['cip36'] === true ) { var derivation_path = '1694H/1815H/0H/0/0' }
17471749

@@ -1992,9 +1994,9 @@ async function main() {
19921994
break;
19931995

19941996

1995-
default: //looks like a payment key
1997+
default: //looks like a payment key, but recheck the provided derivation path argument
19961998

1997-
switch (args['path'].toUpperCase()) {
1999+
switch (derivation_path_arg) {
19982000

19992001
case 'CALIDUS': //path is --path calidus -> generate the calidusID and special description for the skey/vkey content
20002002
var calidusIdHex = `a1${getHash(pubKeyHex, 28)}`; //hash the publicKey with blake2b_224 (28bytes digest length) and add the prebyte a1=CalidusPoolKey

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.24.1",
3+
"version": "1.24.2",
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)