activitypub

package
v0.0.0-...-54d5358 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientKey = struct{}{}

ClientKey is the key used to store the ActivityPub client in the context.

Functions

func WithClient

func WithClient(ctx context.Context, c *Client) context.Context

WithClient returns a new context with the given ActivityPub client.

Types

type Client

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

Client is an ActivityPub client which can be used to fetch remote ActivityPub resources.

func FromContext

func FromContext(ctx context.Context) (*Client, bool)

FromContext returns the ActivityPub client from the given context.

func NewClient

func NewClient(signAs Signer) (*Client, error)

NewClient returns a new ActivityPub client.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, uri string, obj interface{}) error

Fetch fetches the ActivityPub resource at the given URL and decodes it into the given object.

func (*Client) Post

func (c *Client) Post(ctx context.Context, url string, obj map[string]any) error

Post posts the given ActivityPub object to the given URL.

type Signer

type Signer interface {
	PublicKeyID() string
	PrivKey() (*rsa.PrivateKey, error)
}

Signer represents an object that can sign HTTP requests.

Jump to

Keyboard shortcuts

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