fix: add #main-key key id + endpoints placeholder

This commit is contained in:
əlemi 2024-03-21 02:45:24 +01:00
parent baa39aa81f
commit d109faf5cd
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 5 additions and 2 deletions

View file

@ -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<serde_json::Map<String, String>>) -> Self {
todo!()
fn set_endpoints(mut self, _val: Option<serde_json::Map<String, String>>) -> Self {
self.as_object_mut().unwrap().insert("endpoints".to_string(), serde_json::Value::Object(serde_json::Map::default()));
self
}
}

View file

@ -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<impl crate::activitystream::key::PublicKey> {
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))
)