Skip to content

Commit

Permalink
use the remote service
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Nov 27, 2024
1 parent 7f068af commit 62ae77b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions bindings_node/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,13 @@ async fn is_member_of_association_state(
inbox_id: &str,
identifier: &MemberIdentifier,
) -> Result<bool> {
let client = TonicApiClient::create(host, true)
let api_client = TonicApiClient::create(host, true)
.await
.map_err(ErrorWrapper::from)?;
let client = ApiClientWrapper::new(Arc::new(api_client), Retry::default());
let api_client = ApiClientWrapper::new(Arc::new(api_client), Retry::default());

let is_member =
xmtp_mls::identity_updates::is_member_of_association_state(client, inbox_id, identifier)
xmtp_mls::identity_updates::is_member_of_association_state(api_client, inbox_id, identifier)
.await
.map_err(ErrorWrapper::from)?;

Expand Down
13 changes: 8 additions & 5 deletions xmtp_mls/src/identity_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ use xmtp_id::{
AssociationError, AssociationState, AssociationStateDiff, IdentityAction, IdentityUpdate,
InstallationKeyContext, MemberIdentifier, SignatureError,
},
scw_verifier::{MultiSmartContractSignatureVerifier, SmartContractSignatureVerifier},
scw_verifier::{
MultiSmartContractSignatureVerifier, RemoteSignatureVerifier,
SmartContractSignatureVerifier,
},
InboxIdRef,
};
use xmtp_proto::api_client::{
Expand Down Expand Up @@ -531,8 +534,9 @@ async fn verify_updates(
.await
}

/// A static lookup method to verify if an identity is a member of an inbox
pub async fn is_member_of_association_state<Client>(
client: ApiClientWrapper<Client>,
api_client: ApiClientWrapper<Client>,
inbox_id: &str,
identifier: &MemberIdentifier,
) -> Result<bool, ClientError>
Expand All @@ -543,7 +547,7 @@ where
inbox_id: inbox_id.to_string(),
sequence_id: None,
}];
let mut updates = client.get_identity_updates_v2(filters).await?;
let mut updates = api_client.get_identity_updates_v2(filters).await?;

let Some(updates) = updates.remove(inbox_id) else {
return Err(ClientError::Generic(
Expand All @@ -552,9 +556,8 @@ where
};
let updates: Vec<_> = updates.into_iter().map(|u| u.update).collect();

let scw_verifier = MultiSmartContractSignatureVerifier::new_from_env()?;

let mut association_state = None;
let scw_verifier = RemoteSignatureVerifier::new(api_client.api_client.clone());

for update in updates {
let update = update.to_verified(&scw_verifier).await?;
Expand Down

0 comments on commit 62ae77b

Please sign in to comment.