diff --git a/radicle-crdt/src/change.rs b/radicle-crdt/src/change.rs index 50301e82..44c01a1d 100644 --- a/radicle-crdt/src/change.rs +++ b/radicle-crdt/src/change.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; -use radicle_crypto::{PublicKey, Signature, Signer}; +use radicle_crypto::{PublicKey, Signer}; use serde::{Deserialize, Serialize}; use crate::clock; @@ -53,15 +53,6 @@ impl<'de, A: Deserialize<'de>> Change { } } -/// Change envelope. Carries signed changes. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Envelope { - /// Changes included in this envelope, serialized as JSON. - pub changes: Vec, - /// Signature over the change, by the change author. - pub signature: Signature, -} - /// An object that can be used to create and sign changes. #[derive(Default)] pub struct Actor { @@ -116,23 +107,4 @@ impl Actor { change } - - pub fn sign(&self, changes: impl IntoIterator>) -> Envelope { - let changes = changes.into_iter().collect::>(); - let json = serde_json::to_value(changes).unwrap(); - - let mut buffer = Vec::new(); - let mut serializer = serde_json::Serializer::with_formatter( - &mut buffer, - olpc_cjson::CanonicalFormatter::new(), - ); - json.serialize(&mut serializer).unwrap(); - - let signature = self.signer.sign(&buffer); - - Envelope { - changes: buffer, - signature, - } - } }