zxp-sign-cmd
zxp-sign-cmd copied to clipboard
Rename "country" property to "coutryCode"
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.
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
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.
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.
Validation can be as simple as /^[a-zA-Z]{2}$/. Said that, error reporting is more important than validation.
+1 on error reporting.
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.