Skip to content

Commit

Permalink
feature: add property names to signed data
Browse files Browse the repository at this point in the history
  • Loading branch information
jns-ps committed Jan 13, 2025
1 parent ac83dd2 commit 75cc40b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions crates/common/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ use crate::{
};

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct SignedData(pub VerifyingKey, #[serde(with = "raw_or_b64")] pub Vec<u8>);
pub struct SignedData {
pub key: VerifyingKey,
#[serde(with = "raw_or_b64")]
pub data: Vec<u8>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Default)]
/// Represents an account or service on prism, making up the values of our state
Expand Down Expand Up @@ -169,19 +173,19 @@ impl Account {
data,
data_signature,
} => {
self.signed_data.push(SignedData(
data_signature.verifying_key.clone(),
data.clone(),
));
self.signed_data.push(SignedData {
key: data_signature.verifying_key.clone(),
data: data.clone(),
});
}
Operation::SetData {
data,
data_signature,
} => {
self.signed_data = vec![SignedData(
data_signature.verifying_key.clone(),
data.clone(),
)];
self.signed_data = vec![SignedData {
key: data_signature.verifying_key.clone(),
data: data.clone(),
}];
}
Operation::CreateAccount { id, key, .. } => {
self.id = id.clone();
Expand Down

0 comments on commit 75cc40b

Please sign in to comment.