nats-io / nats.net.v1

The official C# Client for NATS
Apache License 2.0
646 stars 154 forks source link

test and fix Nkeys.FromPublicKey #897

Closed Zetanova closed 3 months ago

Zetanova commented 3 months ago

The currently Nkeys.FromPublicKey method produces a NKeyPair with an invalid PublicKey of 56 bytes

scottf commented 3 months ago

Could you provide code or algorithm to reproduce this?

Zetanova commented 3 months ago

Use the included unit test. The utility function Nkeys.FromPublicKey will never produce a valid NKeyPair instance src/Tests/UnitTests/TestNkeys.cs

scottf commented 3 months ago

@Zetanova This looks good. Could you please add to the main comment a discussion of the primary change, i.e., what was wrong with the old code and why you put in the code that you did.