Skip to content

Commit

Permalink
Rename some alias to match updated types
Browse files Browse the repository at this point in the history
  • Loading branch information
Alenar committed Aug 31, 2023
1 parent d7ab9f7 commit 8eea261
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions mithril-common/src/crypto_helper/cardano/cold_key.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ed25519_dalek::SigningKey as ColdKeypair;
use ed25519_dalek::SigningKey as ColdSecretKey;
use rand_chacha::ChaCha20Rng;
use rand_core::SeedableRng;

Expand All @@ -7,9 +7,9 @@ use rand_core::SeedableRng;
pub struct ColdKeyGenerator();

impl ColdKeyGenerator {
pub(crate) fn create_deterministic_keypair(seed: [u8; 32]) -> ColdKeypair {
pub(crate) fn create_deterministic_keypair(seed: [u8; 32]) -> ColdSecretKey {
let mut rng = ChaCha20Rng::from_seed(seed);
ColdKeypair::generate(&mut rng)
ColdSecretKey::generate(&mut rng)
}
}

Expand Down
17 changes: 10 additions & 7 deletions mithril-common/src/crypto_helper/cardano/opcert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use crate::crypto_helper::ProtocolPartyId;

use bech32::{self, ToBase32, Variant};
use blake2::{digest::consts::U28, Blake2b, Digest};
use ed25519_dalek::{Signature as EdSignature, Verifier, VerifyingKey as EdPublicKey};
use ed25519_dalek::{Signer, SigningKey as EdKeypair};
use ed25519_dalek::{
Signature as EdSignature, Signer, SigningKey as EdSecretKey, Verifier,
VerifyingKey as EdVerificationKey,
};
use kes_summed_ed25519::PublicKey as KesPublicKey;
use nom::AsBytes;
use serde::de::Error;
Expand All @@ -34,7 +36,7 @@ struct RawFields(

/// Raw Operational Certificate
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
struct RawOpCert(RawFields, EdPublicKey);
struct RawOpCert(RawFields, EdVerificationKey);

/// Parsed Operational Certificate
#[derive(Clone, Debug, PartialEq, Eq)]
Expand All @@ -44,7 +46,7 @@ pub struct OpCert {
/// KES period at which KES key is initalized
pub start_kes_period: u64,
pub(crate) cert_sig: EdSignature,
pub(crate) cold_vk: EdPublicKey,
pub(crate) cold_vk: EdVerificationKey,
}

impl SerDeShelleyFileFormat for OpCert {
Expand All @@ -58,14 +60,15 @@ impl OpCert {
kes_vk: KesPublicKey,
issue_number: u64,
start_kes_period: u64,
cold_keypair: EdKeypair,
cold_secret_key: EdSecretKey,
) -> Self {
let cold_vk: EdPublicKey = cold_keypair.verifying_key();
let cert_sig = cold_keypair.sign(&Self::compute_message_to_sign(
let cold_vk: EdVerificationKey = cold_secret_key.verifying_key();
let cert_sig = cold_secret_key.sign(&Self::compute_message_to_sign(
&kes_vk,
issue_number,
start_kes_period,
));

Self {
kes_vk,
issue_number,
Expand Down

0 comments on commit 8eea261

Please sign in to comment.