package wireid import ( "encoding/base64" "encoding/hex" ) func ValidID(s string) bool { if len(s) != 43 { return false } b, e := base64.RawURLEncoding.Strict().DecodeString(s) return e == nil && len(b) == 32 && base64.RawURLEncoding.EncodeToString(b) == s } func ValidDigest(s string) bool { if len(s) != 64 { return false } b, e := hex.DecodeString(s) return e == nil && len(b) == 32 && hex.EncodeToString(b) == s }