-
Notifications
You must be signed in to change notification settings - Fork 33
Fix: Remove redundant Ed25519 public key (#36). #54
Conversation
The private key already contains the public key point, no need to add it twice.
}) | ||
} | ||
t.Run("PrivateKey", func(t *testing.T) { | ||
for name, f := range map[string]func() ([]byte, error){ |
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.
I also wanted to add a stronger regression test by generating a key with the old code (redundant public key), marshalling it, keeping it hardcoded into the test and verifying that it can still be used.
Do you think it's worth it or is it overkill?
Fixed it and added tests. Nit: replaced fmt.Errorf by errors.New to avoid unnecessary fmt.Sprintf.
@Stebalien I'll let you assign this to whoever has time to review it (should be pretty quick though). |
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.
changing the external representation breaks the key hashing and changes peer IDs.
That's right. But I think that it's not an issue and doesn't impact backwards-compatibility. In The only difference will be when you generate a new key so it won't impact existing users. |
Oh, it's the private key format that's changing. The backwards incompatibility is with reading existing keys in that case. |
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.
LGTM
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.
We've had a go-ipfs release since the duplication was fixed so this should be good.
I don't have write access, I'll let you merge this when you feel it makes sense. |
The private key already contains the public key point, no need to add it twice.