bytesbay / web3-token

Web3 Token is a new way to authenticate users in a hybrid dApps using signed messages. Implementation of EIP-4361.
381 stars 51 forks source link

Use `new URL()` instead of regex in isUrl() #34

Closed Drarig29 closed 2 years ago

Drarig29 commented 2 years ago

https://github.com/bytesbay/web3-token/blob/d33a0b52e8d79014980045188bed0f1d47e49b17/src/lib/sign/sign.js#L9-L13

You have access to an API which is very well-written and useful, which will throw an error if a string is not a valid URL. I think you should use this instead of a random regex found on the web.