bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
92 stars 55 forks source link

Make the rust portion more modular #66

Open junderw opened 2 years ago

junderw commented 2 years ago

This splits up the rust portion into two crates:

  1. Main library (no_std is optional)
  2. WASM cdylib which uses 1

This will allow others to make use of the main library.

I would like to add doc examples and maybe doc-tests in the main library and then publish to crates.io... but we'll see. It looks like tiny-secp256k1 on crates.io is taken, but it is not being used. Maybe @maciejhirsz would like to give it to us? (Please?)

I also switched the release profile to opt-level "z" which gives a 66% reduction in binary size, but we get a 5~10% hit to performance.

junderw commented 2 years ago

Note: UnsafeCell use was because optimizer kept removing the export randomly for some reason. I had to implement a wrapper that impl Sync in order to export it.

I have Copy restriction because I made a method to get a copy of the slice... but I ended up not using it.

junderw commented 2 years ago

Also, I got the ownership of https://crates.io/crates/tiny-secp256k1