Skip to content

Comments

fix(xtypes): handle empty strings for all key types#42

Merged
FranciscoKurpiel merged 1 commit intomasterfrom
fix/all-key-types-empty-string
Sep 20, 2025
Merged

fix(xtypes): handle empty strings for all key types#42
FranciscoKurpiel merged 1 commit intomasterfrom
fix/all-key-types-empty-string

Conversation

@FranciscoKurpiel
Copy link
Collaborator

This commit extends the ErrNoValue fix to all private and public key xtypes to ensure consistent behavior when handling empty string values.

The following xtypes were updated:

  • xtypes.ECDSAPrivateKey
  • xtypes.Ed25519PrivateKey
  • xtypes.ECDSAPubKey

For each of these types, the ValueValid function now returns types.ErrNoValue when it encounters an empty string, and the UnmarshalParam function has been updated to produce a nil key in this case.

This change makes the behavior of all key types consistent with the RSAPrivateKey implementation, correctly handling empty strings for both optional and required parameters.

Comprehensive test suites have been added for each of the affected xtypes (ecdsa_priv_test.go, ed25519_priv_test.go, ecdsa_pub_test.go) to verify this behavior and prevent future regressions. The tests cover valid keys, empty strings, default value fallbacks, and missing required values.

This commit extends the `ErrNoValue` fix to all private and public key
xtypes to ensure consistent behavior when handling empty string values.

The following xtypes were updated:
- `xtypes.ECDSAPrivateKey`
- `xtypes.Ed25519PrivateKey`
- `xtypes.ECDSAPubKey`

For each of these types, the `ValueValid` function now returns
`types.ErrNoValue` when it encounters an empty string, and the
`UnmarshalParam` function has been updated to produce a `nil` key in this
case.

This change makes the behavior of all key types consistent with the
`RSAPrivateKey` implementation, correctly handling empty strings for both
optional and required parameters.

Comprehensive test suites have been added for each of the affected xtypes
(`ecdsa_priv_test.go`, `ed25519_priv_test.go`, `ecdsa_pub_test.go`) to
verify this behavior and prevent future regressions. The tests cover valid
keys, empty strings, default value fallbacks, and missing required values.
@FranciscoKurpiel FranciscoKurpiel self-assigned this Sep 20, 2025
@FranciscoKurpiel FranciscoKurpiel added the bug Something isn't working label Sep 20, 2025
@gemini-code-assist

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

@FranciscoKurpiel FranciscoKurpiel merged commit 86f8da2 into master Sep 20, 2025
5 checks passed
@FranciscoKurpiel FranciscoKurpiel deleted the fix/all-key-types-empty-string branch September 20, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

1 participant