简体   繁体   中英

How to validate an Ethereum address using Joi

A valid ethereum address is "0x" + 40 hex characters.

What would be the Joi definition to validate that ?

you have to use .extend method of joi for creating custom validation. you can have regex based checking in .extend method. reference https://github.com/hapijs/joi/blob/v14.0.1/API.md#extendextension

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM