Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(identity): implement Copy for identity::secp256k1::KeyPair #3707

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions identity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.1.2 - unreleased

- Implement `Copy` for `identity::secp256k1::{Keypair,SecretKey,PublicKey}`.
See [PR 3707].

[PR 3707]: https://github.com/libp2p/rust-libp2p/pull/3707

## 0.1.1

- Add `From` impl for specific keypairs.
Expand Down
2 changes: 1 addition & 1 deletion identity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libp2p-identity"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
description = "Data structures and algorithms for identifying peers in libp2p."
rust-version = "1.60.0"
Expand Down
2 changes: 1 addition & 1 deletion identity/src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl Keypair {
#[cfg(all(feature = "rsa", not(target_arch = "wasm32")))]
Rsa(pair) => PublicKey::Rsa(pair.public()),
#[cfg(feature = "secp256k1")]
Secp256k1(pair) => PublicKey::Secp256k1(pair.public().clone()),
Secp256k1(pair) => PublicKey::Secp256k1(*pair.public()),
#[cfg(feature = "ecdsa")]
Ecdsa(pair) => PublicKey::Ecdsa(pair.public().clone()),
}
Expand Down
6 changes: 3 additions & 3 deletions identity/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use sha2::{Digest as ShaDigestTrait, Sha256};
use zeroize::Zeroize;

/// A Secp256k1 keypair.
#[derive(Clone)]
#[derive(Clone, Copy)]
pub struct Keypair {
secret: SecretKey,
public: PublicKey,
Expand Down Expand Up @@ -77,7 +77,7 @@ impl From<Keypair> for SecretKey {
}

/// A Secp256k1 secret key.
#[derive(Clone)]
#[derive(Clone, Copy)]
pub struct SecretKey(libsecp256k1::SecretKey);

impl fmt::Debug for SecretKey {
Expand Down Expand Up @@ -151,7 +151,7 @@ impl SecretKey {
}

/// A Secp256k1 public key.
#[derive(Eq, Clone)]
#[derive(Eq, Clone, Copy)]
pub struct PublicKey(libsecp256k1::PublicKey);

impl fmt::Debug for PublicKey {
Expand Down