Commit Graph

45 Commits

Author SHA1 Message Date
Jordan Rose
3103b37faf swift: Expose Net.connectProvisioning and ProvisioningConnection 2025-12-15 16:03:35 -08:00
Jordan Rose
5d1433cedd bridge: Add dedicated PossibleCaptiveNetwork error
This only applies to chat connections (including registration), and
for the time being is specifically looking for self-signed
certificates. Even though self-signed certificates can occur on any
network access, there should always be a chat connection early enough
in the app lifetime to identify the problem. (Other connections will
still log the error appropriately.)
2025-12-12 17:26:00 -08:00
Jordan Rose
f19815b938 swift: Add a low-level helper invokeFnReturningValueByPointer
...and use it to avoid having to name return types for bridge
functions, which return by out-parameter.
2025-10-14 11:22:22 -07:00
andrew-signal
2bc167b5a2 Add BuildVariant parsing/overload support to libsignal's Remote Config 2025-09-30 22:35:21 -04:00
Jordan Rose
1e7d61cf2d swift: Get our comments DocC-clean 2025-09-29 09:48:14 -07:00
Jordan Rose
b4cd040474 Add SvrB.remove(), use it for app-level integration tests 2025-08-13 12:35:52 -07:00
Jordan Rose
7c9bc53358 Bridge SVR-B to Swift
Co-authored-by: Andrew <andrew@signal.org>
2025-07-28 13:21:18 -07:00
Jordan Rose
0d48e043d1 chat: Use LanguageList all the way up to the bridge layer
And save a few bytes with no spaces after commas.
2025-07-09 11:15:01 -07:00
Jordan Rose
8070d6a4e6 Send Accept-Language when connecting a chat socket 2025-06-25 13:16:37 -07:00
Jordan Rose
9e13263581 Switch to swift-format for formatting instead of swiftformat
swift-format is owned by the Swift project and is generally less
opinionated than swiftformat (but better at formatting to a limited
line length).
2025-06-25 11:24:57 -07:00
moiseev-signal
70c342bb5d keytrans: Bridge to ffi 2025-05-27 17:03:39 -07:00
Alex Bakon
9bf0c894b0 Bridge RegistrationService.createSession to Swift 2025-05-06 11:21:51 -04:00
Jordan Rose
d58f237b4a net: Require TLS 1.3 for Signal-provided services and 1.2 for Cloudflare DoH
Co-authored-by: andrew-signal <andrew@signal.org>
2025-04-30 07:08:17 -05:00
Alex Bakon
5d7ce2d165 Remove app language code marked as deprecated 2025-04-09 15:41:35 -04:00
Jordan Rose
5563e4d277 net: Add "remote config" string-to-string map to Net/ConnectionManager
This can be set at creation time as well as updated later without
recreating the Net instance.
2025-04-03 15:16:35 -07:00
Alex Bakon
d13bc958e2 Remove fallback CDSI connect code 2025-04-02 13:39:38 -04:00
Jordan Rose
835611fc7b Expose preconnectChat() to Swift and Java
Also added a JUnit Rule for initializing the libsignal logger to
print to stderr.
2025-03-07 10:35:07 -08:00
Alex Bakon
efd6ef2424 Expose both CDSI connect methods 2025-02-19 14:19:56 -05:00
Alex Bakon
b34d84575f Remove chat service from bridge 2025-02-07 15:30:38 -05:00
Jordan Rose
bd9a11f943 bridge: Separate proxy validation from proxy setting
And expose an explicit setInvalidProxy, both for testing and in case
apps want to do their own connection-poisoning.

This makes it easier to be consistent about "if you try to set a proxy
that turns out not to be valid, the ConnectionManager should end up in
the invalid state until explicitly cleared", whether the validation is
done on the Rust side of the bridge or the app language side.
2025-02-03 14:09:56 -08:00
Jordan Rose
9f496569ff Node: use JavaScript's URL class to provide Net.setProxyFromUrl
Also improves tests around proxies for all three languages.
2025-01-31 13:24:24 -08:00
Jordan Rose
c1ad890487 Expose a more complete Net.setProxy(...) to apps
This takes a full set of components describing the connection to a
proxy: a scheme, a host, and optionally a port and auth information.
The previous `setProxy(String, u16)` signature is still available for
Signal TLS proxies in particular, but now we have the flexibility to
support other kinds of proxies as well.
2025-01-27 17:53:09 -08:00
Jordan Rose
527222cf1f Revert "Implement and expose Net.setProxyFromUrl()"
This adds more code size than expected.
2025-01-22 11:49:14 -08:00
Jordan Rose
7e1be4700d Implement and expose Net.setProxyFromUrl()
This takes a full URL (as a string) to use as a proxy. The previous
`setProxy(String, int)` signature is still available for Signal TLS
proxies in particular, but now we have the flexibility to support
other kinds of proxies as well.
2025-01-22 11:42:00 -08:00
Alex Konradi
33b8e9c3d8 Use strong pointer types for Swift bridge
Wrap the raw pointers exposed across the bridge as named types that approximate 
Swift's OpaquePointer?. Parameterize NativeHandleOwner with the native handle 
type.
2024-12-18 10:00:07 -05:00
moiseev-signal
cf98c1a054 Remove SVR3 bridge from all platforms 2024-12-12 17:11:26 -08:00
Alex Konradi
f5a4d7f013 Bridge new chat to Swift 2024-12-10 13:24:04 -05:00
Alex Konradi
0dd5a0242f Remove CDSI return_acis_without_uaks 2024-11-18 09:50:47 -05:00
Jordan Rose
7b75edeecd Add an API to ConnectionManager to enable/disable "connection fallbacks"
This will be off by default, unlike in previous releases of libsignal.
2024-11-05 13:45:52 -08:00
Jordan Rose
89ecb377d0 swift: Split CDS types out of Net.swift to keep files small 2024-11-01 17:01:36 -07:00
Jordan Rose
e2b453fb18 swift: Initial audit for Sendable
- All public Swift-defined structs except CdsiLookupResponse,
  which wraps LookupResponseEntryList, which can *probably* be made
  Sendable but I didn't spend time on it.

- All public Swift-defined enums except those being used purely as
  namespaces.

- All zkgroup types, since they are immutable and can be serialized
  and deserialized to send them anyway

- ServiceId and its subclasses, an immutable class hierarchy

- ProtocolAddress, PinHash, SenderCertificate and ServerCertificate,
  and all public and private Key types, immutable wrappers around
  immutable Rust objects

More of our wrapper types could be made Sendable as well if there's a
need to. See CODING_GUIDELINES for more info.
2024-10-23 13:10:16 -07:00
Alex Konradi
4e97b8f128 Fix Swift 6 compatibility issues 2024-09-24 15:57:25 -04: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
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
Alex Konradi
79bab1ce78 Expose TLS proxy in app libraries
Co-authored-by: Sergey Skrobotov <sergey@signal.org>
2024-04-02 16:22:18 -04: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
moiseev-signal
d7d2576ae6 SVR3: FFI bridge 2024-02-29 18:22:59 -08:00
moiseev-signal
58f43107ab Enforce Swift code formatting 2024-02-23 09:56:38 -08:00
Alex Konradi
5b5b85e715 Expose CDSI lookup via FFI 2024-02-22 10:31:01 -05:00