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

181 Commits

Author SHA1 Message Date
Jordan Rose
aaa481aa9a swift: Expose the reason a ChatService was disconnected 2024-09-17 10:03:34 -07:00
Jordan Rose
e1ac0f3db4 Replace uses of String.init(decoding:as:) as suggested by swiftlint 2024-09-13 13:13:26 -07:00
moiseev-signal
88c2ab1dcc
svr3: Bridge rotate API to mobile platforms 2024-09-13 09:59:56 -07:00
Jordan Rose
b67766d81e swift: Remove workaround in tests for building with an old Xcode 2024-08-30 09:04:53 -07:00
Jordan Rose
2f7f83d45b swift: PreKeyRecords lazily validate their keys
Convert the *Key and keyPair properties on *PreKeyRecord to throwing
methods.

Since the usual constructor is strongly typed, these should only throw
when the serialized data is corrupted. But that is a possibility.
2024-08-20 14:54:56 -07:00
Jordan Rose
524eb7cdb3 swift: Add ConnectionEventsListener for UnauthenticatedChatService
This follows Node in splitting out a base protocol for "disconnected"
events that the existing ChatListener protocol extends. It's a bit
more involved because of the helper class that keeps track of both the
listener and the ChatService, which can't be made generic because
Swift generics aren't monomorphized (and thus won't work as C function
pointers).

This is a breaking change in practice because the name of the callback
has changed (from chatServiceConnectionWasInterrupted to just
connectionWasInterrupted).
2024-08-09 11:23:49 -07:00
Sergey Skrobotov
4b283b7b4f
net: dropping reconnect count field 2024-08-07 19:11:43 -07:00
Jordan Rose
a561392cff
Expose the "network changed" event to apps 2024-07-30 15:27:42 -07:00
Sergey Skrobotov
d694cff1a1
net: adding a parameter to opt in/out of receiving stories 2024-07-25 14:55:23 -07:00
Jordan Rose
a3daa01b01 swift: Split ChatService into Authenticated and Unauthenticated
...following the similar split for Node.
2024-07-25 12:27:07 -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
4e2a7de574 Expose the 'Stopped' event to Swift and Node
Swift: ChatListener.chatServiceConnectionWasInterrupted(_:)
Node: ChatServiceListener.onConnectionInterrupted()
2024-06-13 15:54:21 -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
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
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
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
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
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
Jordan Rose
6b7c072fe2 swift: Fix PreKeyBundle accessors
getPreKeyId was returning an incorrect value, and the Kyber fields
were missing altogether. None of this affected security of the iOS app
because the iOS app only constructed PreKeyBundles for libsignal to
process, and never read any of these fields. If it did, it would have
failed to establish a session due to the incorrect pre-key ID.

Caught by @dtimoshenko99; thank you!
2024-04-09 16:04:59 -07:00
Alex Konradi
06c1780a14
Hold server zkparams as pointers 2024-04-09 16:13:22 -04:00
Jordan Rose
53ba4c28c4 Swift: Add missing error cases
And set up a script to catch them in the future.
2024-04-04 12:57:26 -07:00
Jordan Rose
96fce497db
Bridge unauthenticated connection to Swift
- Remove From<http::header::ToStrError> for ChatServiceError
- bridge: Response -> ChatResponse, DebugInfo -> ChatServiceDebugInfo
2024-04-01 09:24:46 -07:00
Alex Konradi
10a6d8b744
Remove enclave operation timeout arguments
The enclave interactions have internal progress monitoring in the form of 
websocket PING/PONG frames, so the timeout parameters aren't necessary for 
broken connection detection.
2024-03-29 18:13:40 -04:00
Alex Konradi
94432e2e32
Handle all CDSI server error codes
Match against all the error codes the documentation says the server can 
produce. Map these to error types in the app languages.
2024-03-26 16:41:12 -04:00
Alex Konradi
e87a1cba14
Handle "invalid token" response to CDSI request 2024-03-25 14:13:14 -04:00