Refactoring Checkpoint: (WIP)

This commit is contained in:
2025-12-14 10:29:31 +03:00
parent 09735eb97a
commit c89d7cac55
1424 changed files with 6415 additions and 6064 deletions
@@ -1,5 +1,5 @@
[package]
name = "subkey"
name = "pez-subkey"
version = "9.0.0"
authors.workspace = true
description = "Generate and restore keys for Bizinikiwi based chains such as Pezkuwi, Kusama and a growing number of teyrchains and Bizinikiwi based projects."
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
homepage.workspace = true
repository.workspace = true
readme = "README.md"
documentation = "https://docs.rs/subkey"
documentation = "https://docs.rs/pez-subkey"
[lints]
workspace = true
@@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[[bin]]
path = "src/main.rs"
name = "subkey"
name = "pez-subkey"
[dependencies]
clap = { features = ["derive"], workspace = true }
@@ -3,26 +3,26 @@
Subkey is a commandline utility included with Bizinikiwi. It allows generating and restoring keys for Bizinikiwi based
chains such as PezkuwiChain, Kusama and a growing number of teyrchains and Bizinikiwi based projects.
`subkey` provides a few sub-commands to generate keys, check keys, sign messages, verify messages, etc...
`pez_subkey` provides a few sub-commands to generate keys, check keys, sign messages, verify messages, etc...
You can see the full list of commands with `subkey --help`. Most commands have additional help available with for
instance `subkey generate --help` for the `generate` command.
You can see the full list of commands with `pez_subkey --help`. Most commands have additional help available with for
instance `pez_subkey generate --help` for the `generate` command.
## Safety first
`subkey` does not need an internet connection to work. Indeed, for the best security, you should be using `subkey` on a
`pez_subkey` does not need an internet connection to work. Indeed, for the best security, you should be using `pez_subkey` on a
machine that is **not connected** to the internet.
`subkey` deals with **seeds** and **private keys**. Make sure to use `subkey` in a safe environment (ie. no one looking
`pez_subkey` deals with **seeds** and **private keys**. Make sure to use `pez_subkey` in a safe environment (ie. no one looking
over your shoulder) and on a safe computer (ie. no one able to check your command history).
If you save any output of `subkey` into a file, make sure to apply proper permissions and/or delete the file as soon as
If you save any output of `pez_subkey` into a file, make sure to apply proper permissions and/or delete the file as soon as
possible.
## Usage
The following guide explains *some* of the `subkey` commands. For the full list and the most up to date documentation,
make sure to check the integrated help with `subkey --help`.
The following guide explains *some* of the `pez_subkey` commands. For the full list and the most up to date documentation,
make sure to check the integrated help with `pez_subkey --help`.
### Install with Cargo
@@ -32,8 +32,8 @@ dependencies and Subkey, respectively:
Command:
```bash
# Install only `subkey`, at a specific version of the subkey crate
cargo install --force subkey --git https://github.com/pezkuwichain/kurdistan-sdk --version <SET VERSION> --locked
# Install only `pez_subkey`, at a specific version of the pez_subkey crate
cargo install --force pez_subkey --git https://github.com/pezkuwichain/kurdistan-sdk --version <SET VERSION> --locked
# If you run into issues building, you likely are missing deps defined in https://docs.pezkuwichain.io/install/
```
@@ -41,7 +41,7 @@ cargo install --force subkey --git https://github.com/pezkuwichain/kurdistan-sdk
```bash
# Use `--pull=always` with the `latest` tag, or specify a version in a tag
docker run -it --pull=always docker.io/parity/subkey:latest <command to subkey>
docker run -it --pull=always docker.io/parity/pez_subkey:latest <command to pez_subkey>
```
### Generate a random account
@@ -49,7 +49,7 @@ docker run -it --pull=always docker.io/parity/subkey:latest <command to subkey>
Generating a new key is as simple as running:
```bash
subkey generate
pez_subkey generate
```
The output looks similar to:
@@ -90,12 +90,12 @@ SS58 addresses are:
### Json output
`subkey` can also generate the output as *json*. This is useful for automation.
`pez_subkey` can also generate the output as *json*. This is useful for automation.
command:
```bash
subkey generate --output-type json
pez_subkey generate --output-type json
```
output:
@@ -115,7 +115,7 @@ So if you only want to get the `secretSeed` for instance, you can use:
command:
```bash
subkey generate --output-type json | jq -r .secretSeed
pez_subkey generate --output-type json | jq -r .secretSeed
```
output:
@@ -126,10 +126,10 @@ output:
### Additional user-defined password
`subkey` supports an additional user-defined secret that will be appended to the seed. Let's see the following example:
`pez_subkey` supports an additional user-defined secret that will be appended to the seed. Let's see the following example:
```bash
subkey generate --password extra_secret
pez_subkey generate --password extra_secret
```
output:
@@ -146,7 +146,7 @@ Using the `inspect` command (see more details below), we see that knowing only t
sufficient to recover the account:
```bash
subkey inspect "soup lyrics media market way crouch elevator put moon useful question wide"
pez_subkey inspect "soup lyrics media market way crouch elevator put moon useful question wide"
```
which recovers the account `5Fe4sqj2K4fRuzEGvToi4KATqZfiDU7TqynjXG6PZE2dxwyh` and not
@@ -155,25 +155,25 @@ which recovers the account `5Fe4sqj2K4fRuzEGvToi4KATqZfiDU7TqynjXG6PZE2dxwyh` an
this time passing also the required `password` as shown below:
```bash
subkey inspect --password extra_secret "soup lyrics media market way crouch elevator put moon useful question wide"
pez_subkey inspect --password extra_secret "soup lyrics media market way crouch elevator put moon useful question wide"
```
This time, we properly recovered `5He5pZpc7AJ8evPuab37vJF6KkFDqq9uDq2WXh877Qw6iaVC`.
### Inspecting a key
If you have *some data* about a key, `subkey inspect` will help you discover more information about it.
If you have *some data* about a key, `pez_subkey inspect` will help you discover more information about it.
If you have **secrets** that you would like to verify for instance, you can use:
```bash
subkey inspect < mnemonic | seed >
pez_subkey inspect < mnemonic | seed >
```
If you have only **public data**, you can see a subset of the information:
```bash
subkey inspect --public < pubkey | address >
pez_subkey inspect --public < pubkey | address >
```
**NOTE**: While you will be able to recover the secret seed from the mnemonic, the opposite is not possible.
@@ -184,7 +184,7 @@ subkey inspect --public < pubkey | address >
command:
```bash
subkey inspect 0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c92d
pez_subkey inspect 0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c92d
```
output:
@@ -199,11 +199,11 @@ Secret Key URI `0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c9
### Signing
`subkey` allows using a **secret key** to sign a random message. The signature can then be verified by anyone using your
`pez_subkey` allows using a **secret key** to sign a random message. The signature can then be verified by anyone using your
**public key**:
```bash
echo -n <msg> | subkey sign --suri <seed|mnemonic>
echo -n <msg> | pez_subkey sign --suri <seed|mnemonic>
```
example:
@@ -211,7 +211,7 @@ example:
```text
MESSAGE=hello
SURI=0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c92d
echo -n $MESSAGE | subkey sign --suri $SURI
echo -n $MESSAGE | pez_subkey sign --suri $SURI
```
output:
@@ -225,11 +225,11 @@ valid.
### Verifying a signature
Given a message, a signature and an address, `subkey` can verify whether the **message** has been digitally signed by
Given a message, a signature and an address, `pez_subkey` can verify whether the **message** has been digitally signed by
the holder (or one of the holders) of the **private key** for the given **address**:
```bash
echo -n <msg> | subkey verify <sig> <address>
echo -n <msg> | pez_subkey verify <sig> <address>
```
example:
@@ -238,7 +238,7 @@ example:
MESSAGE=hello
URI=0xfec70cfbf1977c6965b5af10a4534a6a35d548eb14580594d0bc543286892515
SIGNATURE=9201af3788ad4f986b800853c79da47155f2e08fde2070d866be4c27ab060466fea0623dc2b51f4392f4c61f25381a62848dd66c5d8217fae3858e469ebd668c
echo -n $MESSAGE | subkey verify $SIGNATURE $URI
echo -n $MESSAGE | pez_subkey verify $SIGNATURE $URI
```
output:
@@ -261,7 +261,7 @@ warned, depending on your hardware this may take a while.
command:
```bash
subkey vanity --network pezkuwi --pattern bob
pez_subkey vanity --network pezkuwi --pattern bob
```
output:
@@ -5,7 +5,7 @@ security and risks in the [Pezkuwi Wiki](https://wiki.network.pezkuwichain.io/do
network has a few **test networks**, e.g. **Zagros**. Test networks are a great way to experiment and learn safely as
you can lose tokens on those networks without any financial consequences.
`subkey` generates and provides 2 pieces of **secret** information:
`pez_subkey` generates and provides 2 pieces of **secret** information:
- **secret phrase**: a bunch of words, exactly 12 by default (can be 12, 15, 18, 21 or 24)
- **secret seed**: a big hexadecimal value
@@ -22,28 +22,28 @@
//! for Bizinikiwi based chains such as Pezkuwi, Kusama and a growing number of teyrchains and
//! Bizinikiwi based projects.
//! `subkey` provides a few sub-commands to generate keys, check keys, sign messages, verify
//! `pez_subkey` provides a few sub-commands to generate keys, check keys, sign messages, verify
//! messages, etc...
//!
//! You can see the full list of commands with `subkey --help`. Most commands have additional help
//! available with for instance `subkey generate --help` for the `generate` command.
//! You can see the full list of commands with `pez_subkey --help`. Most commands have additional help
//! available with for instance `pez_subkey generate --help` for the `generate` command.
//!
//! ## Safety first
//!
//! `subkey` does not need an internet connection to work. Indeed, for the best security, you should
//! be using `subkey` on a machine that is **not connected** to the internet.
//! `pez_subkey` does not need an internet connection to work. Indeed, for the best security, you should
//! be using `pez_subkey` on a machine that is **not connected** to the internet.
//!
//! `subkey` deals with **seeds** and **private keys**. Make sure to use `subkey` in a safe
//! `pez_subkey` deals with **seeds** and **private keys**. Make sure to use `pez_subkey` in a safe
//! environment (ie. no one looking over your shoulder) and on a safe computer (ie. no one able to
//! check your command history).
//!
//! If you save any output of `subkey` into a file, make sure to apply proper permissions and/or
//! If you save any output of `pez_subkey` into a file, make sure to apply proper permissions and/or
//! delete the file as soon as possible.
//!
//! ## Usage
//!
//! The following guide explains *some* of the `subkey` commands. For the full list and the most up
//! to date documentation, make sure to check the integrated help with `subkey --help`.
//! The following guide explains *some* of the `pez_subkey` commands. For the full list and the most up
//! to date documentation, make sure to check the integrated help with `pez_subkey --help`.
//!
//! ### Install with Cargo
//!
@@ -53,8 +53,8 @@
//! Command:
//!
//! ```bash
//! # Install only `subkey`, at a specific version of the subkey crate
//! cargo install --force subkey --git https://github.com/pezkuwichain/kurdistan-sdk --version <SET VERSION> --locked
//! # Install only `pez_subkey`, at a specific version of the pez_subkey crate
//! cargo install --force pez_subkey --git https://github.com/pezkuwichain/kurdistan-sdk --version <SET VERSION> --locked
//! # If you run into issues building, you likely are missing deps defined in https://docs.pezkuwichain.io/install/
//! ```
//!
@@ -62,7 +62,7 @@
//!
//! ```bash
//! # Use `--pull=always` with the `latest` tag, or specify a version in a tag
//! docker run -it --pull=always docker.io/parity/subkey:latest <command to subkey>
//! docker run -it --pull=always docker.io/parity/pez_subkey:latest <command to pez_subkey>
//! ```
//!
//! ### Generate a random account
@@ -70,7 +70,7 @@
//! Generating a new key is as simple as running:
//!
//! ```bash
//! subkey generate
//! pez_subkey generate
//! ```
//!
//! The output looks similar to:
@@ -110,12 +110,12 @@
//!
//! ### Json output
//!
//! `subkey` can also generate the output as *json*. This is useful for automation.
//! `pez_subkey` can also generate the output as *json*. This is useful for automation.
//!
//! command:
//!
//! ```bash
//! subkey generate --output-type json
//! pez_subkey generate --output-type json
//! ```
//!
//! output:
@@ -135,7 +135,7 @@
//! command:
//!
//! ```bash
//! subkey generate --output-type json | jq -r .secretSeed
//! pez_subkey generate --output-type json | jq -r .secretSeed
//! ```
//!
//! output:
@@ -146,11 +146,11 @@
//!
//! ### Additional user-defined password
//!
//! `subkey` supports an additional user-defined secret that will be appended to the seed. Let's see
//! `pez_subkey` supports an additional user-defined secret that will be appended to the seed. Let's see
//! the following example:
//!
//! ```bash
//! subkey generate --password extra_secret
//! pez_subkey generate --password extra_secret
//! ```
//!
//! output:
@@ -167,7 +167,7 @@
//! seed** is no longer sufficient to recover the account:
//!
//! ```bash
//! subkey inspect "soup lyrics media market way crouch elevator put moon useful question wide"
//! pez_subkey inspect "soup lyrics media market way crouch elevator put moon useful question wide"
//! ```
//!
//! which recovers the account `5Fe4sqj2K4fRuzEGvToi4KATqZfiDU7TqynjXG6PZE2dxwyh` and not
@@ -177,26 +177,26 @@
//! below:
//!
//! ```bash
//! subkey inspect --password extra_secret "soup lyrics media market way crouch elevator put moon useful question wide"
//! pez_subkey inspect --password extra_secret "soup lyrics media market way crouch elevator put moon useful question wide"
//! ```
//!
//! This time, we properly recovered `5He5pZpc7AJ8evPuab37vJF6KkFDqq9uDq2WXh877Qw6iaVC`.
//!
//! ### Inspecting a key
//!
//! If you have *some data* about a key, `subkey inspect` will help you discover more information
//! If you have *some data* about a key, `pez_subkey inspect` will help you discover more information
//! about it.
//!
//! If you have **secrets** that you would like to verify for instance, you can use:
//!
//! ```bash
//! subkey inspect < mnemonic | seed >
//! pez_subkey inspect < mnemonic | seed >
//! ```
//!
//! If you have only **public data**, you can see a subset of the information:
//!
//! ```bash
//! subkey inspect --public < pubkey | address >
//! pez_subkey inspect --public < pubkey | address >
//! ```
//!
//! **NOTE**: While you will be able to recover the secret seed from the mnemonic, the opposite is
@@ -208,7 +208,7 @@
//! command:
//!
//! ```bash
//! subkey inspect 0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c92d
//! pez_subkey inspect 0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c92d
//! ```
//!
//! output:
@@ -223,11 +223,11 @@
//!
//! ### Signing
//!
//! `subkey` allows using a **secret key** to sign a random message. The signature can then be
//! `pez_subkey` allows using a **secret key** to sign a random message. The signature can then be
//! verified by anyone using your **public key**:
//!
//! ```bash
//! echo -n <msg> | subkey sign --suri <seed|mnemonic>
//! echo -n <msg> | pez_subkey sign --suri <seed|mnemonic>
//! ```
//!
//! example:
@@ -235,7 +235,7 @@
//! ```text
//! MESSAGE=hello
//! SURI=0xa05c75731970cc7868a2fb7cb577353cd5b31f62dccced92c441acd8fee0c92d
//! echo -n $MESSAGE | subkey sign --suri $SURI
//! echo -n $MESSAGE | pez_subkey sign --suri $SURI
//! ```
//!
//! output:
@@ -249,12 +249,12 @@
//!
//! ### Verifying a signature
//!
//! Given a message, a signature and an address, `subkey` can verify whether the **message** has
//! Given a message, a signature and an address, `pez_subkey` can verify whether the **message** has
//! been digitally signed by the holder (or one of the holders) of the **private key** for the given
//! **address**:
//!
//! ```bash
//! echo -n <msg> | subkey verify <sig> <address>
//! echo -n <msg> | pez_subkey verify <sig> <address>
//! ```
//!
//! example:
@@ -263,7 +263,7 @@
//! MESSAGE=hello
//! URI=0xfec70cfbf1977c6965b5af10a4534a6a35d548eb14580594d0bc543286892515
//! SIGNATURE=9201af3788ad4f986b800853c79da47155f2e08fde2070d866be4c27ab060466fea0623dc2b51f4392f4c61f25381a62848dd66c5d8217fae3858e469ebd668c
//! echo -n $MESSAGE | subkey verify $SIGNATURE $URI
//! echo -n $MESSAGE | pez_subkey verify $SIGNATURE $URI
//! ```
//!
//! output:
@@ -286,7 +286,7 @@
//! command:
//!
//! ```bash
//! subkey vanity --network pezkuwi --pattern bob
//! pez_subkey vanity --network pezkuwi --pattern bob
//! ```
//!
//! output:
@@ -316,7 +316,7 @@ use pezsc_cli::{
#[derive(Debug, Parser)]
#[command(
name = "subkey",
name = "pez_subkey",
author = "Parity Team <admin@parity.io>",
about = "Utility for generating and restoring with Bizinikiwi keys",
version
@@ -345,7 +345,7 @@ pub enum Subkey {
Verify(VerifyCmd),
}
/// Run the subkey command, given the appropriate runtime.
/// Run the pez_subkey command, given the appropriate runtime.
pub fn run() -> Result<(), Error> {
match Subkey::parse() {
Subkey::GenerateNodeKey(cmd) => cmd.run(),
@@ -16,8 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Subkey utility, based on kitchensink_runtime.
//! Subkey utility, based on pez_kitchensink_runtime.
fn main() -> Result<(), pezsc_cli::Error> {
subkey::run()
pez_subkey::run()
}