Closed musik-c closed 2 months ago
(👋 I'm happy to answer any questions if needed)
After investigation, it doesn't seem like there's anything for us to fix at this point. Our output file key content matches the files created by cardano-cli
, and we don't (yet) support decoding key files. The example code/tests have been copied to #81 where they will be helpful
it generates valid keys, but they just differ from how the cli would interpret things.
Here's the implementation that ended up working; from the skey bytes (5820xyz), we grab the juicy bits (strip off the 5820), and then pass that to ed25519.NewKeyFromSeed to get the actual payment key. This is what then works with the ed25519.Sign / ed25519.Verify method.
However in bursa, https://github.com/blinklabs-io/bursa/blob/main/bursa.go#L134-L144, it looks like you're just taking the key (not the seed), and serializing it. The fivebinaries bip32 library doesn't actually have code that can correctly handle non-extended keys that could be found, resulting in having to mix the bip32 and ed25519 go libraries
Here's the code that produces results consistent with cardano-cli for both extended and non-extended keys:
And here's the unit tests written to track this down: