Commit Graph

86 Commits

Author SHA1 Message Date
Jamie
8bfbd12323 Update all Uint8Array/Buffer to use ArrayBuffer
Co-authored-by: Jordan Rose <jrose@signal.org>
2026-03-16 18:55:17 -07:00
Jordan Rose
d6b61b46d2 Add "useH2ForUnauthChat" remote config
When set, and when not using a transparent proxy, unauth chat
connections will be made over H2 instead of HTTP/1.1. Auth connections
will not be affected.
2026-01-14 13:50:53 -08:00
Jordan Rose
5b4fc4850b NetTest.ts: clean up arg expectation tests a bit 2025-12-16 17:46:28 -08:00
Jordan Rose
55123ec3f3 node: Add ProvisioningConnection and Net.connectProvisioning 2025-12-15 12:52:47 -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
moiseev-signal
78b0abf1e1 node: Implement a more friendly FakeChatRemote abstraction for tests 2025-10-20 14:23:09 -07:00
Jordan Rose
85686caa01 node: Combine Native.js and .d.ts into Native.ts
This allows the file to be checked by tsc, which would have caught
some of the missing type aliases sooner (now added to Native.ts.in).
Strictly speaking the behavior is slightly different: we have returned
to exporting many items individually instead of collecting them on a
single object.

Co-authored-by: Alex Bakon <akonradi@signal.org>
2025-10-15 17:50:37 -07:00
Jordan Rose
388e294acf bridge: Eliminate FakeChatSentRequest in favor of pairs 2025-10-10 16:56:15 -07:00
Jordan Rose
8b10397484 node: Explicitly import Buffer from node:buffer 2025-09-29 18:23:38 -07:00
Alex Bakon
1f01c19e5f Convert libsignal-client node package to ESM 2025-09-22 14:20:16 -04:00
Jordan Rose
549d91aba3 net: Fold cdsi::LookupError::Parse into CdsiProtocol
Both of these indicate the server sending something unexpected, and
all clients already treat them the same at the app level anyway.
2025-08-18 10:00:42 -07:00
Jordan Rose
ddb8f340ca Remove unused cdsi::LookupError::InvalidResponse 2025-08-18 10:00:42 -07:00
Alex Bakon
1f923dcd88 Remove unused TransportConnectError::DnsError 2025-08-11 09:45:02 -04:00
Jordan Rose
9feb3de9d2 net: SvrError::ConnectionTimeout -> AllConnectionAttemptsFailed
The same error is being used both for timeouts and for "all attempts
failed"; if we're going to coalesce them (reasonable, given that the
only option in either case is "retry" or "don't"), "all attempts
failed" is a less misleading choice.

This changes the particular enum case in Swift from connectionTimedOut
to connectionFailed. Java continues to use NetworkException and
TypeScript the IoError code.
2025-08-01 14:02:54 -07:00
moiseev-signal
4d187d2452 ci: Run proxy tests in Slow Tests workflow 2025-07-02 13:25:57 -07:00
Jordan Rose
8070d6a4e6 Send Accept-Language when connecting a chat socket 2025-06-25 13:16:37 -07:00
Jordan Rose
97a2ded3f6 node: Replace Buffer with Uint8Array nearly everywhere
Exceptions:
- Buffers decoding from strings (usually for tests)
- Buffer.concat, if immediately fed into libsignal, which we know
  won't rely on the diverging behavior of slice()
- Encoding GroupIdentifier to base64

Everywhere else, Uint8Array was nearly a drop-in replacement. Places
where it wasn't:
- For tests, use assertArrayEquals more, which converts to hex first
  (better diffs anyway)
- Use TextEncoder and TextDecoder for going back and forth between
  strings and UTF-8 buffers *not* in the tests
2025-06-12 16:49:20 -07:00
moiseev-signal
2de3c7886b node: Move newNativeHandle out of net 2025-05-06 14:17:14 -07:00
Alex Bakon
0fde9a0160 Add a Node registration client fake server test 2025-04-08 13:11:51 -04:00
andrew-signal
0a6376525f Implement ConnectionInvalidated and ConnectedElsewhere Disconnection Reasons 2025-04-02 15:06:37 -04:00
Alex Bakon
9d3f2e0f54 Add conversion tests for registration errors 2025-04-01 17:18:00 -04:00
Alex Bakon
394ade4a5f Bridge registration session state as handle 2025-03-26 09:15:20 -04:00
Alex Bakon
9385ad2287 Expose registration service client in Node library 2025-03-25 13:23:35 -04:00
Alex Bakon
c08602eebe Enable creating a fake unauthenticated chat connection 2025-03-20 08:18:25 -04:00
Alex Bakon
07599d3d80 Let RetryLater implement SignalNodeError
Delegating directly simplifies several SignalNodeError impls and makes this
easier to use from impls for other error types in the future.
2025-03-18 09:09:14 -04:00
Alex Bakon
24d2870b60 Use separate error types for chat connect vs. send (#1431) 2025-03-10 15:42:42 -04:00
Jordan Rose
7ac3ce5d68 Implement preconnecting and expose it to Node 2025-03-06 10:56:56 -08:00
Jordan Rose
2ebd7cd2b3 Check for X-Signal-Alert header, and report it in a callback
This on-connect header will be used for lightweight "alerts" from the
server to an authenticated client. For now, it's only threaded through
to the Node implementation; the iOS and Android ones will come later.
2025-03-04 15:07:23 -08:00
Alex Bakon
ffdb35f59f Improve error handling for ChatConnection 2025-02-21 16:06:37 -05:00
Alex Bakon
2ba84ac051 Bridge chat response sending as synchronous 2025-02-21 15:29:20 -05:00
Alex Bakon
b34d84575f Remove chat service from bridge 2025-02-07 15:30:38 -05:00
Alex Bakon
23005551f2 Test chat connection send path
Add a test for the request send path and response receive path using the fake 
chat connection. This would have caught the bug fixed by bf680b09.
2025-02-05 15:15:34 -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
Alex Bakon
c42963cfdf Write listener bridging tests for chat connection 2025-01-31 14:03:52 -05: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
moiseev-signal
cf98c1a054 Remove SVR3 bridge from all platforms 2024-12-12 17:11:26 -08:00
Alex Konradi
02b727b393 Gate node chat connect test on HERMETIC env var 2024-12-12 09:12:11 -05:00
Alex Konradi
975f9b31c7 Pass tokio runtime handle to ws2::Chat::new 2024-12-06 06:04:07 -05:00
Alex Konradi
322f258e83 Impl new chat and bridge to node 2024-11-21 08:38:33 -05:00
Alex Konradi
e882c68b00 Expose rate-limited error from Chat 2024-10-31 17:22:25 -04:00
Alex Konradi
01102bbab1 Provide additional information on CDSI errors 2024-10-22 13:57:50 -04:00
andrew-signal
8394e4ec74 Add Testing Method for Desktop Client to Use for Local Mock Server Tests 2024-10-18 17:49:05 -04:00
gram-signal
0ed3d49d20 Switch SVR3 testing environment. 2024-10-18 09:41:29 -07:00
Alex Konradi
13c2d76f4c Signal intentional close when reader sees cancellation 2024-09-16 15:54:18 -04:00
Alex Konradi
40aaecb9f3 Propagate reason for chat disconnect to listeners 2024-09-05 16:49:55 -04:00
Sergey Skrobotov
4b283b7b4f net: dropping reconnect count field 2024-08-07 19:11:43 -07:00
Sergey Skrobotov
55ac7166e0 net: dropping auto-reconnect logic 2024-08-07 16:38:45 -07:00