Skip to content

Commit

Permalink
Apply m_of_n_feature branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Jun 24, 2024
1 parent c8009c1 commit 006229c
Show file tree
Hide file tree
Showing 24 changed files with 1,725 additions and 62 deletions.
26 changes: 24 additions & 2 deletions applications/minotari_app_utilities/src/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ use tari_common::exit_codes::{ExitCode, ExitError};
use tari_common_types::{
emoji::EmojiId,
tari_address::TariAddress,
types::{BlockHash, PublicKey},
types::{BlockHash, PrivateKey, PublicKey, Signature},
};
use tari_comms::{peer_manager::NodeId, types::CommsPublicKey};
use tari_utilities::hex::Hex;
use tari_utilities::hex::{Hex, HexError};
use thiserror::Error;
use tokio::{runtime, runtime::Runtime};

Expand Down Expand Up @@ -140,6 +140,28 @@ impl TryFrom<UniNodeId> for PublicKey {
}
}

#[derive(Debug, Clone)]
pub struct UniSignature(Signature);

impl FromStr for UniSignature {
type Err = HexError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let data = s.split(',').collect::<Vec<_>>();
let signature = PrivateKey::from_hex(data[0])?;
let public_nonce = PublicKey::from_hex(data[1])?;

let signature = Signature::new(public_nonce, signature);
Ok(Self(signature))
}
}

impl From<UniSignature> for Signature {
fn from(id: UniSignature) -> Self {
id.0
}
}

impl From<UniNodeId> for NodeId {
fn from(id: UniNodeId) -> Self {
match id {
Expand Down
Loading

0 comments on commit 006229c

Please sign in to comment.