Add validation to `CanonicalIdentifier`
Add validation to `CanonicalIdentifier`

This allows to shorten the validation code in classes that use a
canonical identifier.

hackaugusto/raiden,hackaugusto/raiden