hannibal

package module
v0.17.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 4

README

Hannibal

GoDoc Version Build Status Go Report Card Codecov

Triumphant ActivityPub for Go

Hannibal is an experimental ActivityPub library for Go. It's goal is to be a robust, idiomatic, and thoroughly documented ActivityPub implementation fits into your application without any magic or drama.

PLEASE USE.. *with caution

I would be honored for you to see if Hannibal works for your project. It is being used successfully in several production websites.

However, it is still subject to significant breaking changes. So, please reach out and I am happy to help you get things working in your own software. And, please be prepared for the ground to shift under your feet with newer versions.

Packages

Like the ActivityPub spec itself, Hannibal is broken into several layers:

pub - ActivityPub client/server

https://www.w3.org/TR/activitypub/

This is not an ActivityPub framework, but a simple library that easily plugs into your existing app. Add ActivityPub behaviors to your existing handlers, and send ActivityPub messages to

vocab - ActivityStreams Vocabulary

https://www.w3.org/TR/activitystreams-vocabulary/

The vocab package includes the standard ActivityStream vocabulary, including names of actions, objects and properties used in ActivityPub.

streams - ActivityStreams data structures

https://www.w3.org/TR/activitystreams-core/

The streams package contains common data structures defined in the ActivityStreams spec, notably definitions for: Document, Collection, OrderedCollection, CollectionPage, and OrderedCollectionPage. These are used by ActivityPub to send and receive multiple records in one HTTP request.

This package also includes a lightweight wrapper around generic data structures (like map[string]any and []any) that makes it easy to access data structures within an ActivityStreams/JSON-LD document.

sigs - HTTP Signatures and Digests

https://datatracker.ietf.org/doc/draft-ietf-httpbis-message-signatures

The sigs package creates and verifies HTTP signatures and Digests.

Pull Requests Welcome

This library is a work in progress, and will benefit from your experience reports, use cases, and contributions. If you have an idea for making this library better, send in a pull request. We're all in this together! 🐘

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsActivityPubContentType

func IsActivityPubContentType(contentType string) bool

IsActivityPubContentType returns TRUE if the provided contentType is a valid ActivityPub content type. https://www.w3.org/TR/activitystreams-core/#media-type

func IsActivityPubRequest added in v0.15.1

func IsActivityPubRequest(request *http.Request) bool

IsActivityPubRequest returns TRUE if the request's "Accept" header is an ActivityPub content type.

func IsUndoableActivity added in v0.13.1

func IsUndoableActivity(activityType string) bool

IsUndoableActivity returns TRUE if the provided activityType is one that can be undone (as opposed to an activity that must be "Deleted")

func NotActivityPubRequest added in v0.15.1

func NotActivityPubRequest(request *http.Request) bool

NotActivityPubRequest returns TRUE if the request's "Accept" header IS NOT an ActivityPub content type.

func TimeFormat

func TimeFormat(value time.Time) string

TimeFormat returns a string representation of the provided time value, using the format designated by the W3C spec: https://www.w3.org/TR/activitystreams-core/#dates

Types

This section is empty.

Directories

Path Synopsis
Package collection is an HTTP interface for GET-ing activities from an ActivityPub collection.
Package collection is an HTTP interface for GET-ing activities from an ActivityPub collection.
Package iterator provides utilities for iterating through remote collections (represented as streams.Documents)
Package iterator provides utilities for iterating through remote collections (represented as streams.Documents)
Package sender provides an object and queue consumer that can send outbound ActivityPub activities from an outbox to actor's inbox URLs.
Package sender provides an object and queue consumer that can send outbound ActivityPub activities from an outbox to actor's inbox URLs.
Package sigs implements the IETF draft specification "Signing HTTP Messages" https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures
Package sigs implements the IETF draft specification "Signing HTTP Messages" https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL