Skip to content

Commit 645be97

Browse files
committed
Make keypair clonable
1 parent bfcbdc9 commit 645be97

File tree

9 files changed

+9
-2
lines changed

9 files changed

+9
-2
lines changed

src/ecc608/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::{
1616
static INIT: Once = Once::new();
1717
static ECC: Mutex<Option<Ecc>> = Mutex::new(None);
1818

19+
#[derive(Clone)]
1920
pub struct Keypair {
2021
pub network: Network,
2122
pub public_key: public_key::PublicKey,

src/ecc_compact/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub struct SharedSecret(pub(crate) p256::ecdh::SharedSecret);
1414
#[derive(Debug, PartialEq, Eq, Clone)]
1515
pub struct Signature(pub(crate) ecdsa::Signature);
1616

17+
#[derive(Clone)]
1718
pub struct Keypair {
1819
pub network: Network,
1920
pub public_key: public_key::PublicKey,

src/ed25519/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub struct PublicKey(pub(crate) ed25519_compact::PublicKey);
77
#[derive(Debug, PartialEq, Eq, Clone)]
88
pub struct Signature(ed25519_compact::Signature);
99

10+
#[derive(Clone)]
1011
pub struct Keypair {
1112
pub network: Network,
1213
pub public_key: public_key::PublicKey,

src/keypair.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub trait Sign {
1313
///
1414
/// This enum acts as a type-erased wrapper for all supported keypair types (e.g., Ed25519, Secp256k1, ECC Compact, etc.),
1515
/// allowing generic handling of key generation, signing, and public key extraction.
16-
#[derive(PartialEq, Debug)]
16+
#[derive(PartialEq, Debug, Clone)]
1717
pub enum Keypair {
1818
Secp256k1(secp256k1::Keypair),
1919
Ed25519(ed25519::Keypair),

src/nova_tz/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub enum Error {
2020
QseecomError(#[from] io::Error),
2121
}
2222

23+
#[derive(Clone)]
2324
pub struct Keypair {
2425
pub network: Network,
2526
pub public_key: public_key::PublicKey,

src/nova_tz/rsa_key.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::fs;
66
use std::path::Path;
77
use uuid::Uuid;
88

9+
#[derive(Clone)]
910
pub struct TzRsaKeyInfo {
1011
key_name: String,
1112
rsa_key: RSAPublicKey,

src/rsa/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub struct PublicKey(pub(crate) RSAPublicKey);
1313
#[derive(Debug, PartialEq, Eq, Clone)]
1414
pub struct Signature(pub(crate) Vec<u8>);
1515

16+
#[derive(Clone)]
1617
pub struct Keypair {
1718
pub network: Network,
1819
pub public_key: public_key::PublicKey,

src/secp256k1/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct PublicKey(k256::PublicKey);
1010
#[derive(Debug, PartialEq, Eq, Clone)]
1111
pub struct Signature(ecdsa::Signature);
1212

13+
#[derive(Clone)]
1314
pub struct Keypair {
1415
pub network: Network,
1516
pub public_key: public_key::PublicKey,

src/tpm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl From<tss_esapi::Error> for Error {
3232
}
3333
}
3434

35-
#[derive(PartialEq)]
35+
#[derive(PartialEq, Clone)]
3636
pub struct KeypairHandle {
3737
pub network: Network,
3838
pub public_key: public_key::PublicKey,

0 commit comments

Comments
 (0)