Skip to main content

Other Libraries

ActivityPub libraries for additional programming languages.

Elixir

ActivityPub (Pleroma/Akkoma)

The ActivityPub library used by Pleroma and Akkoma.

PropertyValue
Repositorygit.pleroma.social/pleroma/pleroma
Key Pathlib/pleroma/web/activity_pub/

Notable Patterns

defmodule Pleroma.Web.ActivityPub.ObjectValidator do
def validate(object, meta) do
with {:ok, object} <- validate_type(object),
{:ok, object} <- validate_actor(object),
{:ok, object} <- validate_content(object) do
{:ok, object, meta}
end
end
end

HTTPSignatures

defmodule Pleroma.Signature do
def sign(actor, headers) do
# Build signing string
# Sign with actor's private key
end

def validate(headers, public_key) do
# Verify HTTP Signature
end
end

C# / .NET

FediNet

ActivityPub library for .NET.

PropertyValue
Repositorygithub.com/rytmis/FediNet
NuGetFediNet
StatusExperimental

Example

using FediNet.ActivityStreams;

var note = new Note
{
Id = new Uri("https://example.com/notes/123"),
Content = "Hello from .NET!",
AttributedTo = new Uri("https://example.com/users/alice")
};

Java / Kotlin

jActivityPub

Java ActivityPub implementation.

PropertyValue
Repositorygithub.com/ibm-research/jActivityPub
StatusExperimental

Example

import org.w3c.activitystreams.*;

Note note = new Note.Builder()
.id("https://example.com/notes/123")
.content("Hello from Java!")
.attributedTo("https://example.com/users/alice")
.build();

Swift

ActivityPubSwift

Swift ActivityPub library.

PropertyValue
StatusVarious experimental projects

Example Pattern

struct Note: Codable {
let context = "https://www.w3.org/ns/activitystreams"
let type = "Note"
let id: URL
let content: String
let attributedTo: URL

enum CodingKeys: String, CodingKey {
case context = "@context"
case type, id, content, attributedTo
}
}

Haskell

No mature libraries, but reference implementations exist in various projects.

Pattern

data Activity = Activity
{ activityContext :: Text
, activityType :: Text
, activityActor :: URI
, activityObject :: Object
}

instance ToJSON Activity where
toJSON (Activity ctx typ actor obj) = object
[ "@context" .= ctx
, "type" .= typ
, "actor" .= actor
, "object" .= obj
]

Dart / Flutter

flutter_activitypub

Experimental Flutter client.

PropertyValue
StatusExperimental

Pattern

class Actor {
final String id;
final String type;
final String preferredUsername;
final String inbox;
final String outbox;

Actor({
required this.id,
required this.type,
required this.preferredUsername,
required this.inbox,
required this.outbox,
});

factory Actor.fromJson(Map<String, dynamic> json) {
return Actor(
id: json['id'],
type: json['type'],
preferredUsername: json['preferredUsername'],
inbox: json['inbox'],
outbox: json['outbox'],
);
}
}

Building Your Own

If no library exists for your language:

1. Start with Types

Define structures for:
- Actor (Person, Group, Service)
- Object (Note, Article, Image)
- Activity (Create, Follow, Like)
- Collection (OrderedCollection)

2. Implement HTTP Signatures

1. Build signing string from headers
2. Sign with RSA-SHA256
3. Format as Signature header

3. WebFinger

GET /.well-known/webfinger?resource=acct:{user}@{domain}
Return links to actor

4. Basic Endpoints

GET /users/{username}        → Actor
POST /users/{username}/inbox → Receive activities
GET /users/{username}/outbox → Published activities

Community Resources

See Also