Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@libp2p/crypto): improve unsupported key type message #2051

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Sep 14, 2023

When an unsupported key type is encountered, but the type is actually missing from the protobuf, don't default the key type in the thrown error to RSA because it's not an RSA key, doing so leads to confusing messages like:

invalid or unsupported key type RSA. Must be rsa / ed25519 / secp256k1

Instead say that the key type is unknown.

invalid or unsupported key type unknown. Must be rsa / ed25519 / secp256k1

When an unsupported key type is encountered, but the type is actually missing from the protobuf, don't default the key type in the thrown error to `RSA` because it's not an RSA key, doing so is leads to confusing messages like:

```
invalid or unsupported key type RSA. Must be rsa / ed25519 / secp256k1
```

Instead say that the key type is unknown.
@achingbrain achingbrain requested a review from a team as a code owner September 14, 2023 09:59
@achingbrain achingbrain merged commit d9159dd into master Sep 15, 2023
17 checks passed
@achingbrain achingbrain deleted the fix/unsupported-key-type-message branch September 15, 2023 16:07
maschad added a commit to maschad/js-libp2p that referenced this pull request Sep 27, 2023
When an unsupported key type is encountered, but the type is actually missing from the protobuf, don't default the key type in the thrown error to `RSA` because it's not an RSA key, doing so is leads to confusing messages like:

```
invalid or unsupported key type RSA. Must be rsa / ed25519 / secp256k1
```

Instead say that the key type is unknown.

Co-authored-by: Chad Nehemiah <chad.nehemiah94@gmail.com>
This was referenced Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants