etscrivner / rbsecp256k1

Compiled Ruby wrapper around libsecp256k1 for secp256k1 ECDSA.
The Unlicense
19 stars 13 forks source link

API design #81

Closed rickhull closed 3 months ago

rickhull commented 3 months ago

Hi,

I have some thoughts about the API design, based on my work here: https://github.com/rickhull/schnorr_sig

See particularly: https://github.com/rickhull/schnorr_sig/blob/master/lib/schnorr_sig/fast.rb

Bluntly, I'm not a fan of the KeyPair class, and skeptical of the Signature class. I have implemented Schnorr sigs with pure functions and zero classes, using binary strings as the fundamental format. The most salient example I'd ask you to consider: why does sign_schnorr() require a KeyPair, when the algo only requires the secret key? My guess is that this is following an established pattern, where maybe other forms of signing require the full keypair.

I'd love to pick your brain on this stuff, and not here -- more like discord or IRC. I am interested in C extensions, having done some tinkering, but I have very little understanding. Please come find me on the Ruby discord: https://discord.gg/ujxcNDuX / at-Rick