validate

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package validate provides shared input validation for API, config, and chain layer. Use for request/query/body and config fields that are not rule-config specific. Rule config shape validation stays in internal/ruleconfig.

Index

Constants

This section is empty.

Variables

ValidAuditEventTypes is the set of allowed audit event_type values.

ValidChainTypes is the set of allowed chain type values.

ValidRuleModes is the set of allowed rule modes (whitelist, blocklist).

ValidRuleSources is the set of allowed rule source values.

ValidRuleTypes is the set of allowed rule types.

View Source
var ValidSignTypes = map[string]bool{
	"personal":    true,
	"typed_data":  true,
	"transaction": true,
	"hash":        true,
	"raw_message": true,
	"eip191":      true,
}

ValidSignTypes is the set of allowed sign_type values for requests and rule config.

ValidSignerTypes is the set of allowed signer type values.

Functions

func IsValidAuditEventType

func IsValidAuditEventType(s string) bool

IsValidAuditEventType returns true if s is a known audit event type.

func IsValidChainType

func IsValidChainType(s string) bool

IsValidChainType returns true if s is a known chain type.

func IsValidEthereumAddress

func IsValidEthereumAddress(s string) bool

IsValidEthereumAddress returns true if s is a valid 0x-prefixed 40-char hex address.

func IsValidRuleSource

func IsValidRuleSource(s string) bool

IsValidRuleSource returns true if s is a known rule source.

func IsValidRuleType

func IsValidRuleType(s string) bool

IsValidRuleType returns true if s is a known rule type (after normalization).

func IsValidSignerType

func IsValidSignerType(s string) bool

IsValidSignerType returns true if s is a known signer type.

func IsValidWeiDecimal

func IsValidWeiDecimal(s string) bool

IsValidWeiDecimal returns true if s is a non-empty string of decimal digits (e.g. max_value/wei).

func NormalizeRuleType

func NormalizeRuleType(ruleType string) string

NormalizeRuleType maps legacy or alias names to the canonical rule type.

func ValidateRuleMode

func ValidateRuleMode(mode string) error

ValidateRuleMode returns an error if mode is not whitelist or blocklist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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