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

322 Commits

Author SHA1 Message Date
Jordan Rose
a9b0ac2729 CI: Test building for iOS devices 2024-07-23 14:12:51 -07:00
Jordan Rose
28b9bf0951 swift: Fix building tests for a device
This isn't something we do often, but sometimes it's useful to do,
usually from the Signal-iOS workspace, to see how the real device
behaves.
2024-07-23 14:12:51 -07:00
Jordan Rose
288c1ceee7 swift: Split ComparableBackup out to a separate simulator-only file 2024-07-23 14:12:51 -07:00
Alex Konradi
a6a8eae650
Fix expected canonical test case output 2024-07-16 15:40:43 -04:00
Alex Konradi
66cd3f0133
backup: bridge canonical serialization as ComparableBackup 2024-07-16 14:20:31 -04:00
Alex Konradi
6d3c1b057f
Add libsignal-bridge-testing for Swift
Use a similar strategy as for Node, but with an additional crate that serves as 
the target for running cbindgen. The expectation is that since iOS links with 
the native signal_ffi statically, the linker will be able to prune out the 
unsued test-only code.
2024-07-10 17:45:53 -04:00
moiseev-signal
f794998389
SVR3: implement migrate API 2024-07-10 11:40:56 -07:00
Alex Konradi
c6857dd58e
Don't assume EOF on 0-length read for Node
Remove the special handling code that detects EOF now that the upstream crate 
has fixed the bug that was being worked around. This also fixes a bug where EOF 
was being incorrectly detected when the provided buffer was empty. Add a test 
case to prevent regression in the future.
2024-07-09 11:58:43 -04:00
Jordan Rose
2feac3495b swift: Replace last use of NSLog with new logging protocol 2024-07-08 14:49:22 -07:00
Harry
72aae8c00f
Remove SignalCoreKit dependency in libsignal 2024-06-26 09:44:22 -07:00
Alex Konradi
5b4570625b
Split types out of libsignal-bridge crate
Separate `libsignal-bridge` into two crates:
- `libsignal-bridge-types`, which contains types and methods for bridging,
  declares conversion traits, and implements those traits
- `libsignal-bridge`, which defines `extern "C"` functions that get exported
  into the app-language libraries

This will allow creating a second test-only crate, parallel to
`libsignal-bridge`, that can use the same types and macros for exporting
functions.
2024-06-21 16:39:14 -04:00
Jordan Rose
86c07ee86a bridge: Remove SignalFfiError enum
Now there's a trait, FfiError, which handles conversion to a string
and numeric code, and a helper struct SignalFfiError that mostly just
wraps `Box<dyn FfiError>`. This makes it easier to add new errors --
they only need to be added in two places (a trait impl and possibly
new error codes) instead of three.
2024-06-13 16:00:00 -07:00
Jordan Rose
4e2a7de574 Expose the 'Stopped' event to Swift and Node
Swift: ChatListener.chatServiceConnectionWasInterrupted(_:)
Node: ChatServiceListener.onConnectionInterrupted()
2024-06-13 15:54:21 -07:00
Jordan Rose
e3a1eb522a swift: Split ChatListener out to its own file
And add some more doc comments.
2024-06-13 15:54:21 -07:00
Jordan Rose
af4821846e Add a --debug-level-logs option to build_ffi.sh
This allows enabling debug- and trace-level logs even in a release
build. (This also means the job of filtering *out* those logs has been
moved up to build_ffi.sh, where previously it was specified in the
leaf crate's Cargo.toml.)
2024-06-13 12:08:31 -07:00
moiseev-signal
38a5f01f6f
net: Short circuit MultiRouteConnectionManager on fatal errors 2024-06-06 18:06:59 -07:00
Jordan Rose
8313a2cfbd Remove app-layer tests that rely on connection timeouts
This was previously done for Node in 62f347e866, while the Java and
Swift tests *did* pass but...very...slowly. Make them all consistent.
2024-05-30 13:28:07 -07:00
Jordan Rose
6bbe62b157 swift: Use non-fallible String->Data conversion, per swiftlint 2024-05-30 12:31:26 -07:00
Alex Konradi
31d6015522
backups: add shared message backup test cases 2024-05-24 15:59:44 -04:00
Jordan Rose
9a8429da46 net: Add AppExpired and DeviceDeregistered errors for ChatService
And check bridging for every high-level ChatServiceError like we do
with CdsiLookupErrors.
2024-05-23 10:27:28 -07:00
Jordan Rose
422b6098ed swift: Fix format string used for logging in tests 2024-05-22 13:10:39 -07:00
Jordan Rose
de252fd84d swift: Remove reference to deleted Logging.m 2024-05-22 13:10:39 -07:00
Jordan Rose
0cea81bb66 swift: ChatService.didReceiveIncomingMessage's sendAck is @escaping
...since acks of incoming messages are asynchronous (they don't happen
until the message is either fully processed or saved durably).
2024-05-22 13:10:39 -07:00
Jordan Rose
878d3d4332 bridge: Move Chat-related items into a submodule 2024-05-21 16:28:22 -07:00
Jordan Rose
a5fa231a1c bridge: Expose ChatService_InjectRawServerRequest for testing 2024-05-21 13:04:18 -07:00
Jordan Rose
a513d61a09 bridge: Expose ChatListener to Swift
(and lay groundwork for the other bridges)
2024-05-21 13:04:18 -07:00
moiseev-signal
70ba17491c
SVR3: Implement remove API 2024-05-21 10:33:33 -07:00
moiseev-signal
c55aa17a9f
SVR3: Propagate tries_remaining on restore failure 2024-05-20 15:49:59 -07:00
Jordan Rose
e1aa542bd5 ffi: Expose LibsignalLogger protocol rather than depending on DDLog
This drops the SignalCoreKit dependency for the CocoaPod, but does
mean clients will have to register their own logger explicitly.
2024-05-20 13:43:39 -07:00
moiseev-signal
bc5875b225
SVR3: Propagate tries_remaining upon successful restore 2024-05-20 08:54:46 -07:00
Jordan Rose
7dc63b99af ffi: Expose cancellation to Swift 2024-05-17 11:30:24 -07:00
Jordan Rose
6d3c192208 ffi: Wrap promise callbacks and contexts in a struct
...and pass that struct by reference.

This has some benefits and some drawbacks:

+ Type inference is (usually) more reliable; invokeAsyncFunction no
  longer needs a "returning:" parameter for disambiguation.

+ We can add more fields to the promise structs as needed.

+ We can use the same argument for input and output.

- Before, every promise that produced an OpaquePointer could share one
  protocol implementation on the Swift side. Now, they're separate.

- The manual type erasure code in the implementation of Completer has
  gotten worse.

- Using the same argument for input and output may be confusing.
2024-05-17 11:30:24 -07:00
Jordan Rose
99e337f552 bridge: Expose authenticated sends on ChatService 2024-05-15 15:48:47 -07:00
Jordan Rose
23894b2904 build_ffi.sh: Only set OPENSSL_SMALL when compiling for iOS
This interferes with ring, but on iOS we don't need ring, so we can
get away without setting it.
2024-05-15 11:14:34 -07:00
Jordan Rose
a2c271a8a0 build_ffi: Update error message for a missing cbindgen
- We moved passed cbindgen 0.16 a long time ago, oops
- It's always more reliable to build helper tools with stable
2024-05-14 16:54:09 -07:00
Jordan Rose
a09eb567f0 net: "Poison" the TCP connector if an invalid proxy is set
This ensures that if there's an error setting a proxy, the previous
settings won't continue to be used for new connections.

This only applies to the Java, Swift, and TypeScript layers; the Rust
layer's set_proxy isn't a fallible API in the first place today. The
Java API now explicitly throws a checked IOException instead of
IllegalArgumentException.
2024-05-08 16:18:03 -07:00
Jordan Rose
2b0e1e5538
bridge: Add cancellation to AsyncRuntime and TokioAsyncContext 2024-05-03 10:03:59 -07:00
Sergey Skrobotov
ab733bf00a libsignal-net: support for User-Agent header 2024-05-01 20:02:08 -07:00
Jordan Rose
cc12c6f3c8 Make ServiceId Ord/Comparable
ACIs are sorted before PNIs, then the UUIDs are sorted by their
(unsigned) bytes. This provides a total order, if a relatively
arbitrary one.
2024-05-01 10:34:21 -07:00
Alex Konradi
1fe47ce209
swift: let message backup stream factory fn throw (#713) 2024-04-30 15:24:23 -04:00
Jordan Rose
4854611b30 swift: Add an integration test for connecting via proxy
...along with a baseline test for connecting directly. This is only
enabled when LIBSIGNAL_TESTING_SIGNAL_PROXY is set in the environment.
2024-04-24 13:14:05 -07:00
Jordan Rose
01a8c350e8 swift: Use thin LTO even in debug builds
Some ring symbols aren't making it into libsignal_ffi.a otherwise. Not
totally sure why, but this makes the debug build more like the release
build anyway. It does slow down the build a bit, though, sorry.
2024-04-24 13:14:05 -07:00
Jordan Rose
23c0c6c200 swift: C functions with no arguments are declared '(void)', not '()'
C23 will make '()' allowed too, but until then...
2024-04-22 17:28:43 -07:00
Jordan Rose
9f53f3d1e7 BackupAuthCredential: verify the redemption time on receive
This is passed both within the credential response and outside it, so
it's important to make sure the two times match.
2024-04-19 13:41:59 -07:00
ravi-signal
9204831745
Use an enum for BackupAuthCredential's level 2024-04-19 11:46:49 -07:00
Jordan Rose
3d2471cc8b Make LIBSIGNAL_TESTING_ env vars available to Android and iOS tests
And adjust the existing ENCLAVE_SECRET tests and examples to use this
(including Rust and Node's).

This also requires adding an AndroidManifest.xml that notes the tests
might use the network.
2024-04-17 16:06:46 -07:00
Jordan Rose
bbeb0bb85e swift: Remove redundant explicit local variable type, per swiftformat 2024-04-16 15:22:51 -07:00
Sergey Skrobotov
3864f33b4d libsignal-net: dropping DebugInfo.connectionReused field 2024-04-16 10:20:00 -07:00
Alex Konradi
6114bb7962
Use the first bytes of a backup as the AES IV
Treat the first 16 bytes of the stream as the IV for the AES block cipher. This 
is incompatible with the previous scheme, where the IV was derived from the 
master key.
2024-04-15 16:37:46 -04:00
Alex Konradi
f72f33d3ee
Remove code that handles auth cred with ACI as PNI
These functions are unused in client and server code.
2024-04-11 17:08:18 -04:00