5 releases

0.2.2 Jul 15, 2024
0.2.1 Jun 23, 2024
0.2.0 Jun 23, 2024
0.1.1 Apr 6, 2024
0.1.0 Apr 6, 2024

#1190 in Web programming

MIT license

75KB
1.5K 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–13MB
~151K SLoC