-
Notifications
You must be signed in to change notification settings - Fork 32
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
Generate access keys during init command #68
Conversation
9c44411
to
a731d85
Compare
chain-cli/src/keys.ts
Outdated
} else { | ||
execSync(`mkdir -p ${keysPath}`); | ||
} | ||
execSync(`mkdir -p ${keysPath}`); |
There was a problem hiding this comment.
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
a53e96d
to
074ea17
Compare
@@ -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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(""); |
There was a problem hiding this comment.
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
chain-cli/src/galachain-utils.ts
Outdated
const devPrivateKey = secp.utils.bytesToHex(secp.utils.randomPrivateKey()); | ||
const devPublicKey = secp.utils.bytesToHex(secp.getPublicKey(adminPrivateKey)); | ||
|
||
execSync(`mkdir -p ${keysPath}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use fs.mkdir()
7a70475
to
8112af1
Compare
@@ -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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const developerPrivateKey = args.developerPrivateKey ?? (await getPrivateKey(args.developerPrivateKey)); | |
const developerPrivateKey = await getPrivateKey(args.developerPrivateKey); |
8112af1
to
86692e2
Compare
Closes #21