signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.55k stars 415 forks source link

bridge: Move as much out of the node_bridge_handle macro as possible #386

Closed jrose-signal closed 2 years ago

jrose-signal commented 2 years ago

Unlike the FFI and JNI bridges (#383 and #384), the argument handling for wrapped Rust values in Node can't be handled with a simple blanket trait impl. Add a set of new traits and helpers to capture most of the complexity so that the macro doesn't have anything too complicated in it:

All of the convert.rs files also need some reorganizing and the contents of this commit message should probably turn into a module-level doc comment once it settles.

jrose-signal commented 2 years ago

Updated with most of these suggestions, except changing the field names of BorrowedJsBoxedBridgeHandle. I'm still open to changing those as well but I don't think the suggested names are accurate.