Commit Graph

100 Commits

Author SHA1 Message Date
andrew-signal
de881ddde4 backups: Exporter now returns [Result<String, Error>] instead of a serialized JSON array object
Co-authored-by: Jordan Rose <jrose@signal.org>
2025-11-11 16:52:47 -05:00
Alex Bakon
1b2304022a Expose net remote config keys in TypeScript
Co-authored-by: Max Moiseev <moiseev@signal.org>
2025-11-06 15:17:32 -08:00
Jordan Rose
be59696a1b Enforce additional Python style checks
- flake8-comprehensions
- flake8-deprecated
- flake8-import-order
- flake8-quotes

The quoting rules are, roughly:
- Prefer single-quoted strings
- Unless it's a multi-line string / docstring
- Or the string contains an apostrophe
2025-10-16 13:48:03 -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
2b6c801fb6 bridge: Expose sendMultiRecipientMessage in UnauthMessagesService 2025-10-14 18:17:25 -07:00
Jordan Rose
4503a19190 Unify IdentityKeyPair_Deserialize implementations
...in the process revealing that the Java declaration had a missing
exception spec.
2025-10-09 11:31:20 -07:00
Jordan Rose
fb570d7c99 bridge: Add support for returning pairs from bridge_fns 2025-10-09 11:31:20 -07:00
Jordan Rose
42ff946228 node: Enforce @typescript-eslint/method-signature-style 2025-09-24 16:30:43 -07:00
Jordan Rose
15af92c93d protocol: Record signed prekey and base key used with a Kyber prekey 2025-09-16 15:33:59 -07:00
Jordan Rose
8fdb2778bc protocol: Split FingerprintError out from SignalProtocolError
The "fingerprint" / safety number operations *are* tied to the
"protocol" in that they provide a way to verify identity keys, but
they are also completely distinct from the message handling that the
rest of SignalProtocolError is used for.
2025-08-15 12:21:25 -07:00
Alex Bakon
bb05cc016e Streamline bridging of SVR-B function arguments 2025-07-29 14:18:16 -04: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
841f57c30f Move (RegistrationSessionState)RequestedInformation -> ChallengeOption 2025-06-23 10:37:55 -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
Alex Bakon
b95359ced8 Allow using registration client to check SVR2 credentials 2025-05-01 08:51:00 -04:00
Alex Bakon
8f1baf561c Use an enum value for IdentityKeyStore.saveIdentity in libraries 2025-04-25 12:52:58 -04:00
Alex Bakon
289d21c829 Bridge other registration response fields to Node 2025-04-11 17:26:32 -04:00
Alex Bakon
6e0e617aa1 Bridge register account function to Node 2025-04-11 14:25:36 -04:00
Alex Bakon
0d916d3aa0 Bridge registration client to Java 2025-04-09 18:57:07 -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
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
f05d606e67 Accept uppercase and mixed-case scheme for proxy
Co-authored-by: Jordan Rose <jrose@signal.org>
2025-02-18 10:14:48 -05:00
Alex Konradi
ea4aee159b Make AccountEntropyPool usable as bridge fn arg 2024-12-19 16:11:03 -05:00
Alex Konradi
ecb35a6b84 Fix Native.d.ts formatting 2024-11-22 14:08:19 -05:00
Alex Konradi
1431cac183 Define Native.d.ts input/output shapes as types 2024-11-20 14:26:28 -05:00
Alex Konradi
0dd5a0242f Remove CDSI return_acis_without_uaks 2024-11-18 09:50:47 -05:00
Alex Konradi
2124827723 Mark returned cancellable Promises in TS 2024-11-15 16:52:11 -05:00
Alex Konradi
9b70d85ff0 Remove MakeChatListener trait 2024-11-12 16:52:01 -05:00
Alex Konradi
b705532230 Remove circular node Native/Error dependency 2024-09-11 14:49:31 -04:00
Alex Konradi
40aaecb9f3 Propagate reason for chat disconnect to listeners 2024-09-05 16:49:55 -04:00
Jordan Rose
a8814d16f8 Move all "testing-fns" APIs into libsignal-bridge-testing
This means they'll be shipped to clients, but still filtered out of
the device builds on Android (via having two separate libraries on
disk) and iOS (by not being included in non-simulator builds). The
biggest benefit of this is dropping the :android:makeTestJniLibraries
step for running libsignal's Android tests.
2024-08-27 08:29:06 -07:00
Sergey Skrobotov
4b283b7b4f net: dropping reconnect count field 2024-08-07 19:11:43 -07:00
Alex Konradi
31759a5680 Add libsignal-bridge-testing for Node
Unlike Java, just bundle it into the exiting signal_node shared library. We 
don't care as much about code size here and splitting it into a separate 
library is significantly more complicated (though it might be worth it some 
day).
2024-07-10 14:09:35 -04:00
Jordan Rose
773530ecd1 Add type annotations to all our Python scripts
The main benefit of this is not our *own* type-checking; it's that
mypy will error out if you try to use a too-new Python API. And in
fact, we were already relying on Python 3.9 and didn't realize.

check_code_size.py works with JSON, so it still uses Any a fair bit.
2024-07-09 17:01:10 -07:00
Alex Konradi
ff864cce4d Refactor gen_{ts,java}_decl.py
No behavior change, just moving code into named functions to improve 
readability and maintainability, and applying some Python conventions.

Co-authored-by: moiseev-signal <122060238+moiseev-signal@users.noreply.github.com>
2024-06-26 15:05:21 -04: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
4e2a7de574 Expose the 'Stopped' event to Swift and Node
Swift: ChatListener.chatServiceConnectionWasInterrupted(_:)
Node: ChatServiceListener.onConnectionInterrupted()
2024-06-13 15:54:21 -07:00
Sergey Skrobotov
b3ec2cc7f2 net: chat listener bridging to node 2024-06-13 11:20:08 -07:00
Jordan Rose
a31d5b0dbc gen_ts_decl: Ignore "unused" warnings
It's common, especially during development, that certain items will
only be used by one bridge.
2024-05-21 13:04:18 -07:00
Sergey Skrobotov
3864f33b4d libsignal-net: dropping DebugInfo.connectionReused field 2024-04-16 10:20:00 -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
Sergey Skrobotov
a829c8f2e3 libsignal-net: introducing a separate ChatService class for Node 2024-04-01 16:25:23 -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
Sergey Skrobotov
aca995d745 libsignal-net: additional API and debug info 2024-03-27 12:39:24 -07:00
Alex Konradi
59b5ca0def Narrow the errors returned by bridged HTTP fns
Use AsType<X, String> to convert HTTP method, and header names and values in 
the bridging preamble so they can be used infallibly within the function 
bodies. Keep the Result<> output for HttpRequest_new so that it can return an 
InvalidUri error which, when bridged in Java, will produce a checked exception.
2024-03-20 14:36:38 -04:00
Jordan Rose
2bbca60eb5 bridge: Add ResultTypeInfo for Box<[Vec<u8>]>
Not actually distinct from Vec<Vec<u8>>, but works better with the
jni_result_type and ffi_result_type macros because `[Vec<u8>]` is a
single grouped token tree. Generalizes the string array helpers to
support bytestrings too.
2024-03-11 13:41:48 -07:00
Sergey Skrobotov
2d0b32d9df libsignal-net: use millis for timeout, pass status message back 2024-02-28 15:30:31 -08:00
Alex Konradi
e2be72fea4 Add AsType wrapper for bridging
Move fallibility of conversion of bridged types into the argument type. This
lets us have cleaner code in the bridge function code itself, and makes it
simpler to bridge trivially convertible enums.
2024-02-28 16:14:30 -05:00
Sergey Skrobotov
ec49a9774b libsignal-net: ChatService node bridge 2024-02-27 11:07:57 -08:00