2 releases

0.1.1 Apr 6, 2024
0.1.0 Apr 6, 2024

#2 in #activitypub

Download history 234/week @ 2024-04-05 14/week @ 2024-04-12 1/week @ 2024-04-19

249 downloads per month

MIT license

48KB
1K SLoC

apb

traits and types for implementing ActivityPub

apb implements all ActivityStreams types as traits, so that implementing structs don't need to hold all possible fields, but only implement getters for relevant ones

apb also provides a Node<T> enum, which can represent ActivityPub nodes (empty, link, object, array)

read more in this crate's docs

why

upub uses these types to implement its federation, but I wanted to modularize apb types

state

this crate is still work in progress and favors upub's needs, get in touch if you'd like to help or tune apb to your project!


lib.rs:

apb

traits and types for implementing ActivityPub

The main type this crate exposes is the [Node], which can be:

Nodes contain AP objects, which implement one or more traits (such as [Object] or [Actor])

features

  • unstructured: all traits are implemented for serde_json::Value, so that it's possible to manipulate free-form json maps as valid AP objects
  • orm: enum types are also database-friendly with sea-orm
  • fetch: [Node] exposes Node::fetch to dereference remote nodes

structure

*: Actor is technically just an object, not really a "subtype"

**: PublicKey is introduced in ActivityPub, it's not part of ActivityStream

Dependencies

~2–16MB
~172K SLoC