Emurgo / message-signing

MIT License
26 stars 16 forks source link

Ed25519 returns 5 instead of 6 #9

Closed alessandrokonrad closed 2 years ago

alessandrokonrad commented 2 years ago

The CurveType enum returns 5 for Ed25519 as well as the the simplified builder::EdDSA25519Key class. This is my result:

{1: 1, 3: -8, -1: 5, -2: h'D058ED6FA27CA8FA454F1BAF2AAC58EDB774531DD2813E7BC91600D3CA8F0D4B'}

rooooooooob commented 2 years ago

@alessandrokonrad thanks for noticing this in the CIP-30 discussion. I just put up a fix for this #10 - it was me doing the same thing I thought might be happening in the JS code, but it was in the rust details of Ed25519Key.

I think the ideal solution for these enums would be if we could fix wasm_bindgen to allow arbitrary/negative enum values, but I originally wasn't sure how hard it would be to do that or how long it would take to get that merged/etc. It's possible that if rustwasm/wasm-bindgen#2631 ever gets done that it would resolve this too, depending how they implement that.