-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Handle errors when resulting public or private key is invalid #120
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mrtenz
commented
Mar 2, 2023
Mrtenz
commented
Mar 2, 2023
Mrtenz
commented
Mar 2, 2023
Mrtenz
force-pushed
the
mrtenz/handle-derivation-errors
branch
from
March 7, 2023 10:00
2d5ee5d
to
5caa7e7
Compare
Mrtenz
commented
Mar 7, 2023
* Note that `ed25519` is not supported by BIP-32, so the `bip32` | ||
* specification is not available for this curve. | ||
*/ | ||
readonly specification: Specification; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As alternative to the specification
field, we could change the derivation paths to accept slip10:${index}
, but that requires some refactoring.
Mrtenz
force-pushed
the
mrtenz/handle-derivation-errors
branch
from
March 7, 2023 13:20
5caa7e7
to
1a39169
Compare
FrederikBolding
approved these changes
Mar 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This handles cases where the resulting public or private key after derivation is invalid (e.g., >= n, point at infinity, etc.). Previously we did not handle these situations at all. The chance of this happening is extremely low, but we need to handle it regardless to be compliant with BIP-32 and SLIP-10.
Unfortunately BIP-32 and SLIP-10 have a different way of handling this situation, so I had to refactor some code to make this possible:
SLIP10Node
class now accepts a "specification" field (bip32
orslip10
), which determines how to handle errors.bip32
forBIP44Node
.bip32
forsecp256k1
, andslip10
fored25519
.Related to MM-02-005.