Commit Graph

20 Commits

Author SHA1 Message Date
Jordan Rose
6633761939 Drop the "-rust" from the "libsignal-protocol" crate
The project corresponds to libsignal-protocol-java and the others, but
/within/ the language we don't need to tag with the language name.
2021-02-04 10:26:36 -08:00
Jordan Rose
2083836594 Bridge: support &str returns to avoid unnecessary copies 2021-02-03 15:39:10 -08:00
Jordan Rose
478e178ac4 Add bridge_fn_void and use it for SessionRecord_ArchiveCurrentState
This also builds on the mutable borrow groundwork in the previous
commit.
2021-02-03 15:38:34 -08:00
Jack Lloyd
079c23b269 Add HKDF to Node via bridge 2021-02-03 17:26:11 -05:00
Jack Lloyd
7e22ee55ac The linter really likes white space 2021-02-02 17:14:56 -05:00
Jack Lloyd
13715b7ebf CamelCase arguments in libsignal_client.d.ts 2021-02-02 17:01:24 -05:00
Jordan Rose
1803d4fa4f Ignore bridge_fns that are unused in the current feature set 2021-02-01 18:33:48 -08:00
Jordan Rose
1187d3c1de Bridge: move simple object returns to bridge_get! as well 2021-02-01 18:33:48 -08:00
Jordan Rose
0543ecdde4 Node: bridge_fn shouldn't care about refs vs values at the macro level
Follow-up from the similar change for JNI. This should hopefully be
simpler going forward.
2021-01-27 16:27:04 -08:00
Jordan Rose
de9f7454c5 Node: Sort libsignal_client.d.ts
This groups related functions (but does little else for organization)
2021-01-26 15:48:13 -08:00
Jordan Rose
7210f6b86f Node: Autogenerate libsignal_client.d.ts like we do Native.java
This collects doc comments of the form "ts: <some TS declaration>",
which can be written manually *or* generated by the various "bridge"
macros. If the declaration looks like a function, it also does some
substitution of Rust types for TypeScript types, to make
autogeneration easier.
2021-01-26 15:48:13 -08:00
Jordan Rose
4a476eb52a Node: Add an entry point for logging 2021-01-26 10:53:53 -08:00
Jordan Rose
448923ff43 Use the linkme crate to avoid registering Node functions manually
This only works on functions using the macros in libsignal-bridge; for
anything else we'll keep using neon::ModuleContext::export_function
manually, at least for now.
2021-01-21 18:06:41 -08:00
Jordan Rose
64e45fd6bd Bridge: Add support for Node to bridge_fn
One problem: borrowing a JsBuffer requires the JS engine to be locked,
but returning a new buffer requires using the JS engine. That means
having to incur a copy-in (for &[u8] parameters) or a copy-out (for
&[u8] results) unless we make bridge_fn signatures more complicated.
For now I've gone with a copy-in because it was easier to implement.
2021-01-21 18:06:41 -08:00
Jordan Rose
810240a0f2 Bridge: add node_bridge_get_bytearray 2021-01-21 18:06:41 -08:00
Jordan Rose
d3c2b3c9d4 Begin adding Node support to libsignal-bridge with bridge_deserialize 2021-01-21 18:06:40 -08:00
Jack Lloyd
6688428ae5 Bump Neon to 0.7.0 and use feature napi-1
Neon by default requires N-API 6 and the version of Electron that is
used in Desktop only supports N-API 5. Without this feature, some
weird hacks are required to build on Windows.
2021-01-21 13:09:07 -05:00
Jack Lloyd
16dfd3acb0 Add PublicKey and PrivateKey operations to Node layer 2020-12-18 17:33:28 -05:00
Jordan Rose
9a21e7babc Node: Switch to Neon's napi-runtime and JsBox
We lose the ability to define classes in Rust, but we probably want to
be doing that in TypeScript anyway.
2020-12-04 10:44:58 -08:00
Jordan Rose
0f8dc2c0bd rust: Add Neon-based Node bridge 2020-11-10 11:00:54 -08:00