Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added error messages for call #42

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 36 additions & 8 deletions crates/provider/src/layers/seismic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,21 @@ where
&& builder.input().is_some()
&& builder.nonce().is_some()
{
let tee_pubkey =
PublicKey::from_slice(self.inner.get_tee_pubkey().await.unwrap().as_slice())
.unwrap();
let tee_pubkey = PublicKey::from_slice(
self.inner
.get_tee_pubkey()
.await
.map_err(|e| {
TransportErrorKind::custom_str(&format!(
"Error getting tee pubkey from server: {:?}",
e
))
})?
.as_slice(),
)
.map_err(|e| {
TransportErrorKind::custom_str(&format!("Error decoding tee pubkey: {:?}", e))
})?;
let encryption_keypair = self.get_encryption_keypair();

// Generate new public/private keypair for this transaction
Expand All @@ -214,7 +226,9 @@ where
plaintext_input.to_vec(),
builder.nonce().unwrap(),
)
.unwrap();
.map_err(|e| {
TransportErrorKind::custom_str(&format!("Error encrypting input: {:?}", e))
})?;
builder.set_input(Bytes::from(encrypted_input));

// decrypting output
Expand Down Expand Up @@ -253,9 +267,21 @@ where
&& builder.input().is_some()
&& builder.nonce().is_some()
{
let tee_pubkey =
PublicKey::from_slice(self.inner.get_tee_pubkey().await.unwrap().as_slice())
.unwrap();
let tee_pubkey = PublicKey::from_slice(
self.inner
.get_tee_pubkey()
.await
.map_err(|e| {
TransportErrorKind::custom_str(&format!(
"Error getting tee pubkey from server: {:?}",
e
))
})?
.as_slice(),
)
.map_err(|e| {
TransportErrorKind::custom_str(&format!("Error decoding tee pubkey: {:?}", e))
})?;
let encryption_keypair = self.get_encryption_keypair();

// Generate new public/private keypair for this transaction
Expand All @@ -270,7 +296,9 @@ where
plaintext_input.to_vec(),
builder.nonce().unwrap(),
)
.unwrap();
.map_err(|e| {
TransportErrorKind::custom_str(&format!("Error encrypting input: {:?}", e))
})?;
builder.set_input(Bytes::from(encrypted_input));
}
}
Expand Down
Loading