Documentation
¶
Overview ¶
Package validation provides input validation for ActivityPub objects and endpoints
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct {
Context interface{} `json:"@context,omitempty"`
ID string `json:"id,omitempty"`
Type string `json:"type"`
Actor string `json:"actor"`
Object interface{} `json:"object,omitempty"`
Target interface{} `json:"target,omitempty"`
Result interface{} `json:"result,omitempty"`
Origin interface{} `json:"origin,omitempty"`
Instrument interface{} `json:"instrument,omitempty"`
Published time.Time `json:"published,omitempty"`
Updated time.Time `json:"updated,omitempty"`
To []string `json:"to,omitempty"`
CC []string `json:"cc,omitempty"`
BTO []string `json:"bto,omitempty"`
BCC []string `json:"bcc,omitempty"`
}
Activity represents a basic ActivityPub Activity
type ActivityPubValidator ¶
type ActivityPubValidator struct {
// contains filtered or unexported fields
}
ActivityPubValidator handles validation of ActivityPub objects
func NewActivityPubValidator ¶
func NewActivityPubValidator(logger *zap.Logger) *ActivityPubValidator
NewActivityPubValidator creates a new ActivityPub validator
func (*ActivityPubValidator) ValidateActivity ¶
func (v *ActivityPubValidator) ValidateActivity(data []byte, config *Config) (*Activity, error)
ValidateActivity validates an ActivityPub activity
func (*ActivityPubValidator) ValidateInboxDelivery ¶
func (v *ActivityPubValidator) ValidateInboxDelivery(data []byte, signature string) (*Activity, error)
ValidateInboxDelivery validates an incoming ActivityPub delivery to an inbox
type Config ¶
type Config struct {
MaxObjectSize int // Maximum size of ActivityPub object in bytes
MaxStringLength int // Maximum length for string fields
MaxArrayLength int // Maximum length for arrays
AllowedTypes []string // Allowed ActivityPub types
RequiredFields []string // Required fields for validation
URLTimeout time.Duration // Timeout for URL validation
AllowLocalURLs bool // Whether to allow local/internal URLs
MaxDepth int // Maximum nesting depth for objects
AllowedIRI []string // Allowed IRI schemes (e.g., https, http)
}
Config defines validation rules
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns default validation configuration
Click to show internal directories.
Click to hide internal directories.