validator

package
v0.17.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeletedObject

type DeletedObject struct{}

DeletedObject validates "delete" activities by trying to retrieve the original object.

func NewDeletedObject

func NewDeletedObject() DeletedObject

NewDeletedObject returns a fully initialized DeletedObject validator.

func (DeletedObject) Validate

func (v DeletedObject) Validate(request *http.Request, document *streams.Document) Result

Validate implements the Validator interface, which performs the actual validation.

type HTTPLookup

type HTTPLookup struct{}

HTTPLookup is a Validator that tries to retrieve the original document from the source server

func NewHTTPLookup

func NewHTTPLookup() HTTPLookup

func (HTTPLookup) Validate

func (v HTTPLookup) Validate(request *http.Request, document *streams.Document) Result

type HTTPSig

type HTTPSig struct{}

HTTPSig is a Validator that checks incoming HTTP requests using the HTTP signatures algorithm. https://docs.joinmastodon.org/spec/security/

func NewHTTPSig

func NewHTTPSig() HTTPSig

func (HTTPSig) Validate

func (validator HTTPSig) Validate(request *http.Request, document *streams.Document) Result

Validate uses the hannibal/sigs library to verify that the HTTP request is signed with a valid key.

type IdentityProof

type IdentityProof struct{}

IdentityProof implements FEP-c390 Identity Proofs https://codeberg.org/fediverse/fep/src/branch/main/fep/c390/fep-c390.md

func (IdentityProof) Validate

func (v IdentityProof) Validate(request *http.Request, document streams.Document) Result

type MatchActor added in v0.15.0

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

MatchActor is a Validator that verifies that the activity actor value matches an already authenticated Actor URL

func NewMatchActor added in v0.15.0

func NewMatchActor(actorID string) MatchActor

func (MatchActor) Validate added in v0.15.0

func (validator MatchActor) Validate(request *http.Request, activity *streams.Document) Result

Validate uses the hannibal/sigs library to verify that the HTTP request is signed with a valid key.

type None added in v0.15.0

type None struct{}

None is a Validator that always returns VALID because the request has already been validated in some external way. For example, the route may require a Cookie or API Key for access

func NewNone added in v0.15.0

func NewNone() None

func (None) Validate added in v0.15.0

func (validator None) Validate(request *http.Request, document *streams.Document) Result

Validate uses the hannibal/sigs library to verify that the HTTP request is signed with a valid key.

type Result

type Result string

Result indicates the outcome of a validation attempt

const ResultError Result = "ERROR"

ResultError indicates that the current Validator encountered an error while attempting to validate the HTTP request

const ResultInvalid Result = "INVALID"

ResultInvalid indicates that the current Validator can say with certainty that the HTTP request is invalid

const ResultUnknown Result = "UNKNOWN"

ResultUnknown indicates that the current Validator cannot say that the HTTP request is valid or invalid

const ResultValid Result = "VALID"

ResultValid indicates that the current Validator has successfully validated the HTTP request

Jump to

Keyboard shortcuts

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