soramitsu/iroha-helpers

domainPattern - validation/check.ts

Closed this issue · 1 comments

According to the docs the domainId should be validated against RFC1035, RFC1123.

But validation/check.ts validates against
/^[a-z_0-9]{1,9}$/

This is also not inline with Iroha master, field_validator.cpp which validates the domainId against

const RegexValidator kDomainValidator{
      "Domain",
      R"#(([a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*)#"
      R"#([a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)#"};

I suggest a relaxed regex within check.ts, like
/^([a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$/

What are your thoughts on this?

Hi! Fixed in #43
Version of iroha-helpers - 0.8.9