From 69126276b8a2ff18eb4a37880192159a0308ddca Mon Sep 17 00:00:00 2001 From: gnongs Date: Thu, 28 Nov 2024 17:08:23 +0000 Subject: [PATCH 01/13] Changed to allow multiple validator keys with different passwords --- .../src/commands/actions/KeySharesAction.js | 45 ++++++++++---- .../commands/actions/KeySharesAction.js.map | 2 +- src/commands/actions/KeySharesAction.ts | 62 ++++++++++++++----- 3 files changed, 82 insertions(+), 27 deletions(-) diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js b/dist/tsc/src/commands/actions/KeySharesAction.js index 34260fd..3f0ec61 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js +++ b/dist/tsc/src/commands/actions/KeySharesAction.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.KeySharesAction = void 0; const tslib_1 = require("tslib"); const path_1 = tslib_1.__importDefault(require("path")); +const fs_1 = require("fs"); const BaseAction_1 = require("./BaseAction"); const SSVKeys_1 = require("../../lib/SSVKeys"); const KeySharesItem_1 = require("../../lib/KeyShares/KeySharesItem"); @@ -33,6 +34,7 @@ class KeySharesAction extends BaseAction_1.BaseAction { } async execute() { this.validateKeystoreArguments(); // Validate keystore arguments + process.stdout.write(`${this.args.output_folder}`); const keySharesList = await this.processKeystorePath(); const keySharesFilePath = await this.saveKeyShares(keySharesList, this.args.output_folder); return keySharesFilePath; @@ -46,30 +48,49 @@ class KeySharesAction extends BaseAction_1.BaseAction { async processKeystorePath() { const keystorePath = (0, validators_1.sanitizePath)(String(this.args.keystore).trim()); const { files } = await (0, file_helper_1.getKeyStoreFiles)(keystorePath); - const validatedFiles = await this.validateKeystoreFiles(files); - const singleKeySharesList = await Promise.all(validatedFiles.map((file, index) => this.processFile(file, this.args.password, this.getOperators(), this.args.owner_address, this.args.owner_nonce + index))); + const keystoreSet = []; + for (const file of files) { + const isDir = (await fs_1.promises.stat(file)).isDirectory(); + let keystoreFile = file; + let keystorePassword = this.args.password; + if (isDir) { + const dir = await fs_1.promises.opendir(file); + for await (const dirent of dir) { + if (dirent.name.includes('keystore')) { + keystoreFile = path_1.default.join(file, dirent.name); + } + if (dirent.name.includes(this.args.password)) { + keystorePassword = await fs_1.promises.readFile(path_1.default.join(file, dirent.name), 'utf-8'); + } + } + } + keystoreSet.push({ keystoreFile, keystorePassword }); + } + const validatedFiles = await this.validateKeystoreFiles(keystoreSet); + process.stdout.write(validatedFiles[0].keystoreFile); + const singleKeySharesList = await Promise.all(validatedFiles.map((keystore, index) => this.processFile(keystore.keystoreFile, keystore.keystorePassword, this.getOperators(), this.args.owner_address, this.args.owner_nonce + index))); return singleKeySharesList; } - async validateKeystoreFiles(files) { - const validatedFiles = []; + async validateKeystoreFiles(keystores) { + const validatedKeystoreSet = []; let failedValidation = 0; - for (const [index, file] of files.entries()) { - const isKeyStoreValid = await arguments_1.keystoreArgument.interactive.options.validate(file); - const isValidPassword = await validators_1.keystorePasswordValidator.validatePassword(this.args.password, file); + for (const [index, { keystoreFile, keystorePassword }] of keystores.entries()) { + const isKeyStoreValid = await arguments_1.keystoreArgument.interactive.options.validate(keystoreFile); + const isValidPassword = await validators_1.keystorePasswordValidator.validatePassword(keystorePassword, keystoreFile); let status = '✅'; if (isKeyStoreValid === true && isValidPassword === true) { - validatedFiles.push(file); + validatedKeystoreSet.push({ keystoreFile, keystorePassword }); } else { failedValidation++; status = '❌'; } - const fileName = path_1.default.basename(file); // Extract the file name - process.stdout.write(`\r\n${index + 1}/${files.length} ${status} ${fileName}`); + const fileName = path_1.default.basename(keystoreFile); // Extract the file name + process.stdout.write(`\r\n${index + 1}/${keystores.length} ${status} ${fileName}`); } - process.stdout.write(`\n\n${files.length - failedValidation} of ${files.length} keystore files successfully validated. ${failedValidation} failed validation`); + process.stdout.write(`\n\n${keystores.length - failedValidation} of ${keystores.length} keystore files successfully validated. ${failedValidation} failed validation`); process.stdout.write('\n'); - return validatedFiles; + return validatedKeystoreSet; } getOperators() { const operatorIds = this.args.operator_ids.split(','); diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js.map b/dist/tsc/src/commands/actions/KeySharesAction.js.map index c844a2f..aea3652 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js.map +++ b/dist/tsc/src/commands/actions/KeySharesAction.js.map @@ -1 +1 @@ -{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AAExB,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAO7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAEhE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,uBAAgB,CAAC,qHAAqH,CAAC,CAAC;SACnJ;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC/B,MAAM,YAAY,GAAG,IAAA,yBAAY,E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,aAAa,CAAC,CAAC,CAAC;QAEtE,MAAM,iBAAiB,GAAG,MAAM,IAAA,yBAAW,EAAC,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAA,uBAAS,EAAC,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AArHD,0CAqHC"} \ No newline at end of file +{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/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AAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;QAEtE,MAAM,iBAAiB,GAAG,MAAM,IAAA,yBAAW,EAAC,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAA,uBAAS,EAAC,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAjJD,0CAiJC"} \ No newline at end of file diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 50b2dc7..5d61583 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -1,4 +1,5 @@ import path from 'path'; +import { promises as fsp } from 'fs'; import { BaseAction } from './BaseAction'; import { SSVKeys } from '../../lib/SSVKeys'; @@ -26,6 +27,11 @@ type Operator = { operatorKey: string; }; +type KeystoresArgs = { + keystoreFile: string; + keystorePassword: string; +}; + /** * Command to build keyshares from user input. */ @@ -48,7 +54,7 @@ export class KeySharesAction extends BaseAction { override async execute(): Promise { this.validateKeystoreArguments(); // Validate keystore arguments - + process.stdout.write(`${this.args.output_folder}`); const keySharesList = await this.processKeystorePath(); const keySharesFilePath = await this.saveKeyShares(keySharesList, this.args.output_folder); return keySharesFilePath; @@ -64,35 +70,63 @@ export class KeySharesAction extends BaseAction { private async processKeystorePath(): Promise { const keystorePath = sanitizePath(String(this.args.keystore).trim()); const { files } = await getKeyStoreFiles(keystorePath); - const validatedFiles = await this.validateKeystoreFiles(files); - const singleKeySharesList = await Promise.all(validatedFiles.map((file, index) => - this.processFile(file, this.args.password, this.getOperators(), this.args.owner_address, this.args.owner_nonce + index) + const keystoreSet : KeystoresArgs[] = []; + + for (const file of files) { + const isDir = (await fsp.stat(file)).isDirectory(); + let keystoreFile = file; + let keystorePassword = this.args.password; + + if (isDir) { + const dir = await fsp.opendir(file); + for await (const dirent of dir) { + if (dirent.name.includes('keystore')) { + keystoreFile = path.join(file, dirent.name); + } + if (dirent.name.includes(this.args.password)) { + keystorePassword = await fsp.readFile(path.join(file, dirent.name), 'utf-8'); + } + } + } + + keystoreSet.push({ keystoreFile, keystorePassword }); + } + + const validatedFiles = await this.validateKeystoreFiles(keystoreSet); + + process.stdout.write(validatedFiles[0].keystoreFile); + + const singleKeySharesList = await Promise.all(validatedFiles.map((keystore, index) => + this.processFile(keystore.keystoreFile, keystore.keystorePassword, this.getOperators(), this.args.owner_address, this.args.owner_nonce + index) )); return singleKeySharesList; } - private async validateKeystoreFiles(files: string[]): Promise { - const validatedFiles = []; + private async validateKeystoreFiles(keystores: KeystoresArgs[]): Promise { + const validatedKeystoreSet : KeystoresArgs[] = []; let failedValidation = 0; - for (const [index, file] of files.entries()) { - const isKeyStoreValid = await keystoreArgument.interactive.options.validate(file); - const isValidPassword = await keystorePasswordValidator.validatePassword(this.args.password, file); + + for (const [index, { keystoreFile, keystorePassword }] of keystores.entries()) { + const isKeyStoreValid = await keystoreArgument.interactive.options.validate(keystoreFile); + const isValidPassword = await keystorePasswordValidator.validatePassword(keystorePassword, keystoreFile); + let status = '✅'; if (isKeyStoreValid === true && isValidPassword === true) { - validatedFiles.push(file); + validatedKeystoreSet.push({ keystoreFile, keystorePassword }); } else { failedValidation++; status = '❌'; } - const fileName = path.basename(file); // Extract the file name - process.stdout.write(`\r\n${index+ 1}/${files.length} ${status} ${fileName}`); + const fileName = path.basename(keystoreFile); // Extract the file name + process.stdout.write(`\r\n${index+ 1}/${keystores.length} ${status} ${fileName}`); } - process.stdout.write(`\n\n${files.length - failedValidation} of ${files.length} keystore files successfully validated. ${failedValidation} failed validation`); + + process.stdout.write(`\n\n${keystores.length - failedValidation} of ${keystores.length} keystore files successfully validated. ${failedValidation} failed validation`); process.stdout.write('\n'); - return validatedFiles; + return validatedKeystoreSet; } private getOperators(): Operator[] { From b57a7cc5599d4fec9d2dfb9d8e8822db2ee22567 Mon Sep 17 00:00:00 2001 From: gnongs Date: Thu, 28 Nov 2024 17:25:16 +0000 Subject: [PATCH 02/13] Change example for command execution --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c8aca3a..5b9ef2b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ To run you will use the "shares" command **Input parameters:** - keystore (ks) = The path to either a validator keystore file or a folder that contains multiple validator keystore files. If a folder is provided, it will split in bulk all the keystore files within it according to the additional arguments provided -- password (ps) = The keystore file encryption password, if a folder was provided the password will be used for all keystore files in the folder +- password (ps) = The keystore file encryption password. For one keystore, enter the absolute path. For multiple keystores, enter only the password file name. - operator-ids (oids) = Comma-separated list of operator IDs. The amount must be 3f+1 compatible - operator-keys (oks) = Comma-separated list of operator keys (same sequence as operator ids). The amount must be 3f+1 compatible - output-folder (of) = Target folder path to output the key shares file @@ -99,11 +99,30 @@ To run you will use the "shares" command - owner-nonce (on) = The validator registration nonce of the account (owner address) within the SSV contract (increments after each validator registration), obtained using the ssv-scanner tool ```bash + +6 directories, 20 files # single file -yarn cli shares --keystore=keystore.json --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. +yarn cli shares --keystore=./keystore.json --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. # folder with multiple keystore files -yarn cli shares --keystore=./keystore-files --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. +## folder structure +keystore_folders +├── 0xe020.... +│   ├── keystore-m_12381_3600_1_0_0-1717971132.json +│   └── password.txt +├── 0xe025.... +│   ├── keystore-m_12381_3600_6_0_0-1717971134.json +│   └── password.txt +├── 0xe02a.... +│   ├── keystore-m_12381_3600_11_0_0-1717971135.json +│   └── password.txt +├── 0xe02f.... +│   ├── keystore-m_12381_3600_16_0_0-1717971137.json +│   └── password.txt +└── 0xe034.... + ├── keystore-m_12381_3600_21_0_0-1717971139.json + └── password.txt +yarn cli shares --keystore=./keystore_folders --password=password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. ``` **Output:** Name will start with keyshares-timestamp.json From e105570e24ded63a6bd967a51d3b2220ddb2253f Mon Sep 17 00:00:00 2001 From: gnongs Date: Thu, 28 Nov 2024 17:26:29 +0000 Subject: [PATCH 03/13] Changed the password for a single keystore file to also receive a file path --- dist/tsc/src/commands/actions/KeySharesAction.js | 3 +-- dist/tsc/src/commands/actions/KeySharesAction.js.map | 2 +- src/commands/actions/KeySharesAction.ts | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js b/dist/tsc/src/commands/actions/KeySharesAction.js index 3f0ec61..5bf0636 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js +++ b/dist/tsc/src/commands/actions/KeySharesAction.js @@ -34,7 +34,6 @@ class KeySharesAction extends BaseAction_1.BaseAction { } async execute() { this.validateKeystoreArguments(); // Validate keystore arguments - process.stdout.write(`${this.args.output_folder}`); const keySharesList = await this.processKeystorePath(); const keySharesFilePath = await this.saveKeyShares(keySharesList, this.args.output_folder); return keySharesFilePath; @@ -52,7 +51,7 @@ class KeySharesAction extends BaseAction_1.BaseAction { for (const file of files) { const isDir = (await fs_1.promises.stat(file)).isDirectory(); let keystoreFile = file; - let keystorePassword = this.args.password; + let keystorePassword = await fs_1.promises.readFile(this.args.password, 'utf-8'); if (isDir) { const dir = await fs_1.promises.opendir(file); for await (const dirent of dir) { diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js.map b/dist/tsc/src/commands/actions/KeySharesAction.js.map index aea3652..d3b6ced 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js.map +++ b/dist/tsc/src/commands/actions/KeySharesAction.js.map @@ -1 +1 @@ -{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,uBAAgB,CAAC,qHAAqH,CAAC,CAAC;SACnJ;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC/B,MAAM,YAAY,GAAG,IAAA,yBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,IA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AAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAjJD,0CAiJC"} \ No newline at end of file +{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,uBAAgB,CAAC,qHAAqH,CAAC,CAAC;SACnJ;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC/B,MAAM,YAAY,GAAG,IAAA,yBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CA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AAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAhJD,0CAgJC"} \ No newline at end of file diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 5d61583..56328b3 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -54,7 +54,6 @@ export class KeySharesAction extends BaseAction { override async execute(): Promise { this.validateKeystoreArguments(); // Validate keystore arguments - process.stdout.write(`${this.args.output_folder}`); const keySharesList = await this.processKeystorePath(); const keySharesFilePath = await this.saveKeyShares(keySharesList, this.args.output_folder); return keySharesFilePath; @@ -76,7 +75,7 @@ export class KeySharesAction extends BaseAction { for (const file of files) { const isDir = (await fsp.stat(file)).isDirectory(); let keystoreFile = file; - let keystorePassword = this.args.password; + let keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); if (isDir) { const dir = await fsp.opendir(file); From f7d0f2632c9686a0ccc8c320aa806486e3e8ea00 Mon Sep 17 00:00:00 2001 From: gnongs Date: Fri, 29 Nov 2024 10:12:39 +0000 Subject: [PATCH 04/13] Updated keystorePassword initial value --- dist/tsc/src/commands/actions/KeySharesAction.js | 3 ++- dist/tsc/src/commands/actions/KeySharesAction.js.map | 2 +- src/commands/actions/KeySharesAction.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js b/dist/tsc/src/commands/actions/KeySharesAction.js index 5bf0636..a91afde 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js +++ b/dist/tsc/src/commands/actions/KeySharesAction.js @@ -51,7 +51,8 @@ class KeySharesAction extends BaseAction_1.BaseAction { for (const file of files) { const isDir = (await fs_1.promises.stat(file)).isDirectory(); let keystoreFile = file; - let keystorePassword = await fs_1.promises.readFile(this.args.password, 'utf-8'); + let keystoreFile = ''; + //let keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); if (isDir) { const dir = await fs_1.promises.opendir(file); for await (const dirent of dir) { diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js.map b/dist/tsc/src/commands/actions/KeySharesAction.js.map index d3b6ced..5364afe 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js.map +++ b/dist/tsc/src/commands/actions/KeySharesAction.js.map @@ -1 +1 @@ -{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,uBAAgB,CAAC,qHAAqH,CAAC,CAAC;SACnJ;IACH,CAA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AG,MAAM,IAAA,yBAAW,EAAC,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAA,uBAAS,EAAC,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAhJD,0CAgJC"} \ No newline at end of file +{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,uBAAgB,CAAC,qHAAqH,CAA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E,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAA,uBAAS,EAAC,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAjJD,0CAiJC"} \ No newline at end of file diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 56328b3..50c6b55 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -75,7 +75,8 @@ export class KeySharesAction extends BaseAction { for (const file of files) { const isDir = (await fsp.stat(file)).isDirectory(); let keystoreFile = file; - let keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); + let keystorePassword = ''; + //let keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); if (isDir) { const dir = await fsp.opendir(file); From 23d73411013dcd2f01ab446cee0c6170c6d6f5f4 Mon Sep 17 00:00:00 2001 From: gnongs Date: Fri, 29 Nov 2024 20:46:06 +0900 Subject: [PATCH 05/13] add support for splitting keystore files with identical passwords --- dist/tsc/src/commands/actions/KeySharesAction.js | 6 ++++-- dist/tsc/src/commands/actions/KeySharesAction.js.map | 2 +- src/commands/actions/KeySharesAction.ts | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js b/dist/tsc/src/commands/actions/KeySharesAction.js index a91afde..fc58848 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js +++ b/dist/tsc/src/commands/actions/KeySharesAction.js @@ -51,8 +51,7 @@ class KeySharesAction extends BaseAction_1.BaseAction { for (const file of files) { const isDir = (await fs_1.promises.stat(file)).isDirectory(); let keystoreFile = file; - let keystoreFile = ''; - //let keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); + let keystorePassword = ''; if (isDir) { const dir = await fs_1.promises.opendir(file); for await (const dirent of dir) { @@ -64,6 +63,9 @@ class KeySharesAction extends BaseAction_1.BaseAction { } } } + else { + keystorePassword = await fs_1.promises.readFile(this.args.password, 'utf-8'); + } keystoreSet.push({ keystoreFile, keystorePassword }); } const validatedFiles = await this.validateKeystoreFiles(keystoreSet); diff --git a/dist/tsc/src/commands/actions/KeySharesAction.js.map b/dist/tsc/src/commands/actions/KeySharesAction.js.map index 5364afe..b1ebf77 100644 --- a/dist/tsc/src/commands/actions/KeySharesAction.js.map +++ b/dist/tsc/src/commands/actions/KeySharesAction.js.map @@ -1 +1 @@ -{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC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E,MAAM,iBAAiB,GAAG,MAAM,IAAA,yBAAW,EAAC,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAA,uBAAS,EAAC,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAjJD,0CAiJC"} \ No newline at end of file +{"version":3,"file":"KeySharesAction.js","sourceRoot":"","sources":["../../../../../src/commands/actions/KeySharesAction.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,2BAAqC;AAErC,6CAA0C;AAC1C,+CAA4C;AAC5C,qEAAkE;AAClE,6DAA0D;AAC1D,oDAA6D;AAE7D,6CAAuE;AAEvE,2CAQqB;AAErB,+DAAmG;AACnG,4DAA6E;AAY7E;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,MAAM,KAAc,OAAO;QACzB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,wEAAwE;YACrF,SAAS,EAAE;gBACT,4BAAgB;gBAChB,oCAAwB;gBACxB,+BAAmB;gBACnB,sCAA0B;gBAC1B,gCAAoB;gBACpB,gCAAoB;gBACpB,8BAAkB;aACnB;SACF,CAAA;IACH,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC,8BAA8B;QAChE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEO,yBAAyB;QAC/B,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,uBAAgB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AC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;QAEtE,MAAM,iBAAiB,GAAG,MAAM,IAAA,yBAAW,EAAC,WAAW,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,IAAA,uBAAS,EAAC,iBAAiB,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AAnJD,0CAmJC"} \ No newline at end of file diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 50c6b55..bd84055 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -76,7 +76,6 @@ export class KeySharesAction extends BaseAction { const isDir = (await fsp.stat(file)).isDirectory(); let keystoreFile = file; let keystorePassword = ''; - //let keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); if (isDir) { const dir = await fsp.opendir(file); @@ -89,6 +88,9 @@ export class KeySharesAction extends BaseAction { } } } + else { + keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); + } keystoreSet.push({ keystoreFile, keystorePassword }); } From 0fb3adf24084eead9d690c39d421429296ecd234 Mon Sep 17 00:00:00 2001 From: gnongs Date: Wed, 4 Dec 2024 17:22:42 +0000 Subject: [PATCH 06/13] Remove the logs used to debug the content of the loaded keystore file --- src/commands/actions/KeySharesAction.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index bd84055..9d700b5 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -80,9 +80,7 @@ export class KeySharesAction extends BaseAction { if (isDir) { const dir = await fsp.opendir(file); for await (const dirent of dir) { - if (dirent.name.includes('keystore')) { - keystoreFile = path.join(file, dirent.name); - } + keystoreFile = path.join(file, dirent.name); if (dirent.name.includes(this.args.password)) { keystorePassword = await fsp.readFile(path.join(file, dirent.name), 'utf-8'); } @@ -97,8 +95,6 @@ export class KeySharesAction extends BaseAction { const validatedFiles = await this.validateKeystoreFiles(keystoreSet); - process.stdout.write(validatedFiles[0].keystoreFile); - const singleKeySharesList = await Promise.all(validatedFiles.map((keystore, index) => this.processFile(keystore.keystoreFile, keystore.keystorePassword, this.getOperators(), this.args.owner_address, this.args.owner_nonce + index) )); From 11f39a4259e0a73030cb069441ddacf2e0e6b16c Mon Sep 17 00:00:00 2001 From: gnongs Date: Wed, 4 Dec 2024 17:41:14 +0000 Subject: [PATCH 07/13] Remove dependency on the filename when locating the keystore file --- src/commands/actions/KeySharesAction.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 9d700b5..8e2aeeb 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -80,11 +80,11 @@ export class KeySharesAction extends BaseAction { if (isDir) { const dir = await fsp.opendir(file); for await (const dirent of dir) { - keystoreFile = path.join(file, dirent.name); if (dirent.name.includes(this.args.password)) { keystorePassword = await fsp.readFile(path.join(file, dirent.name), 'utf-8'); + } else { + keystoreFile = path.join(file, dirent.name); } - } } else { keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); From 805504d246b9b6b577d76181a06fd65fd4e6760d Mon Sep 17 00:00:00 2001 From: gnongs Date: Wed, 4 Dec 2024 17:49:16 +0000 Subject: [PATCH 08/13] Change folder/file names to more generic terms --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5b9ef2b..1996a25 100644 --- a/README.md +++ b/README.md @@ -107,20 +107,20 @@ yarn cli shares --keystore=./keystore.json --password=./password.txt --operator- # folder with multiple keystore files ## folder structure keystore_folders -├── 0xe020.... -│   ├── keystore-m_12381_3600_1_0_0-1717971132.json +├── validator1 +│   ├── keystore.json │   └── password.txt -├── 0xe025.... -│   ├── keystore-m_12381_3600_6_0_0-1717971134.json +├── validator2 +│   ├── keystore.json │   └── password.txt -├── 0xe02a.... -│   ├── keystore-m_12381_3600_11_0_0-1717971135.json +├── validator3 +│   ├── keystore.json │   └── password.txt -├── 0xe02f.... -│   ├── keystore-m_12381_3600_16_0_0-1717971137.json +├── validator4 +│   ├── keystore.json │   └── password.txt -└── 0xe034.... - ├── keystore-m_12381_3600_21_0_0-1717971139.json +└── validator5 + ├── keystore.json └── password.txt yarn cli shares --keystore=./keystore_folders --password=password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. ``` From a5013244bc9ca999545bda0a683c25ae7bf40899 Mon Sep 17 00:00:00 2001 From: gnongs Date: Wed, 4 Dec 2024 17:57:47 +0000 Subject: [PATCH 09/13] Make the difference between using the same password file and using different password files more clear --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1996a25..3b1eac9 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,18 @@ To run you will use the "shares" command yarn cli shares --keystore=./keystore.json --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. # folder with multiple keystore files -## folder structure +## folder structure for keystore files with the same password +keystore-files +├── keystore1.json +├── keystore2.json +├── keystore3.json +├── keystore4.json +└── keystore5.json +password.txt + +yarn cli shares --keystore=./keystore_files --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. + +## folder structure for keystore files with diffent passwords keystore_folders ├── validator1 │   ├── keystore.json @@ -122,6 +133,7 @@ keystore_folders └── validator5 ├── keystore.json └── password.txt + yarn cli shares --keystore=./keystore_folders --password=password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. ``` From 96f9b0ea36f8578f65a8a4be0972428fbcbc39ea Mon Sep 17 00:00:00 2001 From: gnongs Date: Wed, 4 Dec 2024 18:01:53 +0000 Subject: [PATCH 10/13] Remove the section containing incorrect information --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 3b1eac9..da3769a 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,6 @@ To run you will use the "shares" command - owner-nonce (on) = The validator registration nonce of the account (owner address) within the SSV contract (increments after each validator registration), obtained using the ssv-scanner tool ```bash - -6 directories, 20 files # single file yarn cli shares --keystore=./keystore.json --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. From 2a43fac345bb1a16a9316c7bb12229a4c26fc751 Mon Sep 17 00:00:00 2001 From: gnongs Date: Fri, 3 Jan 2025 14:51:59 +0000 Subject: [PATCH 11/13] Fix build error caused by missing closing curly brace --- src/commands/actions/KeySharesAction.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 8e2aeeb..95ed4b8 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -85,6 +85,7 @@ export class KeySharesAction extends BaseAction { } else { keystoreFile = path.join(file, dirent.name); } + } } else { keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); From 177182151551b2767f7c974888d3dd4e1bd7d34f Mon Sep 17 00:00:00 2001 From: gnongs Date: Sun, 5 Jan 2025 08:13:24 +0000 Subject: [PATCH 12/13] Change to direct input password value when using the same password --- src/commands/actions/KeySharesAction.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/commands/actions/KeySharesAction.ts b/src/commands/actions/KeySharesAction.ts index 95ed4b8..c52159c 100644 --- a/src/commands/actions/KeySharesAction.ts +++ b/src/commands/actions/KeySharesAction.ts @@ -74,8 +74,8 @@ export class KeySharesAction extends BaseAction { for (const file of files) { const isDir = (await fsp.stat(file)).isDirectory(); - let keystoreFile = file; - let keystorePassword = ''; + keystoreFile = file; + keystorePassword = this.args.password; if (isDir) { const dir = await fsp.opendir(file); @@ -87,9 +87,6 @@ export class KeySharesAction extends BaseAction { } } } - else { - keystorePassword = await fsp.readFile(this.args.password, 'utf-8'); - } keystoreSet.push({ keystoreFile, keystorePassword }); } From 0ad5718f292a4e22e28a86f07faa904cb966bf1f Mon Sep 17 00:00:00 2001 From: gnongs Date: Sun, 5 Jan 2025 08:32:04 +0000 Subject: [PATCH 13/13] Update the README.md description related to the password --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index da3769a..428ce58 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ To run you will use the "shares" command ```bash # single file -yarn cli shares --keystore=./keystore.json --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. +yarn cli shares --keystore=keystore.json --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. # folder with multiple keystore files ## folder structure for keystore files with the same password @@ -110,29 +110,28 @@ keystore-files ├── keystore3.json ├── keystore4.json └── keystore5.json -password.txt -yarn cli shares --keystore=./keystore_files --password=./password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. +yarn cli shares --keystore=./keystore_files --password=test --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. ## folder structure for keystore files with diffent passwords keystore_folders ├── validator1 │   ├── keystore.json -│   └── password.txt +│   └── password ├── validator2 │   ├── keystore.json -│   └── password.txt +│   └── password ├── validator3 │   ├── keystore.json -│   └── password.txt +│   └── password ├── validator4 │   ├── keystore.json -│   └── password.txt +│   └── password └── validator5 ├── keystore.json - └── password.txt + └── password -yarn cli shares --keystore=./keystore_folders --password=password.txt --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. +yarn cli shares --keystore=./keystore_folders --password=password --operator-ids=1,2,3,4 --operator-keys=LS..,LS..,LS..,LS.. --output-folder=./ --owner-address=... --owner-nonce=.. ``` **Output:** Name will start with keyshares-timestamp.json