Skip to content

Commit

Permalink
fix: call cmd secret key (#7907)
Browse files Browse the repository at this point in the history
private key -> secret key
  • Loading branch information
alexghr authored Aug 12, 2024
1 parent 32b4c6e commit 3afe9f8
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion aztec-up/bin/aztec
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ elif [ "${1:-}" == "start" ]; then
export ENV_VARS_TO_INJECT="${ENV_VARS_TO_INJECT[*]}"
ENV_VARS_TO_INJECT="${ENV_VARS_TO_INJECT[*]}" INHERIT_USER=0 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@"
else
SKIP_PORT_ASSIGNMENT=1 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@"
ENV_VARS_TO_INJECT="SECRET_KEY" SKIP_PORT_ASSIGNMENT=1 $(dirname $0)/.aztec-run aztecprotocol/aztec "$@"
fi
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ services:
environment:
PXE_URL: http://pxe:8080
NODE_NO_WARNINGS: 1
PRIVATE_KEY:
SECRET_KEY:
ETHEREUM_HOST:
profiles:
- cli
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Replace `<command>` with the actual command you want to execute and `[options]`
Some options can be set globally as environment variables to avoid having to re-enter them every time you call `aztec-cli.`
These options are:
- `PRIVATE_KEY` -> `-k, --private-key` for all commands that require a private key.
- `SECRET_KEY` -> `-sk, --secret-key` for all commands that require an Aztec secret key.
- `PUBLIC_KEY` -> `-k, --public-key` for all commands that require a public key.
- `PXE_URL` -> `-u, --rpc-url` for commands that require a PXE
- `ETHEREUM_RPC_HOST` -> `-u, --rpc-url` for `deploy-l1-contracts`.
Expand Down
11 changes: 0 additions & 11 deletions yarn-project/cli/src/cmds/misc/generate_private_key.ts

This file was deleted.

5 changes: 5 additions & 0 deletions yarn-project/cli/src/cmds/misc/generate_secret_key.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Fr } from '@aztec/aztec.js';

export function generateSecretKey() {
return { secretKey: Fr.random() };
}
15 changes: 11 additions & 4 deletions yarn-project/cli/src/cmds/misc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@ import { type LogFn } from '@aztec/foundation/log';

import { type Command } from 'commander';

import { prettyPrintJSON } from '../../utils/commands.js';

export * from './deploy_contracts.js';

export function injectCommands(program: Command, log: LogFn) {
program
.command('generate-keys')
.summary('Generates encryption and signing private keys.')
.description('Generates and encryption and signing private key pair.')
.action(async _options => {
const { generateKeys } = await import('./generate_private_key.js');
const { privateEncryptionKey, privateSigningKey } = generateKeys();
log(`Encryption Private Key: ${privateEncryptionKey}\nSigning Private key: ${privateSigningKey}\n`);
.option('--json', 'Output the keys in JSON format')
.action(async ({ json }) => {
const { generateSecretKey } = await import('./generate_secret_key.js');
const { secretKey } = generateSecretKey();
if (json) {
log(prettyPrintJSON({ secretKey: secretKey.toString() }));
} else {
log(`Secret Key: ${secretKey}`);
}
});

program
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli/src/cmds/pxe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: DebugL
options.args,
options.contractArtifact,
options.contractAddress,
options.privateKey,
options.secretKey,
options.rpcUrl,
debugLogger,
log,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/cli/src/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function inspectTx(
]);
// Base tx data
log(`Tx ${txHash.toString()}`);
log(` Status: ${receipt.status} ${effects ? `(${effects.revertCode.getDescription()}})` : ''})`);
log(` Status: ${receipt.status} ${effects ? `(${effects.revertCode.getDescription()})` : ''}`);
if (receipt.error) {
log(` Error: ${receipt.error}`);
}
Expand Down

0 comments on commit 3afe9f8

Please sign in to comment.