diff --git a/src/Validators/IdentityValidator.php b/src/Validators/IdentityValidator.php new file mode 100644 index 0000000..48ab476 --- /dev/null +++ b/src/Validators/IdentityValidator.php @@ -0,0 +1,31 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Validators; + +use Web3\Validators\IValidator; + +class IdentityValidator +{ + /** + * validate + * + * @param string $value + * @return bool + */ + public static function validate($value) + { + if (!is_string($value)) { + return false; + } + return (preg_match('/^0x[a-fA-F0-9]+$/', $value) >= 1); + } +} \ No newline at end of file