From d109faf5cdcfdb54a3a69ce8ccf602659648a539 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 21 Mar 2024 02:45:24 +0100 Subject: [PATCH] fix: add #main-key key id + endpoints placeholder --- src/activitystream/object/actor.rs | 5 +++-- src/model/user.rs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/activitystream/object/actor.rs b/src/activitystream/object/actor.rs index afd8c09e..293ee04e 100644 --- a/src/activitystream/object/actor.rs +++ b/src/activitystream/object/actor.rs @@ -71,7 +71,8 @@ impl ActorMut for serde_json::Value { setter! { public_key::publicKey -> node impl PublicKey } setter! { discoverable -> bool } - fn set_endpoints(self, _val: Option>) -> Self { - todo!() + fn set_endpoints(mut self, _val: Option>) -> Self { + self.as_object_mut().unwrap().insert("endpoints".to_string(), serde_json::Value::Object(serde_json::Map::default())); + self } } diff --git a/src/model/user.rs b/src/model/user.rs index 580a8c1d..706a5872 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -85,6 +85,7 @@ impl crate::activitystream::Base for Model { .set_followers(self.followers()) .set_public_key(self.public_key()) .set_discoverable(Some(true)) + .set_endpoints(None) // TODO dirty fix to put an empty object .underlying_json_object() } } @@ -153,6 +154,7 @@ impl crate::activitystream::object::actor::Actor for Model { fn public_key(&self) -> Node { Node::object( crate::activitystream::raw_object() + .set_id(Some(&format!("{}#main-key", self.id))) // TODO is this some standard?? .set_public_key_pem(&self.public_key) .set_owner(Some(&self.id)) )