diff --git a/src/api.rs b/src/api.rs index 5c8b79f..fc02c37 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1,7 +1,6 @@ use crate::{jws::Jws, query::FilterQuery}; use ceramic_event::{ - unvalidated::signed, Base64String, Base64UrlString, MultiBase32String, MultiBase36String, - StreamId, StreamIdType, + Base64String, Base64UrlString, MultiBase32String, MultiBase36String, StreamId, StreamIdType, }; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; @@ -39,7 +38,7 @@ pub struct BlockData { pub data: Option, /// Signature for block #[serde(skip_serializing_if = "Option::is_none")] - pub jws: Option, + pub jws: Option, /// IPFS Linked Block #[serde(skip_serializing_if = "Option::is_none")] pub linked_block: Option, diff --git a/src/lib.rs b/src/lib.rs index 6a07244..29cf02a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,9 +102,9 @@ impl CeramicHttpClient { .build(); let event = Event::from_payload(commit.into(), &self.signer)?; let controllers: Vec<_> = vec![controller]; + let jws = Jws::builder(&self.signer).build_for_cid(&event.payload_cid())?; let data = Base64String::from(event.encode_payload()?); let model = Base64String::from(PARENT_STREAM_ID.to_vec()); - let (envelope, _payload) = event.into_parts(); Ok(api::CreateRequest { r#type: StreamIdType::Model, @@ -115,7 +115,7 @@ impl CeramicHttpClient { model, }, linked_block: Some(data.clone()), - jws: Some(envelope), + jws: Some(jws), data: Some(data), cacao_block: None, }, @@ -215,7 +215,7 @@ impl CeramicHttpClient { let event = Event::from_payload(commit.into(), &self.signer)?; let controllers: Vec<_> = vec![controller]; let data = Base64String::from(event.encode_payload()?); - let (envelope, _payload) = event.into_parts(); + let jws = Jws::builder(&self.signer).build_for_cid(&event.payload_cid())?; Ok(api::CreateRequest { r#type: StreamIdType::ModelInstanceDocument, @@ -226,7 +226,7 @@ impl CeramicHttpClient { model, }, linked_block: Some(data.clone()), - jws: Some(envelope), + jws: Some(jws), data: Some(data), cacao_block: None, }, @@ -257,7 +257,7 @@ impl CeramicHttpClient { let controllers: Vec<_> = vec![controller]; let data = Base64String::from(event.encode_payload()?); let stream = MultiBase36String::try_from(&get.stream_id)?; - let (envelope, _payload) = event.into_parts(); + let jws = Jws::builder(&self.signer).build_for_cid(&event.payload_cid())?; Ok(api::UpdateRequest { r#type: StreamIdType::ModelInstanceDocument, block: api::BlockData { @@ -267,7 +267,7 @@ impl CeramicHttpClient { model, }, linked_block: Some(data.clone()), - jws: Some(envelope), + jws: Some(jws), data: Some(data), cacao_block: None, },