zxp-sign-cmd icon indicating copy to clipboard operation
zxp-sign-cmd copied to clipboard

Rename "country" property to "coutryCode"

Open rendertom opened this issue 6 years ago • 6 comments

It is not clear what "country" property under selfSignedCert operation expects. Name suggests it has to be a full name country (Lithuania, Estonia), however, it expects a 2 letter coutryCode. So to avoid further confusion it would be beneficial to rename this property to countryCode instead.

rendertom avatar Jan 06 '19 09:01 rendertom

After looking at the zxp sign cmd docs, they also label it as countryCode.

I'll consider this, but it'll be a breaking change. This will come with a zxp-sign-cmd 2.x.x release

codearoni avatar Jan 08 '19 03:01 codearoni

I don't think there is a need to update the variable name. countryCode is just as misleading as there are numeric and alpha-3 codes. But as pointed out the alpha-2 is needed. Said that, it would be good if this was more clearly communicated.

Firstly we can update the readme:

From:

Property Required Datatype Purpose
country yes String The country associated with the certificate

To:

Property Required Datatype Purpose
country yes String The country code associated with the certificate (ISO 3166-1 alpha-2 code)

And secondly, we should check the input on validity and display a nice error message when the user makes a mistake.

GitBruno avatar Jan 10 '19 06:01 GitBruno

Doc changes would help. I'm not comfortable doing validation in node.js-land. If the zxp binary accepts it, then so be it. This module is a wrapper.

codearoni avatar Jan 12 '19 05:01 codearoni

Validation can be as simple as /^[a-zA-Z]{2}$/. Said that, error reporting is more important than validation.

GitBruno avatar Jan 12 '19 07:01 GitBruno

+1 on error reporting.

rendertom avatar Jan 12 '19 17:01 rendertom

So looking at this in 2020 (time flies), changing the argument would potentially break the ~3 dozen modules using zxp-sign-cmd.

This will be setup as "countryCode" with a fallback to the existing "country" and a console warning for deprecation of the old argument key.

codearoni avatar Apr 06 '20 01:04 codearoni