Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate access keys during init command #68

Merged

Conversation

herr-bubu
Copy link
Contributor

Closes #21

@herr-bubu herr-bubu force-pushed the generate-key-pair-along-with-initialization-from-template branch from 9c44411 to a731d85 Compare February 29, 2024 11:32
} else {
execSync(`mkdir -p ${keysPath}`);
}
execSync(`mkdir -p ${keysPath}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deliberately removed Windows support as it won't be neccessary after this one is merged: #67

@herr-bubu herr-bubu force-pushed the generate-key-pair-along-with-initialization-from-template branch from a53e96d to 074ea17 Compare March 5, 2024 17:42
@@ -45,7 +46,7 @@ export default class Connect extends BaseCommand<typeof Connect> {
async run(): Promise<void> {
const { args, flags } = await this.parse(Connect);

const developerPrivateKey = args.developerPrivateKey ?? process.env.DEV_PRIVATE_KEY;
const developerPrivateKey = args.developerPrivateKey ?? (await getPrivateKey());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const developerPrivateKey = args.developerPrivateKey ?? (await getPrivateKey());
const developerPrivateKey = await getPrivateKey(args.developerPrivateKey);
getPrivateKey(keyArg: string | undefined)

@@ -69,6 +71,8 @@ describe("ChainInfo Command", () => {

process.env = { ...process.env, DEV_PRIVATE_KEY: undefined };

jest.spyOn(fs, "readFileSync").mockReturnValue("");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be verified if missing file throws an exception or returns empty string

const devPrivateKey = secp.utils.bytesToHex(secp.utils.randomPrivateKey());
const devPublicKey = secp.utils.bytesToHex(secp.getPublicKey(adminPrivateKey));

execSync(`mkdir -p ${keysPath}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use fs.mkdir()

@herr-bubu herr-bubu force-pushed the generate-key-pair-along-with-initialization-from-template branch from 7a70475 to 8112af1 Compare March 6, 2024 13:20
@@ -45,7 +46,7 @@ export default class Connect extends BaseCommand<typeof Connect> {
async run(): Promise<void> {
const { args, flags } = await this.parse(Connect);

const developerPrivateKey = args.developerPrivateKey ?? process.env.DEV_PRIVATE_KEY;
const developerPrivateKey = args.developerPrivateKey ?? (await getPrivateKey(args.developerPrivateKey));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const developerPrivateKey = args.developerPrivateKey ?? (await getPrivateKey(args.developerPrivateKey));
const developerPrivateKey = await getPrivateKey(args.developerPrivateKey);

@herr-bubu herr-bubu force-pushed the generate-key-pair-along-with-initialization-from-template branch from 8112af1 to 86692e2 Compare March 7, 2024 07:55
@herr-bubu herr-bubu marked this pull request as ready for review March 7, 2024 07:55
@herr-bubu herr-bubu merged commit 93f9bd7 into main Mar 7, 2024
7 checks passed
@herr-bubu herr-bubu deleted the generate-key-pair-along-with-initialization-from-template branch March 7, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Generate key pair along with initialization from template
2 participants