You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Release Notes / Change-Logs
* 1.14.0
* New dRep-Key generation mode:
- generate conway dRep keys via the path `--path drep` or
- generate conway dRep keys from the derivation path `1852'/1815'/acc'/3/idx'`
- generate conway dRep keys from mnemonics or let cardano-signer generate new mnemonics for you
* Key generation mode changes:
- the flag `with-chain-code` has been replaced by the new flag `vkey-extended`. this makes it easier for the users to understand the meaning
- per default the public keys are now always generated as non-extended keys, the secret keys are always extended ones if derived from a path
* General
- code cleanup
boolean: ['json','json-extended','cip8','cip30','cip36','deregister','bech','hashed','nopayload','with-chain-code'],//all booleans are set to false per default
20
+
boolean: ['json','json-extended','cip8','cip30','cip36','deregister','bech','hashed','nopayload','vkey-extended'],//all booleans are set to false per default
21
21
//adding some aliases so users can also use variants of the original parameters. for example using --signing-key instead of --secret-key
console.log(` Params: [${FgGreen}--path${Reset} "<derivationpath>"] ${Dim}optional derivation path in the format like "1852H/1815H/0H/0/0" or "1852'/1815'/0'/0/0"${Reset}`);
console.log(` [${FgGreen}--mnemonics${Reset} "word1 word2 ... word24"] ${Dim}optional mnemonic words to derive the key from (separate via space)${Reset}`);
143
143
console.log(` [${FgGreen}--cip36${Reset}] ${Dim}optional flag to generate CIP36 conform vote keys (also using path 1694H/1815H/0H/0/0)${Reset}`);
144
144
console.log(` [${FgGreen}--vote-purpose${Reset} <unsigned_int>] ${Dim}optional vote-purpose (unsigned int) together with --cip36 flag, default: 0 (Catalyst)${Reset}`);
145
-
console.log(` [${FgGreen}--with-chain-code${Reset}] ${Dim}optional flag to generate a 128byte secretKey and 64byte publicKey with chain code${Reset}`);
145
+
console.log(` [${FgGreen}--vkey-extended${Reset}] ${Dim}optional flag to generate a 64byte publicKey with chain code${Reset}`);
146
146
console.log(` [${FgGreen}--json${Reset} |${FgGreen} --json-extended${Reset}] ${Dim}optional flag to generate output in json/json-extended format${Reset}`);
147
147
console.log(` [${FgGreen}--out-file${Reset} "<path_to_file>"] ${Dim}path to an output file, default: standard-output${Reset}`);
148
148
console.log(` [${FgGreen}--out-skey${Reset} "<path_to_skey_file>"] ${Dim}path to an output skey-file${Reset}`);
//get mnemonics parameter, if ok set the mnemonics variable
1317
1305
varmnemonics=args['mnemonics'];
@@ -1370,12 +1358,15 @@ async function main() {
1370
1358
}
1371
1359
});
1372
1360
1373
-
//if the extra flag 'with-chain-code' is set, generate a 128byte private key and a 64byte public key. otherwise generate a 64byte private key and 32byte public key
1374
-
if(args['with-chain-code']===true){
1375
-
varprvKeyHex=Buffer.from(rootKey.to_128_xprv()).toString('hex');//private-secret key in hex format (64bytes private + 32bytes public + 32bytes chaincode)
1361
+
1362
+
//if derived, we always have an extended private secret key
1363
+
varprvKeyHex=Buffer.from(rootKey.to_128_xprv()).toString('hex');//private-secret key in hex format (64bytes private + 32bytes public + 32bytes chaincode)
1364
+
//var prvKeyHex = Buffer.from(rootKey.to_raw_key().as_bytes()).toString('hex'); //private-secret key in hex format (64bytes) - not used here because its always an extended one
1365
+
1366
+
//if the extra flag 'vkey-extended' is set, generate a 64byte public key. otherwise generate a 32byte public key
1367
+
if(args['vkey-extended']===true){
1376
1368
varpubKeyHex=Buffer.from(rootKey.to_public().as_bytes()).toString('hex');//public key in hex format (64bytes)
1377
1369
}else{
1378
-
varprvKeyHex=Buffer.from(rootKey.to_raw_key().as_bytes()).toString('hex');//private-secret key in hex format (64bytes)
1379
1370
varpubKeyHex=Buffer.from(rootKey.to_public().as_bytes()).toString('hex').substring(0,64);//public key in hex format (cut it to a non-extended publickey, 32bytes)
varprvKeyBech=bech32.encode("cvote_sk",bech32.toWords(Buffer.from(prvKeyHex,"hex")),256);//encode in bech32 with a raised limit to 256 words because of the extralong privatekey (128bytes)
1400
+
varpubKeyBech=bech32.encode("cvote_vk",bech32.toWords(Buffer.from(pubKeyHex,"hex")),128);//encode in bech32 with a raised limit to 128 words because of the longer publickey (64bytes)
1401
+
1402
+
//get the --vote-purpose parameter, set default = 0
1403
+
varvote_purpose_param=args['vote-purpose'];
1404
+
if(typeofvote_purpose_param==='undefined'){vote_purpose=0}//if not defined, set it to default=0
//also generate the drep id in hex and bech format
1444
+
vardrepIdHex=getHash(pubKeyHex,28);//hash the publicKey with blake2b_224 (28bytes digest length)
1445
+
vardrepIdBech=bech32.encode("drep",bech32.toWords(Buffer.from(drepIdHex,"hex")),128);//encode in bech32 with a raised limit to 128 words because of the longer hash (56bytes)
1446
+
//generate the keys also in bech format
1447
+
varprvKeyBech=bech32.encode("drep_sk",bech32.toWords(Buffer.from(prvKeyHex,"hex")),256);//encode in bech32 with a raised limit to 256 words because of the extralong privatekey (128bytes)
1448
+
varpubKeyBech=bech32.encode("drep_vk",bech32.toWords(Buffer.from(pubKeyHex,"hex")),128);//encode in bech32 with a raised limit to 128 words because of the longer publickey (64bytes)
prvKeyBech=bech32.encode("cvote_sk",bech32.toWords(Buffer.from(prvKeyHex,"hex")),256);//encode in bech32 with a raised limit to 256 words because of the extralong privatekey (128bytes)
1432
-
pubKeyBech=bech32.encode("cvote_vk",bech32.toWords(Buffer.from(pubKeyHex,"hex")),128);//encode in bech32 with a raised limit to 128 words because of the longer publickey (64bytes)
Copy file name to clipboardExpand all lines: src/package.json
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "cardano-signer",
3
-
"version": "1.13.0",
4
-
"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 and cip-36 conform payload signing/verification.",
3
+
"version": "1.14.0",
4
+
"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/drep conform payload signing/verification.",
5
5
"main": "cardano-signer.js",
6
6
"scripts": {
7
7
"test": "echo \"Error: no test specified\" && exit 1"
0 commit comments