Skip to content

Commit

Permalink
feat: add some cleanup for import and README
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson2427 committed Jul 1, 2024
1 parent 5635751 commit c6b1a2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ To import an existing private key into KMS:
```bash
$ ape aws kms import KeyAlias
Enter your private key:
SUCCESS (ape-aws): Key imported successfully with ID: <key-id>
SUCCESS: Key imported successfully with ID: <key-id>
```

You can also import a private key from a file (from hex or bytes):

```bash
$ ape aws kms import KeyAlias --private-key <path-to-private-key>
INFO: Reading private key from <private-key-file>
SUCCESS (ape-aws): Key imported successfully with ID: <key-id>
SUCCESS: Key imported successfully with ID: <key-id>
```

You can import using a mnemonic phrase as well:
Expand Down
10 changes: 1 addition & 9 deletions ape_aws/kms/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ def kms():
"administrators",
multiple=True,
help="Apply key policy to a list of administrators if applicable, ex. -a ARN1, -a ARN2",
metavar="list[ARN]",
)
@click.option(
"-u",
"--user",
"users",
multiple=True,
help="Apply key policy to a list of users if applicable, ex. -u ARN1, -u ARN2",
metavar="list[ARN]",
)
@click.option(
"-d",
Expand Down Expand Up @@ -71,30 +69,26 @@ def create_key(
"private_key_path",
type=click.Path(),
help="The private key you intend to import",
metavar="Path",
)
@click.option(
"-a",
"--admin",
"administrators",
multiple=True,
help="Apply key policy to a list of administrators if applicable, ex. -a ARN1, -a ARN2",
metavar="ARN",
)
@click.option(
"-u",
"--user",
"users",
multiple=True,
help="Apply key policy to a list of users if applicable, ex. -u ARN1, -u ARN2",
metavar="list[ARN]",
)
@click.option(
"-d",
"--description",
"description",
help="The description of the key you intend to create.",
metavar="str",
)
@click.option(
"--use-mnemonic",
Expand All @@ -106,7 +100,7 @@ def create_key(
"--hd-path",
"hd_path",
help="The hierarchical deterministic path to derive the key from",
metavar="str",
default=ETHEREUM_DEFAULT_PATH,
)
@click.argument("alias_name")
def import_key(
Expand All @@ -127,8 +121,6 @@ def import_key(
private_key = private_key_path.read_text().strip()

elif import_from_mnemonic:
if not hd_path:
hd_path = ETHEREUM_DEFAULT_PATH
mnemonic = click.prompt("Enter your mnemonic phrase", hide_input=True)
EthAccount.enable_unaudited_hdwallet_features()
account = EthAccount.from_mnemonic(mnemonic, account_path=hd_path)
Expand Down

0 comments on commit c6b1a2d

Please sign in to comment.