activitypub

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options ...ClientOption) streams.Client

New returns a fully initialized Client

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a "middleware" that tries to load an ActivityPub/ActivityStream document from the Interwebs.

If the server does not respond with an ActvityPub content-type then the request is forwarded to the inner client.

func (*Client) Delete

func (client *Client) Delete(id string) error

func (*Client) Load

func (client *Client) Load(id string, options ...any) (streams.Document, error)

func (*Client) Save

func (client *Client) Save(document streams.Document) error

func (*Client) SetRootClient

func (client *Client) SetRootClient(rootClient streams.Client)

type ClientOption

type ClientOption func(*Client)

func WithInnerClient added in v0.10.0

func WithInnerClient(innerClient streams.Client) ClientOption

WithInnerClient is an Option that sets the inner client for a Client. This allows the Client to forward requests to another client if it fails to load an ActivityPub document.

func WithKeyPairFunc

func WithKeyPairFunc(fn KeyPairFunc) ClientOption

WithKeyPairFunc is an Option that sets the ActorGetter for a Client. This allows the Client to retrieve the public key ID and private key for a given URL only when needed, rather than performing expensive database queries ahead of time.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

WithUserAgent is an Option that sets the User-Agent header for a Client. Applications SHOULD set a custom User-Agent header that identifies the application and provides a URL for more information.

type KeyPairFunc

type KeyPairFunc func() (publicKeyID string, privateKey crypto.PrivateKey)

Jump to

Keyboard shortcuts

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