0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 20:03:07 +02:00
Commit Graph

1099 Commits

Author SHA1 Message Date
Jordan Rose
2e7c36b915
Merge pull request #286 from cosmicexplorer/docs-1
Add docstrings for a few small modules!
2021-05-17 17:20:20 -07:00
Jordan Rose
1fd8da669b
Revert "Add registration IDs to the Sealed Sender v2 upload (encrypt) format" (#303) 2021-05-17 10:03:49 -07:00
Jordan Rose
45f717ab16
Merge pull request #302 from signalapp/jrose/SSv2-registration-ids
Add registration IDs to the Sealed Sender v2 upload (encrypt) format
2021-05-17 10:00:16 -07:00
Jordan Rose
b5cddf9dbb Add registration IDs to the Sealed Sender v2 upload (encrypt) format
Registration IDs are used to detect if a device ID has been reused,
since the new device will (with high probability) use a different
randomly-generated registration ID from the old one. The server should
be able to validate this for SSv2 like it does for SSv1, though the
handling of this for SSv1 is in the various apps.
2021-05-14 15:38:31 -07:00
Jordan Rose
89cb09db9d
Merge pull request #301 from signalapp/jrose/SenderKey-logging
Add some logging for SenderKey operations
2021-05-14 11:11:21 -07:00
Jordan Rose
1dbaf37bfa Add some logging for SenderKey operations
...similar to what we have for 1:1 session encrypt/decrypt. There's a
little less here because SenderKey sessions are one-sided and so they
can't get out of sync the same way.
2021-05-14 10:46:47 -07:00
Danny McClanahan
0dc88f725e
commit generated swift ffi 2021-05-13 01:06:50 -07:00
Jordan Rose
11d9c40cc1
Merge pull request #300 from signalapp/jrose/java-SenderKeyStore-doc-comment
Java: fix doc comment for SenderKeyStore.loadSenderKey
2021-05-11 15:56:44 -07:00
Jordan Rose
a9729bbf82 Java: fix doc comment for SenderKeyStore.loadSenderKey
The summary was out of sync with the `@return` command.
2021-05-11 14:46:16 -07:00
Jordan Rose
5ef78c0004
Merge pull request #293 from signalapp/jrose/SenderKey-message-versions
A SenderKeyMessage's version must match the SenderKeyState
2021-05-10 17:02:23 -07:00
Jordan Rose
440b42020c
Merge pull request #299 from signalapp/jrose/drop-neon-cli
signal-neon-futures: Remove neon-cli dependency from test module
2021-05-10 15:42:47 -07:00
Jordan Rose
6948918796 signal-neon-futures: Remove neon-cli dependency from test module
This came from the Node template generated by a past version of Neon,
but we don't need it and it brings in a bunch of extra dependencies.
2021-05-10 14:46:13 -07:00
Jordan Rose
1871473315
Merge pull request #282 from signalapp/jrose/node-DuplicatedMessageError
Node: Make a dedicated error code for DuplicatedMessage
2021-05-10 10:05:52 -07:00
Jordan Rose
b03aa27956
Merge pull request #292 from signalapp/jrose/java-hkdf-null-info
Java: allow a null info for HKDF (treated as empty)
2021-05-10 09:55:50 -07:00
Danny McClanahan
2893eb5682
Add docs for a few modules, nondestructively!
- Add module docs for the `libsignal_protocol` crate!
- Add docs to the `device-transfer` crate!
- Add docs to `address`!

beef up the docs for `address` because this is an important struct!

respond to review comments

revert module visibility changes

de-clutter the docstring for `.device_id()`

add missing docs warning

fix uuid deps

add doctest for `ProtocolAddress::new()`!

avoid pulling in uuid into dev-dependencies
2021-05-08 07:26:13 -07:00
Jordan Rose
4569e1ffaf SenderKey: Use the session version as the message version
We still encode the "current" version in the message version byte, but
the part that the receiver will check is now based on the session's
original message version rather than the "current" version in the
sender. (Note that these are the /same/ version right now, so this
change won't have any effect on the current wire format.)

This matches the behavior of SignalMessage and PreKeySignalMessage.
2021-05-07 18:24:44 -07:00
Jordan Rose
8af0ab17f2 Remove public constructors for *Message types
The parameters for these constructors cannot be chosen correctly in
isolation; messages always need to be created as part of a session.

The Node APIs have been renamed with leading underscores rather than
removed because we *did* have tests that explicitly constructed
messages just to test that they faithfully preserve information. In
this case the parameters are plausible values but not used for
anything.
2021-05-07 18:17:46 -07:00
Jordan Rose
f68ee1bc97 A SenderKeyMessage's version must match the SenderKeyState
...or it should fail to decrypt. This parallels a similar check for
SignalMessage and SessionState. Since we haven't been storing this
field previously, treat a default "0" value as if it were version 3,
the current version.

...but wait, why is version 3 the current version? Historical
accident: we were reusing the version values from SignalMessages,
which currently only support version 3. This isn't unreasonable since
the SenderKey cipher is based on the usual session cipher, but that's
not enough reason to tie the two version numbers together in the
future. Stop doing that here.
2021-05-07 18:17:46 -07:00
Jordan Rose
108a571e2e
Merge pull request #290 from signalapp/jrose/signal-neon-futures-limit-queues
signal-neon-futures: Only run Rust futures on an existing EventQueue
2021-05-07 11:51:36 -07:00
Jordan Rose
f962e387b7 Java: allow a null info for HKDF (treated as empty)
Restores compatibility with libsignal-protocol-java.
2021-05-07 10:47:34 -07:00
Jordan Rose
e1448a8e60 signal-neon-futures: Only run Rust futures on an existing EventQueue
Node can more efficiently handle multiple tasks coming in on the same
queue, so remove the "convenience" APIs that derive a new queue from a
Context, and require an existing EventQueue instead. This cuts more
time off of our decryption benchmark (not checked in).

Additionally, run the first poll for the future synchronously, to
avoid having to wait for the event loop to pick up the task to start
the future.
2021-05-05 17:45:53 -07:00
Jordan Rose
bbc1a9ac60
Merge pull request #278 from svmhdvn/master
rust/crypto: bump libc to support getauxval on musl
2021-05-04 11:22:55 -07:00
Siva Mahadevan
a97b1bd0ad rust/crypto: bump libc to support getauxval on musl 2021-05-02 13:29:41 -04:00
Jordan Rose
e60e62286c Node: Make a dedicated error code for DuplicatedMessage
This was MessageCounterError in libtextsecure; it's an "error" in that
it interrupts processing of an individual message, but that message
is then be discarded in practice.
2021-04-29 10:57:39 -07:00
Jordan Rose
87f205e80c
Merge pull request #281 from signalapp/jrose/0.5-code-size
Java: record native code size for 0.5.0 and 0.5.1
2021-04-29 10:27:46 -07:00
Jordan Rose
73a15db929 Java: record native code size for 0.5.0 and 0.5.1 2021-04-29 10:12:56 -07:00
Jordan Rose
b5f6d50b53 Bump version to 0.5.1 2021-04-28 17:05:25 -07:00
Jordan Rose
9f0fb751eb
Merge pull request #271 from signalapp/jrose/yarn-pack-github-actions
GitHub: add a workflow to publish a tag to NPM
2021-04-28 16:13:50 -07:00
Jordan Rose
c570d7fe00 GitHub: when publishing to NPM, allow custom tags (besides "latest") 2021-04-28 10:58:59 -07:00
Jordan Rose
8db505b4f7 GitHub: add a workflow to publish a tag to NPM
And remove the old copy_repo.sh used to generate
libsignal-client-node.
2021-04-28 10:50:27 -07:00
Jordan Rose
1ccc91ae81 Node: use prebuildify to handle package prebuilding 2021-04-28 10:50:27 -07:00
Jordan Rose
22d264b51a Node: Rename package to @signalapp/signal-client 2021-04-28 10:50:25 -07:00
Jordan Rose
f3cece493a PR testing: only verify that Native.d.ts is up to date once 2021-04-28 10:49:58 -07:00
Jordan Rose
81c30408bf Node: copy Native.d.ts to dist/ as part of TypeScript build
Uses the cpy-cli package for Windows compatibility.
2021-04-28 10:49:58 -07:00
Jordan Rose
c257efbccd
Merge pull request #280 from signalapp/jrose/process-prekey-logging
Log session state when we fail to process a pre-key
2021-04-28 09:54:03 -07:00
Jordan Rose
7966fb85e9 Log session state when we fail to process a pre-key
This joins the logging for when the session cipher fails; when pre-key
processing fails (especially with a "no such pre-key" error), we want
to see what state the session's in.
2021-04-27 17:40:58 -07:00
Jordan Rose
9c6f922197
Merge pull request #279 from whisperfish/make-error-sync
Make sure SignalProtocolError is Sync
2021-04-27 10:59:58 -07:00
Gabriel Féron
776cabf4eb Make sure SignalProtocolError is Sync 2021-04-27 15:55:48 +02:00
Jordan Rose
113e849d76 Bump version to 0.5.0 2021-04-21 19:07:56 -07:00
Jordan Rose
962046c5cc
Merge pull request #276 from signalapp/jrose/debian-docker
Java: switch to Debian for Docker builds instead of Ubuntu
2021-04-21 18:51:53 -07:00
Jordan Rose
5380131e7c Java: switch to Debian for Docker builds instead of Ubuntu
Debian has a more stable retention period for pinned dependencies (the
version of OpenJDK 8 we were using for Ubuntu is gone already!), and
it matches what the Signal-Android repository is doing.
2021-04-21 12:15:33 -07:00
Jordan Rose
0c254cc2b9
Merge pull request #274 from signalapp/jrose/android-libdl
Android: force-link libdl
2021-04-20 14:45:01 -07:00
Jordan Rose
571be02a31 Android: force-link libdl
For some reason, the Docker build of libsignal_jni.so doesn't link to
libdl, even though the build on my local machine does. This doesn't
seem to be a problem on most phones, presumably because the libdl
functions are re-exported through libc. However, on a small subset of
Android phones this is not good enough and libsignal_jni.so fails to
load. For now, work around this by forcing the Android
cross-compilation linker to link to libdl (instead of doing it "as
needed").
2021-04-19 19:06:11 -07:00
Jordan Rose
22ff571c62
Merge pull request #273 from signalapp/jrose/signal-neon-futures-bench
signal-neon-futures: Add a Node benchmark for a single round trip
2021-04-16 15:23:48 -07:00
Jordan Rose
e77584753a signal-neon-futures: Add a Node benchmark for a single round trip
It turns out this takes less than a millisecond, at least when the
event loop is empty, but the setup might still be useful in the
future. Run with `cargo bench -p signal-neon-futures`.
2021-04-16 15:14:22 -07:00
Jordan Rose
93267a06b9
Merge pull request #272 from signalapp/jrose/cocoapod-quote-path
[CocoaPod] Properly quote path to libsignal_ffi.a in build script
2021-04-14 12:35:57 -07:00
Jordan Rose
ae831d161c
Merge pull request #256 from signalapp/jrose/node-error-types
Bridge: add support for strongly-typed Node errors
2021-04-14 10:35:01 -07:00
Jordan Rose
48f3fcce1e [CocoaPod] Properly quote path to libsignal_ffi.a in build script
Also, if the library somehow isn't built when used as a non-local
CocoaPods dependency, don't suggest running swift/build_ffi.sh;
CocoaPods will have removed it already. Re-running `pod install` is
more likely to help, though in practice something's probably gone
wrong in the configuration.
2021-04-13 10:53:41 -07:00
Jordan Rose
9e74165f0d Bridge: add support for strongly-typed Node errors
Within a new 'Errors' module, we have a base class that indicates this
is a strongly-typed error, and an enum to identify what kind of error
it is and thus what extra properties it might have. TypeScript's type
narrowing support make this possible to do safely as long as all
instances of the base class do in fact have the extra properties that
match their code (and do not have an invalid code).

To expose this to Rust (via Neon):

- After loading the Rust library into Node, set an 'Errors' property
  with the relevant error types on the module object.

- Whenever a bridge_fn produces an error, pass it to a new
  SignalNodeError::throw API along with the 'this' object, which is
  assumed to have to be the object with the 'Errors' property.

This is a little less tidy than how we do Java exceptions, but it
comes from not having access to the error classes by some kind of
absolute name. Alternate approaches considered include:

- Use an initialized-once global. Downside: would not work if you ever
  had more than one Node engine live in a process, or quit and restarted
  it.

- Store the errors on the global object under some long, complicated
  key (like "org.signal.libsignal-client.Errors"). Downside: pollutes
  the global object.

- Generate the base class using Neon instead of writing it in
  TypeScript. Downsides: inconvenient, difficult to maintain, harder to
  use /from/ TypeScript.
2021-04-07 10:23:43 -07:00
Jordan Rose
5ef8ddc3be
Merge pull request #270 from signalapp/jrose/version-0.4.0
Bump version to v0.4.0 across all languages
2021-04-05 14:13:31 -07:00