litepub

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Unlicense Imports: 17 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

litepub

Helpers to write ActivityPub etc integrations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSignature added in v1.1.0

func CheckSignature(r *http.Request) error

func FetchActivityPubURL added in v1.1.2

func FetchActivityPubURL(identifier string) (string, error)

func FetchFollowing added in v1.2.0

func FetchFollowing(url string) ([]string, error)

func GeneratePrivateKey added in v1.2.0

func GeneratePrivateKey(seed [4]byte) (*rsa.PrivateKey, error)

func HandleWebfingerRequest added in v1.1.1

func HandleWebfingerRequest(r *http.Request) (string, error)

func ParsePrivateKeyFromPEM added in v1.1.0

func ParsePrivateKeyFromPEM(pemString string) (*rsa.PrivateKey, error)

func ParsePublicKeyFromPEM added in v1.1.0

func ParsePublicKeyFromPEM(pemString string) (*rsa.PublicKey, error)

func PublicKeyToPEM added in v1.1.0

func PublicKeyToPEM(pk *rsa.PublicKey) (string, error)

func SendSigned added in v1.1.0

func SendSigned(
	privateKey *rsa.PrivateKey,
	publicKeyId string,
	target string,
	data interface{},
) (*http.Response, error)

Types

type Accept

type Accept struct {
	Base

	Object interface{} `json:"object"`
}

type Actor

type Actor struct {
	Base

	Name                      string     `json:"name"`
	PreferredUsername         string     `json:"preferredUsername"`
	ManuallyApprovesFollowers bool       `json:"manuallyApprovesFollowers"`
	Image                     ActorImage `json:"image,omitempty"`
	Icon                      ActorImage `json:"icon,omitempty"`
	Summary                   string     `json:"summary,omitempty"`
	URL                       string     `json:"url"`
	Inbox                     string     `json:"inbox"`
	Outbox                    string     `json:"outbox"`
	Followers                 string     `json:"followers"`
	Following                 string     `json:"following"`
	Published                 time.Time  `json:"published"`

	PublicKey PublicKey `json:"publicKey"`
}

func FetchActor added in v1.1.0

func FetchActor(url string) (*Actor, error)

func FetchActorFromIdentifier added in v1.2.0

func FetchActorFromIdentifier(theirId string) (*Actor, error)

type ActorImage

type ActorImage struct {
	Type string `json:"type,omitempty"`
	URL  string `json:"url,omitempty"`
}

type Base

type Base struct {
	Context DummyBaseContext `json:"@context"`
	Id      string           `json:"id"`
	Type    string           `json:"type"`
}

type Create

type Create[O any] struct {
	Base

	Actor  string `json:"actor"`
	Object O      `json:"object"`
}

func WrapCreate added in v1.1.0

func WrapCreate(note Note, createId string) (create Create[Note])

type DummyBaseContext added in v1.2.0

type DummyBaseContext struct{}

func (DummyBaseContext) MarshalJSON added in v1.2.0

func (c DummyBaseContext) MarshalJSON() ([]byte, error)

func (*DummyBaseContext) UnmarshalJSON added in v1.2.0

func (c *DummyBaseContext) UnmarshalJSON([]byte) error

type Follow

type Follow struct {
	Base

	Actor  string `json:"actor"`
	Object string `json:"object"`
}

type Note

type Note struct {
	Base

	Published    time.Time `json:"published"`
	AttributedTo string    `json:"attributedTo"`
	InReplyTo    string    `json:"InReplyToAtomUri"`
	Content      string    `json:"content"`
	To           []string  `json:"to"`
	CC           []string  `json:"cc"`
}

func FetchNote added in v1.2.0

func FetchNote(url string) (*Note, error)

func FetchNotes added in v1.2.0

func FetchNotes(url string) ([]Note, error)

type OrderedCollection

type OrderedCollection struct {
	Base

	TotalItems int             `json:"totalItems"`
	First      json.RawMessage `json:"first"`
}

type OrderedCollectionPage

type OrderedCollectionPage[I any] struct {
	Base

	TotalItems   int    `json:"totalItems"`
	PartOf       string `json:"partOf"`
	OrderedItems []I    `json:"orderedItems"`
	Next         string `json:"next"`
}

type PublicKey

type PublicKey struct {
	Id           string `json:"id"`
	Owner        string `json:"owner"`
	PublicKeyPEM string `json:"publicKeyPem"`
}
type WebfingerLink struct {
	Rel  string `json:"rel"`
	Type string `json:"type"`
	Href string `json:"href"`
}

type WebfingerResponse added in v1.1.1

type WebfingerResponse struct {
	Subject string          `json:"subject"`
	Links   []WebfingerLink `json:"links"`
}

Jump to

Keyboard shortcuts

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