nbd-wtf / nostr-tools

Tools for developing Nostr clients.
The Unlicense
695 stars 193 forks source link

Use noble/secp256k1 instead of tiny-secp256k1 #8

Closed paulmillr closed 2 years ago

paulmillr commented 2 years ago

Seems like you're already using noble in package.json, so it doesn't make sense to use tiny - it's not tiny at all

fiatjaf commented 2 years ago

I was using noble until yesterday (literally), but I needed to do BIP32 key derivation and noble doesn't expose the required low-level curve math functions.

I thought about opening an issue on noble asking for them but I concluded it wasn't in the scope and would be rejected (even though I imagine it would be just adding a couple of export in front of functions that exist already).

paulmillr commented 2 years ago

I am the creator of noble libraries. What low-level api are you talking about? Pretty sure it's all is there.

paulmillr commented 2 years ago

For BIP32, you should use https://github.com/paulmillr/micro-bip32, which is going through the audit right now. The api is the same as hdkey module; micro-bip32 depends on noble and is minimal

fiatjaf commented 2 years ago

I am the creator of noble libraries. What low-level api are you talking about? Pretty sure it's all is there.

Add point, multiply scalar etc.

fiatjaf commented 2 years ago

For BIP32, you should use paulmillr/micro-bip32, which is going through the audit right now. The api is the same as hdkey module; micro-bip32 depends on noble and is minimal

Wow, I hadn't seen this one. And I did look for it. I'll switch right now. Thanks!

paulmillr commented 2 years ago

Add point, multiply scalar etc.

secp.Point has add() and multiply() methods. It had been exposed since day one.

fiatjaf commented 2 years ago

Transition complete. Thanks a lot!