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 ¶
- Variables
- func IsValidAuditEventType(s string) bool
- func IsValidChainType(s string) bool
- func IsValidEthereumAddress(s string) bool
- func IsValidRuleSource(s string) bool
- func IsValidRuleType(s string) bool
- func IsValidSignerType(s string) bool
- func IsValidWeiDecimal(s string) bool
- func NormalizeRuleType(ruleType string) string
- func ValidateRuleMode(mode string) error
Constants ¶
This section is empty.
Variables ¶
var ValidAuditEventTypes = map[types.AuditEventType]bool{ types.AuditEventTypeAuthSuccess: true, types.AuditEventTypeAuthFailure: true, types.AuditEventTypeSignRequest: true, types.AuditEventTypeSignComplete: true, types.AuditEventTypeSignFailed: true, types.AuditEventTypeSignRejected: true, types.AuditEventTypeRuleMatched: true, types.AuditEventTypeApprovalRequest: true, types.AuditEventTypeApprovalGranted: true, types.AuditEventTypeApprovalDenied: true, types.AuditEventTypeRuleCreated: true, types.AuditEventTypeRuleUpdated: true, types.AuditEventTypeRuleDeleted: true, types.AuditEventTypeRateLimitHit: true, }
ValidAuditEventTypes is the set of allowed audit event_type values.
var ValidChainTypes = map[types.ChainType]bool{ types.ChainTypeEVM: true, types.ChainTypeSolana: true, types.ChainTypeCosmos: true, }
ValidChainTypes is the set of allowed chain type values.
var ValidRuleModes = map[types.RuleMode]bool{ types.RuleModeWhitelist: true, types.RuleModeBlocklist: true, }
ValidRuleModes is the set of allowed rule modes (whitelist, blocklist).
var ValidRuleSources = map[types.RuleSource]bool{ types.RuleSourceConfig: true, types.RuleSourceAPI: true, types.RuleSourceAutoGenerated: true, types.RuleSourceInstance: true, }
ValidRuleSources is the set of allowed rule source values.
var ValidRuleTypes = map[types.RuleType]bool{ types.RuleTypeSignerRestriction: true, types.RuleTypeChainRestriction: true, types.RuleTypeSignTypeRestriction: true, types.RuleTypeMessagePattern: true, types.RuleTypeEVMAddressList: true, types.RuleTypeEVMContractMethod: true, types.RuleTypeEVMValueLimit: true, types.RuleTypeEVMSolidityExpression: true, types.RuleTypeEVMJS: true, }
ValidRuleTypes is the set of allowed rule types.
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.
var ValidSignerTypes = map[types.SignerType]bool{ types.SignerTypePrivateKey: true, types.SignerTypeKeystore: true, types.SignerTypeHDWallet: true, }
ValidSignerTypes is the set of allowed signer type values.
Functions ¶
func IsValidAuditEventType ¶
IsValidAuditEventType returns true if s is a known audit event type.
func IsValidChainType ¶
IsValidChainType returns true if s is a known chain type.
func IsValidEthereumAddress ¶
IsValidEthereumAddress returns true if s is a valid 0x-prefixed 40-char hex address.
func IsValidRuleSource ¶
IsValidRuleSource returns true if s is a known rule source.
func IsValidRuleType ¶
IsValidRuleType returns true if s is a known rule type (after normalization).
func IsValidSignerType ¶
IsValidSignerType returns true if s is a known signer type.
func IsValidWeiDecimal ¶
IsValidWeiDecimal returns true if s is a non-empty string of decimal digits (e.g. max_value/wei).
func NormalizeRuleType ¶
NormalizeRuleType maps legacy or alias names to the canonical rule type.
func ValidateRuleMode ¶
ValidateRuleMode returns an error if mode is not whitelist or blocklist.
Types ¶
This section is empty.