Skip to content

Commit

Permalink
Review part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
deuszx committed Feb 20, 2025
1 parent 87507c2 commit d37befd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
* `create-application` — Create an application
* `publish-and-create` — Create an application, and publish the required bytecode
* `request-application` — Request an application from another chain, so it can be used on this one
* `keygen` — Create an unassigned key-pair
* `keygen` — Create an unassigned key pair
* `assign` — Link an owner with a key pair in the wallet to a chain that was created for that owner
* `retry-pending-block` — Retry a block we unsuccessfully tried to propose earlier
* `wallet` — Show the contents of the wallet
Expand Down Expand Up @@ -700,7 +700,7 @@ Request an application from another chain, so it can be used on this one

## `linera keygen`

Create an unassigned key-pair
Create an unassigned key pair

**Usage:** `linera keygen`

Expand Down
1 change: 0 additions & 1 deletion examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions linera-base/src/crypto/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@ pub struct Ed25519Signature(pub dalek::Signature);

impl Ed25519SecretKey {
#[cfg(all(with_getrandom, with_testing))]
/// Generates a new key-pair.
/// Generates a new key pair.
pub fn generate() -> Self {
let mut rng = rand::rngs::OsRng;
Self::generate_from(&mut rng)
}

#[cfg(with_getrandom)]
/// Generates a new key-pair from the given RNG. Use with care.
/// Generates a new key pair from the given RNG. Use with care.
pub fn generate_from<R: super::CryptoRng>(rng: &mut R) -> Self {
let keypair = dalek::SigningKey::generate(rng);
Ed25519SecretKey(keypair)
}

/// Obtains the public key of a key-pair.
/// Obtains the public key of a key pair.
pub fn public(&self) -> Ed25519PublicKey {
Ed25519PublicKey(self.0.verifying_key().to_bytes())
}

/// Copies the key-pair, **including the secret key**.
/// Copies the key pair, **including the secret key**.
///
/// The `Clone` and `Copy` traits are deliberately not implemented for `KeyPair` to prevent
/// accidental copies of secret keys.
Expand Down
8 changes: 4 additions & 4 deletions linera-base/src/crypto/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
use super::{BcsSignable, CryptoError, CryptoHash, HasTypeName};
use crate::doc_scalar;

/// Static Secp256k1 context for reuse.
/// Static secp256k1 context for reuse.
pub static SECP256K1: LazyLock<Secp256k1<All>> = LazyLock::new(secp256k1::Secp256k1::new);

/// A secp256k1 secret key.
Expand All @@ -23,7 +23,7 @@ pub struct Secp256k1SecretKey(pub secp256k1::SecretKey);
#[derive(Eq, PartialEq, Copy, Clone)]
pub struct Secp256k1PublicKey(pub secp256k1::PublicKey);

/// Secp256k1 public/private key pair.
/// Secp256k1 public/secret key pair.
#[derive(Debug, PartialEq, Eq)]
pub struct Secp256k1KeyPair {
/// Secret key.
Expand Down Expand Up @@ -108,14 +108,14 @@ impl fmt::Debug for Secp256k1PublicKey {
}

impl Secp256k1KeyPair {
/// Generates a new key-pair.
/// Generates a new key pair.
#[cfg(all(with_getrandom, with_testing))]
pub fn generate() -> Self {
let mut rng = rand::rngs::OsRng;
Self::generate_from(&mut rng)
}

/// Generates a new key-pair from the given RNG. Use with care.
/// Generates a new key pair from the given RNG. Use with care.
#[cfg(with_getrandom)]
pub fn generate_from<R: super::CryptoRng>(rng: &mut R) -> Self {
let (sk, pk) = SECP256K1.generate_keypair(rng);
Expand Down
2 changes: 1 addition & 1 deletion linera-client/src/client_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ pub enum ClientCommand {
requester_chain_id: Option<ChainId>,
},

/// Create an unassigned key-pair.
/// Create an unassigned key pair.
Keygen,

/// Link an owner with a key pair in the wallet to a chain that was created for that owner.
Expand Down

0 comments on commit d37befd

Please sign in to comment.