trust

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 59 Imported by: 0

Documentation

Overview

Package trust implements the trust API service.

Index

Constants

View Source
const ServiceName = "trust-api"

ServiceName is the canonical service identifier for the trust API.

Variables

This section is empty.

Functions

func FetchWithRedirects

func FetchWithRedirects(ctx context.Context, client *http.Client, start *url.URL, maxRedirects int, maxBytes int64) (*url.URL, []string, []byte, string, error)

FetchWithRedirects fetches a URL with redirect handling and a maximum body size.

func New

func New(opts ...apptheory.Option) *apptheory.App

New constructs the trust API app.

func NewPreviewHTTPClient

func NewPreviewHTTPClient(timeout time.Duration) *http.Client

NewPreviewHTTPClient constructs an HTTP client suitable for preview fetching.

func NormalizeLinkURL

func NormalizeLinkURL(raw string) (string, *url.URL, error)

NormalizeLinkURL normalizes a raw URL string and returns the normalized string and parsed URL.

func Register

func Register(app *apptheory.App, srv *Server) *apptheory.App

Register registers trust API routes and hooks with an app.

func ValidateOutboundURL

func ValidateOutboundURL(ctx context.Context, u *url.URL) error

ValidateOutboundURL validates a URL for safe outbound fetching.

Types

type LinkPreviewError

type LinkPreviewError = linkPreviewError

LinkPreviewError is a public alias for link preview errors.

type Server

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

Server implements the trust API.

func NewServer

func NewServer(cfg config.Config, st *store.Store) *Server

NewServer constructs a new trust Server.

func (*Server) InstanceAuthHook

func (s *Server) InstanceAuthHook(ctx *apptheory.Context) (string, error)

InstanceAuthHook authenticates instance requests using an instance API key bearer token.

func (*Server) RegisterRoutes

func (s *Server) RegisterRoutes(app *apptheory.App)

RegisterRoutes registers HTTP routes for the trust API.

Jump to

Keyboard shortcuts

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