From 3a663cb56e823d2e02c33be6c0ea246c2eef10ff Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 15 Jul 2024 13:26:56 +0200 Subject: [PATCH] feat(apb): added also_known_as from DID-CORE --- apb/Cargo.toml | 1 + apb/src/types/object/actor.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/apb/Cargo.toml b/apb/Cargo.toml index fee5779..7ff9cbc 100644 --- a/apb/Cargo.toml +++ b/apb/Cargo.toml @@ -32,6 +32,7 @@ activitypub-fe = [] # https://ns.alemi.dev/as/fe/# ostatus = [] # https://ostatus.org# , but it redirects and 403??? just need this for conversation toot = [] # http://joinmastodon.org/ns# , mastodon is weird tho?? litepub = [] # incomplete, https://litepub.social/ +did-core = [] # incomplete, may be cool to support all of this: https://www.w3.org/TR/did-core/ # full jsonld utilities jsonld = [] # builtin utils diff --git a/apb/src/types/object/actor.rs b/apb/src/types/object/actor.rs index 4a697a6..8784429 100644 --- a/apb/src/types/object/actor.rs +++ b/apb/src/types/object/actor.rs @@ -39,6 +39,9 @@ pub trait Actor : Object { #[cfg(feature = "activitypub-miscellaneous-terms")] fn manually_approves_followers(&self) -> Field { Err(FieldErr("manuallyApprovesFollowers")) } + #[cfg(feature = "did-core")] + fn also_known_as(&self) -> Node { Node::Empty } + #[cfg(feature = "activitypub-fe")] fn following_me(&self) -> Field { Err(FieldErr("followingMe")) } #[cfg(feature = "activitypub-fe")] @@ -94,6 +97,9 @@ pub trait ActorMut : ObjectMut { #[cfg(feature = "activitypub-miscellaneous-terms")] fn set_manually_approves_followers(self, val: Option) -> Self; + #[cfg(feature = "did-core")] + fn set_also_known_as(self, val: Node) -> Self; + #[cfg(feature = "activitypub-fe")] fn set_following_me(self, val: Option) -> Self; #[cfg(feature = "activitypub-fe")] @@ -150,6 +156,9 @@ impl Actor for serde_json::Value { #[cfg(feature = "activitypub-miscellaneous-terms")] crate::getter! { manuallyApprovesFollowers -> bool } + #[cfg(feature = "did-core")] + crate::getter! { alsoKnownAs -> node Self::Actor } + #[cfg(feature = "activitypub-fe")] crate::getter! { followingMe -> bool } #[cfg(feature = "activitypub-fe")] @@ -201,6 +210,10 @@ impl ActorMut for serde_json::Value { #[cfg(feature = "activitypub-miscellaneous-terms")] crate::setter! { manuallyApprovesFollowers -> bool } + + #[cfg(feature = "did-core")] + crate::setter! { alsoKnownAs -> node Self::Actor } + #[cfg(feature = "activitypub-fe")] crate::setter! { followingMe -> bool } #[cfg(feature = "activitypub-fe")]