litepub

package module
Version: v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: Unlicense Imports: 14 Imported by: 0

README

litepub

Helpers to write ActivityPub etc integrations.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CONTEXT = []string{
	"https://www.w3.org/ns/activitystreams",
	"https://w3id.org/security/v1",
	"https://pleroma.site/schemas/litepub-0.1.jsonld",
}

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 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"`

	PublicKey PublicKey `json:"publicKey"`
}

func FetchActor added in v1.1.0

func FetchActor(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 []string `json:"@context,omitempty"`
	Id      string   `json:"id"`
	Type    string   `json:"type"`
}

type Create

type Create struct {
	Base

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

func WrapCreate added in v1.1.0

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

type Follow

type Follow struct {
	Base

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

type Note

type Note struct {
	Base

	Published    string `json:"published"`
	AttributedTo string `json:"attributedTo"`
	Content      string `json:"content"`
	To           string `json:"to"`
}

type OrderedCollection

type OrderedCollection struct {
	Base

	TotalItems int                   `json:"totalItems"`
	First      OrderedCollectionPage `json:"first"`
}

type OrderedCollectionPage

type OrderedCollectionPage struct {
	Base

	TotalItems   int         `json:"totalItems"`
	PartOf       string      `json:"partOf"`
	OrderedItems interface{} `json:"orderedItems"`
}

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