go-waku/waku/v2/utils/hex.go
Prem Chaitanya Prathi bc06867cc9
chore: utils tests (#661)
* chore: add tests for utils

* chore:delete unused code

* fix: ipv6 validation issue
2023-08-22 19:18:43 +05:30

14 lines
302 B
Go

package utils
import (
"encoding/hex"
"strings"
)
// DecodeHexString decodes input string into a hex string.
// Note that if the string is prefixed by 0x , it is trimmed
func DecodeHexString(input string) ([]byte, error) {
input = strings.TrimPrefix(input, "0x")
return hex.DecodeString(input)
}