Skip to content

Commit

Permalink
Add keys related fixtures and modify help check script
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed May 9, 2024
1 parent 1aa3098 commit b50a71c
Show file tree
Hide file tree
Showing 8 changed files with 398 additions and 16 deletions.
102 changes: 102 additions & 0 deletions utils/e2e-tests/bash/fixtures/help.build-spec.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Build a chain specification

Usage: humanode-peer build-spec [OPTIONS]

Options:
--raw
Force raw genesis storage output

--disable-default-bootnode
Disable adding the default bootnode to the specification.

By default the `/ip4/127.0.0.1/tcp/30333/p2p/NODE_PEER_ID` bootnode is added to the specification when no bootnode exists.

--chain <CHAIN_SPEC>
Specify the chain specification.

It can be one of the predefined ones (dev, local, or staging) or it can be a path to a file with the chainspec (such as one exported by the `build-spec` subcommand).

--dev
Specify the development chain.

This flag sets `--chain=dev`, `--force-authoring`, `--rpc-cors=all`, `--alice`, and `--tmp` flags, unless explicitly overridden.

-d, --base-path <PATH>
Specify custom base path

-l, --log <LOG_PATTERN>...
Sets a custom logging filter. Syntax is `<target>=<level>`, e.g. -lsync=debug.

Log levels (least to most verbose) are error, warn, info, debug, and trace. By default, all targets log `info`. The global log level can be set with `-l<level>`.

--detailed-log-output
Enable detailed log output.

This includes displaying the log target, log level and thread name.

This is automatically enabled when something is logged with any higher level than `info`.

--disable-log-color
Disable log color output

--enable-log-reloading
Enable feature to dynamically update and reload the log filter.

Be aware that enabling this feature can lead to a performance decrease up to factor six or more. Depending on the global logging level the performance decrease changes.

The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this option not being set.

--tracing-targets <TARGETS>
Sets a custom profiling filter. Syntax is the same as for logging: `<target>=<level>`

--tracing-receiver <RECEIVER>
Receiver to process tracing messages

[default: log]

Possible values:
- log: Output the tracing records using the log

--node-key <KEY>
The secret key to use for libp2p networking.

The value is a string that is parsed according to the choice of `--node-key-type` as follows:

`ed25519`: The value is parsed as a hex-encoded Ed25519 32 byte secret key, i.e. 64 hex characters.

The value of this option takes precedence over `--node-key-file`.

WARNING: Secrets provided as command-line arguments are easily exposed. Use of this option should be limited to development and testing. To use an externally managed secret key, use `--node-key-file` instead.

--node-key-type <TYPE>
The type of secret key to use for libp2p networking.

The secret key of the node is obtained as follows:

* If the `--node-key` option is given, the value is parsed as a secret key according to the type. See the documentation for `--node-key`.

* If the `--node-key-file` option is given, the secret key is read from the specified file. See the documentation for `--node-key-file`.

* Otherwise, the secret key is read from a file with a predetermined, type-specific name from the chain-specific network config directory inside the base directory specified by `--base-dir`. If this file does not exist, it is created with a newly generated secret key of the chosen type.

The node's secret key determines the corresponding public key and hence the node's peer ID in the context of libp2p.

[default: ed25519]

Possible values:
- ed25519: Use ed25519

--node-key-file <FILE>
The file from which to read the node's secret key to use for libp2p networking.

The contents of the file are parsed according to the choice of `--node-key-type` as follows:

`ed25519`: The file must contain an unencoded 32 byte or hex encoded Ed25519 secret key.

If the file does not exist, it is created with a newly generated secret key of the chosen type.

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Generate a random node key, write it to a file or stdout and write the corresponding peer-id to stderr

Usage: humanode-peer key generate-node-key [OPTIONS]

Options:
--file <FILE>
Name of file to save secret key to.

If not given, the secret key is printed to stdout.

--bin
The output is in raw binary format.

If not given, the output is written as an hex encoded string.

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
50 changes: 50 additions & 0 deletions utils/e2e-tests/bash/fixtures/help.key.generate.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Generate a random account

Usage: humanode-peer key generate [OPTIONS]

Options:
-w, --words <WORDS>
The number of words in the phrase to generate. One of 12 (default), 15, 18, 21 and 24

--keystore-uri <KEYSTORE_URI>
Specify custom URIs to connect to for keystore-services

--keystore-path <PATH>
Specify custom keystore path

--password-interactive
Use interactive shell for entering the password used by the keystore

--password <PASSWORD>
Password used by the keystore. This allows appending an extra user-defined secret to the seed

--password-filename <PATH>
File that contains the password used by the keystore

-n, --network <NETWORK>
network address format

--output-type <FORMAT>
output format

[default: text]

Possible values:
- json: Output as json
- text: Output as text

--scheme <SCHEME>
cryptography scheme

[default: sr25519]

Possible values:
- ed25519: Use ed25519
- sr25519: Use sr25519
- ecdsa: Use

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
85 changes: 85 additions & 0 deletions utils/e2e-tests/bash/fixtures/help.key.insert.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Insert a key to the keystore of a node

Usage: humanode-peer key insert [OPTIONS] --key-type <KEY_TYPE> --scheme <SCHEME>

Options:
--suri <SURI>
The secret key URI. If the value is a file, the file content is used as URI. If not given, you will be prompted for the URI

--key-type <KEY_TYPE>
Key type, examples: "gran", or "imon"

--chain <CHAIN_SPEC>
Specify the chain specification.

It can be one of the predefined ones (dev, local, or staging) or it can be a path to a file with the chainspec (such as one exported by the `build-spec` subcommand).

--dev
Specify the development chain.

This flag sets `--chain=dev`, `--force-authoring`, `--rpc-cors=all`, `--alice`, and `--tmp` flags, unless explicitly overridden.

-d, --base-path <PATH>
Specify custom base path

-l, --log <LOG_PATTERN>...
Sets a custom logging filter. Syntax is `<target>=<level>`, e.g. -lsync=debug.

Log levels (least to most verbose) are error, warn, info, debug, and trace. By default, all targets log `info`. The global log level can be set with `-l<level>`.

--detailed-log-output
Enable detailed log output.

This includes displaying the log target, log level and thread name.

This is automatically enabled when something is logged with any higher level than `info`.

--disable-log-color
Disable log color output

--enable-log-reloading
Enable feature to dynamically update and reload the log filter.

Be aware that enabling this feature can lead to a performance decrease up to factor six or more. Depending on the global logging level the performance decrease changes.

The `system_addLogFilter` and `system_resetLogFilter` RPCs will have no effect with this option not being set.

--tracing-targets <TARGETS>
Sets a custom profiling filter. Syntax is the same as for logging: `<target>=<level>`

--tracing-receiver <RECEIVER>
Receiver to process tracing messages

[default: log]

Possible values:
- log: Output the tracing records using the log

--keystore-uri <KEYSTORE_URI>
Specify custom URIs to connect to for keystore-services

--keystore-path <PATH>
Specify custom keystore path

--password-interactive
Use interactive shell for entering the password used by the keystore

--password <PASSWORD>
Password used by the keystore. This allows appending an extra user-defined secret to the seed

--password-filename <PATH>
File that contains the password used by the keystore

--scheme <SCHEME>
The cryptography scheme that should be used to generate the key out of the given URI

Possible values:
- ed25519: Use ed25519
- sr25519: Use sr25519
- ecdsa: Use

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
23 changes: 23 additions & 0 deletions utils/e2e-tests/bash/fixtures/help.key.inspect-node-key.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Load a node key from a file or stdin and print the corresponding peer-id

Usage: humanode-peer key inspect-node-key [OPTIONS]

Options:
--file <FILE>
Name of file to read the secret key from.

If not given, the secret key is read from stdin (up to EOF).

--bin
The input is in raw binary format.

If not given, the input is read as an hex encoded string.

-n, --network <NETWORK>
This argument is deprecated and has no effect for this command

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
67 changes: 67 additions & 0 deletions utils/e2e-tests/bash/fixtures/help.key.inspect.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Gets a public key and a SS58 address from the provided Secret URI

Usage: humanode-peer key inspect [OPTIONS] [URI]

Arguments:
[URI]
A Key URI to be inspected. May be a secret seed, secret URI (with derivation paths and password), SS58, public URI or a hex encoded public key.

If it is a hex encoded public key, `--public` needs to be given as argument.

If the given value is a file, the file content will be used as URI.

If omitted, you will be prompted for the URI.

Options:
--public
Is the given `uri` a hex encoded public key?

--keystore-uri <KEYSTORE_URI>
Specify custom URIs to connect to for keystore-services

--keystore-path <PATH>
Specify custom keystore path

--password-interactive
Use interactive shell for entering the password used by the keystore

--password <PASSWORD>
Password used by the keystore. This allows appending an extra user-defined secret to the seed

--password-filename <PATH>
File that contains the password used by the keystore

-n, --network <NETWORK>
network address format

--output-type <FORMAT>
output format

[default: text]

Possible values:
- json: Output as json
- text: Output as text

--scheme <SCHEME>
cryptography scheme

[default: sr25519]

Possible values:
- ed25519: Use ed25519
- sr25519: Use sr25519
- ecdsa: Use

--expect-public <EXPECT_PUBLIC>
Expect that `--uri` has the given public key/account-id.

If `--uri` has any derivations, the public key is checked against the base `uri`, i.e. the `uri` without any derivation applied. However, if `uri` has a password or there is one given by `--password`, it will be used to decrypt `uri` before comparing the public key/account-id.

If there is no derivation in `--uri`, the public key will be checked against the public key of `--uri` directly.

-h, --help
Print help (see a summary with '-h')

-V, --version
Print version
15 changes: 15 additions & 0 deletions utils/e2e-tests/bash/fixtures/help.key.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Key management cli utilities

Usage: humanode-peer key <COMMAND>

Commands:
generate-node-key Generate a random node key, write it to a file or stdout and write the corresponding peer-id to stderr
generate Generate a random account
inspect Gets a public key and a SS58 address from the provided Secret URI
inspect-node-key Load a node key from a file or stdin and print the corresponding peer-id
insert Insert a key to the keystore of a node
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help
-V, --version Print version
Loading

0 comments on commit b50a71c

Please sign in to comment.