From a93bfe67223977093f9aadc6aa28471133cfb288 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Sun, 7 Apr 2024 13:51:39 -0700 Subject: [PATCH] Remove signer --- xmtp_id/src/associations/builder.rs | 10 ++++---- xmtp_id/src/associations/mod.rs | 1 - xmtp_id/src/associations/signer.rs | 35 -------------------------- xmtp_id/src/associations/test_utils.rs | 33 ------------------------ 4 files changed, 5 insertions(+), 74 deletions(-) delete mode 100644 xmtp_id/src/associations/signer.rs diff --git a/xmtp_id/src/associations/builder.rs b/xmtp_id/src/associations/builder.rs index 72ff0c9cc..90d63a9b3 100644 --- a/xmtp_id/src/associations/builder.rs +++ b/xmtp_id/src/associations/builder.rs @@ -247,7 +247,7 @@ fn build_action( .get(&SignatureField::InitialAddress) .ok_or(SignatureRequestError::MissingSigner)?; let initial_address_signature = signatures - .get(&signer_identity) + .get(signer_identity) .cloned() .ok_or(SignatureRequestError::MissingSigner)?; @@ -268,12 +268,12 @@ fn build_action( .ok_or(SignatureRequestError::MissingSigner)?; let existing_member_signature = signatures - .get(&existing_member_signer_identity) + .get(existing_member_signer_identity) .cloned() .ok_or(SignatureRequestError::MissingSigner)?; let new_member_signature = signatures - .get(&new_member_signer_identity) + .get(new_member_signer_identity) .cloned() .ok_or(SignatureRequestError::MissingSigner)?; @@ -289,7 +289,7 @@ fn build_action( .get(&SignatureField::RecoveryAddress) .ok_or(SignatureRequestError::MissingSigner)?; let recovery_address_signature = signatures - .get(&signer_identity) + .get(signer_identity) .cloned() .ok_or(SignatureRequestError::MissingSigner)?; @@ -305,7 +305,7 @@ fn build_action( .ok_or(SignatureRequestError::MissingSigner)?; let recovery_address_signature = signatures - .get(&signer_identity) + .get(signer_identity) .cloned() .ok_or(SignatureRequestError::MissingSigner)?; diff --git a/xmtp_id/src/associations/mod.rs b/xmtp_id/src/associations/mod.rs index b1b0af985..2f2680761 100644 --- a/xmtp_id/src/associations/mod.rs +++ b/xmtp_id/src/associations/mod.rs @@ -3,7 +3,6 @@ pub mod builder; mod hashes; mod member; mod signature; -mod signer; mod state; #[cfg(test)] mod test_utils; diff --git a/xmtp_id/src/associations/signer.rs b/xmtp_id/src/associations/signer.rs deleted file mode 100644 index b606bc5fc..000000000 --- a/xmtp_id/src/associations/signer.rs +++ /dev/null @@ -1,35 +0,0 @@ -use thiserror::Error; - -use super::{MemberIdentifier, Signature, SignatureKind}; - -#[derive(Error, Debug)] -pub enum SignerError { - #[error("Signature error {0}")] - Generic(String), -} - -#[async_trait::async_trait] -pub trait Signer: SignerClone { - fn signer_identity(&self) -> MemberIdentifier; - fn signature_kind(&self) -> SignatureKind; - fn sign(&self, text: &str) -> Result, SignerError>; -} - -pub trait SignerClone { - fn clone_box(&self) -> Box; -} - -impl SignerClone for T -where - T: 'static + Signer + Clone, -{ - fn clone_box(&self) -> Box { - Box::new(self.clone()) - } -} - -impl Clone for Box { - fn clone(&self) -> Box { - self.clone_box() - } -} diff --git a/xmtp_id/src/associations/test_utils.rs b/xmtp_id/src/associations/test_utils.rs index d02490397..aa4018aa4 100644 --- a/xmtp_id/src/associations/test_utils.rs +++ b/xmtp_id/src/associations/test_utils.rs @@ -72,36 +72,3 @@ impl Signature for MockSignature { sig.as_bytes().to_vec() } } - -// #[derive(Clone)] -// pub struct MockSigner { -// identity: MemberIdentifier, -// signature_kind: SignatureKind, -// } - -// impl Signer for MockSigner { -// fn signature_kind(&self) -> SignatureKind { -// self.signature_kind.clone() -// } -// fn signer_identity(&self) -> MemberIdentifier { -// self.identity.clone() -// } - -// fn sign(&self, text: &str) -> Result, SignerError> { -// Ok(MockSignature::new_boxed( -// true, -// self.signer_identity(), -// self.signature_kind(), -// Some(text.to_string()), -// )) -// } -// } - -// impl MockSigner { -// pub fn new_boxed(identity: MemberIdentifier, signature_kind: SignatureKind) -> Box { -// Box::new(Self { -// identity, -// signature_kind, -// }) -// } -// }