common/identity/address.go

16 lines
318 B
Go
Raw Permalink Normal View History

2025-01-12 09:17:29 +01:00
package identity
import (
"regexp"
)
// Define the regex patterns as constants
const (
addressRegex = `^0x[a-fA-F0-9]{40}$`
)
// IsValidAddress checks if the given address is a valid Ethereum address
func IsValidAddress(address string) bool {
match, _ := regexp.MatchString(addressRegex, address)
return match
}