2

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

What would be the Joi definition to validate that ?

Kris Randall
  • 686
  • 1
  • 7
  • 12
  • 2
    If I've read the documentation you linked to correctly, my guess is `Joi.string().regex(/^0x[a-fA-F0-9]{40}$/)` – Bravo Oct 25 '18 at 04:22

1 Answers1

2

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

Parit
  • 98
  • 3