Skip to content

Commit

Permalink
missing bits
Browse files Browse the repository at this point in the history
  • Loading branch information
pkhry committed Nov 6, 2024
1 parent 65fcb31 commit 75e6371
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
18 changes: 4 additions & 14 deletions signer/src/crypto/secret_uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.

use core::fmt::Display;

use super::DeriveJunction;
use alloc::{string::ToString, vec::Vec};
use regex::Regex;
use secrecy::SecretString;

use thiserror::Error as DeriveError;

// This code is taken from sp_core::crypto::DeriveJunction. The logic should be identical,
// though the code is tweaked a touch!

Expand Down Expand Up @@ -116,23 +116,13 @@ impl core::str::FromStr for SecretUri {
}

/// This is returned if `FromStr` cannot parse a string into a `SecretUri`.
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, DeriveError)]
pub enum SecretUriError {
/// Parsing the secret URI from a string failed; wrong format.
#[error("Invalid secret phrase format")]
InvalidFormat,
}

impl Display for SecretUriError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
SecretUriError::InvalidFormat => write!(f, "Invalid secret phrase format"),
}
}
}

#[cfg(feature = "std")]
impl std::error::Error for SecretUriError {}

once_static_cloned! {
/// Interpret a phrase like:
///
Expand Down
1 change: 0 additions & 1 deletion signer/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use crate::ecdsa;
use alloc::format;
use core::fmt::Formatter;
use core::str::FromStr;
use keccak_hash::keccak;
use secp256k1::Message;
Expand Down
10 changes: 0 additions & 10 deletions signer/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,3 @@ macro_rules! once_static_cloned {
)+
};
}

macro_rules! impl_from {
($module_path:path => $delegate_ty:ident :: $variant:ident) => {
impl From<$module_path> for $delegate_ty {
fn from(val: $module_path) -> Self {
$delegate_ty::$variant(val.into())
}
}
};
}

0 comments on commit 75e6371

Please sign in to comment.