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

1651 Commits

Author SHA1 Message Date
Jordan Rose
bee544ec73 Bump version to v0.18.0 2022-06-21 15:58:48 -07:00
Jordan Rose
70ec1ca26f
zkgroup: Add AuthCredentialWithPni
This is a variant of AuthCredential that carries two UUIDs, intended
to be a user's ACI and PNI. Why? Because when you've been invited to a
group, you may have been invited by your ACI or by your PNI, or by
both, and it's easier for clients to treat all those states the same
by having a credential that covers both identities. The downside is
that it's larger (both the data, obviously, but also the zkgroup proof
of validity, unsurprisingly).

AnyAuthCredentialPresentation gains a 'get_pni_ciphertext' method,
which will return `None` for the existing presentations and
`Some(encrypted_pni)` for the new credential. Having a separate
credential type but a common presentation type makes it easier for the
server to handle all possible credentials uniformly.
2022-06-21 15:11:57 -07:00
Jordan Rose
cc217911a9 zkgroup: Remove C_z from ExpiringProfileKeyCredentialPresentationProof
This term is unnecessary after all (the value of 'z' is already fixed
by the equation "Z = I^z"). We can't remove it from earlier proofs
because that would change the format, but going forward we don't need
it.
2022-06-17 17:12:05 -07:00
Jordan Rose
9e6343b6e4 Node: Force nominal typing for zkgroup ByteArray subclasses
Without this, two ByteArray types without any additional operations
are structurally equivalent, and so TypeScript permits passing one as
the other. (Thanks, Fedor!)
2022-06-17 14:14:12 -07:00
Jordan Rose
395e36e9f2
zkgroup: Add ExpiringProfileKeyCredential
Like ProfileKeyCredential, but with an expiration timestamp embedded
in it. This has its own credential type and response type, but uses
the same request type as a "classic" ProfileKeyCredential, and
generates presentations usable with AnyProfileKeyCredential-
Presentation, so that existing server code accepting presentations
will automatically do the right thing.

Adoption for servers:

- Update secret params
- When presentations are saved in group state, use 
  ProfileKeyCredentialPresentation.getStructurallyValidV1PresentationBytes()
  to maintain backwards compatibility with existing clients.
- Add an endpoint to issue ExpiringProfileKeyCredentials
- (future) Remove the endpoint that issues regular ProfileKeyCredentials

Adoption for clients, after the server has updated:

- Update public params
- Start fetching and using ExpiringProfileKeyCredentials instead of 
  regular ProfileKeyCredentials (the old endpoint will eventually
  go away)
- Node: To bring types into harmony, a receipt's expiration time has
  been changed to a `number` instead of a `bigint`
2022-06-17 13:10:10 -07:00
Jordan Rose
d404b3cec5 Build boring-sys with OPENSSL_SMALL for both iOS and Android
This trades speed for size around certain elliptic curve operations in
BoringSSL. We're using boring mostly for verifying certificates, not
the many many curve operations we do on a per-message basis, so for
now the code size is more important.
2022-06-17 11:28:10 -07:00
Jordan Rose
703ca16269 zkgroup: Rename timestamp types for future use
"RedemptionTime" becomes "CoarseRedemptionTime", highlighting its
measurement in days.

"ReceiptExpirationTime" becomes "Timestamp", highlighting its
forthcoming generalized use beyond receipts and it being the preferred
type going forward.
2022-06-16 17:38:01 -07:00
Chris Eager
2b0b5119f2
device transfer: replace picky with boring
Upcoming work in `attest` requires additional X509 support, and swapping these libraries 
is a negligible impact on binary size. This uses a fork of `cloudflare/boring`, as
we have some additions that haven’t yet been contributed upstream.
2022-06-16 13:14:17 -07:00
Jordan Rose
ce3226b4e3 verify_duplicate_crates should exit 1 on failure 2022-06-02 12:18:14 -07:00
Jordan Rose
0eaedd0f08 Revert "Add a new 'needs_pni_signature' field to the session state"
This reverts commit 7d761a9744.
2022-05-25 10:38:32 -07:00
Jordan Rose
f1825c4892 Revert "Expose SessionRecord.needsPniSignature/.setNeedsPniSignature"
This reverts commit 71fdd6566e.
2022-05-25 10:38:32 -07:00
Chris Eager
2c32fb802d Bump version to v0.17.0 2022-05-13 14:30:30 -07:00
Chris Eager
7e734dd5b4
CDS2: add initial, not-for-production, client bindings 2022-05-13 13:39:26 -07:00
Jordan Rose
4899db00f9 Update to latest curve25519-dalek 2022-05-13 11:15:33 -07:00
Jordan Rose
64f19f5ff0 Remove dependency on curve25519-dalek/serde for protocol and poksho
zkgroup depends on serde, but libsignal-protocol and poksho don't.
This makes builds of just those crates a little faster.
2022-05-13 11:15:33 -07:00
Chris Eager
80f8a2dac2 Add sha256 to reproducible java/Dockerfile 2022-04-29 16:27:30 -07:00
Jordan Rose
301b843f1a zkgroup: Test decoding a v2 ProfileKeyCredentialPresentation as v1
This is something older clients might try to do, and as long as they
only access the UUID and profile key ciphertexts it's "okay".
2022-04-20 12:41:46 -07:00
Jordan Rose
41e0a269a7 Node: Test with plain 'mocha' instead of 'electron-mocha'
...which drops our dependency on Electron altogether. We originally
tested with electron-mocha to more closely resemble the Desktop app,
but libsignal-client doesn't actually use anything Electron-specific,
and because it uses N-API we don't have to sync up versions exactly
(and indeed we haven't been updating the Electron in this repo as
often as the Desktop app has taken new Electrons).

Two benefits of this: you can now run the tests on headless systems
(see the change to the CI script), and `yarn install` has less to
download.
2022-04-12 12:50:53 -07:00
Jordan Rose
0c9bbb23be Node: Update dependencies
- Update .nvmrc to match Desktop
- Update electron, electron-mocha, and typescript to match Desktop
- Update indirect dependency 'minimist' per `yarn audit`

In signal-neon-futures test package:

- Update mocha
- `yarn upgrade` to clear audit advisories
2022-04-06 12:03:38 -07:00
Jordan Rose
66c6da4ce1 GitHub: Don't build JNI artifacts in the private repo
We only use them in the public repo; no sense wasting time and space.
2022-04-06 11:50:07 -07:00
Jordan Rose
916269c3e5 Bump to version v0.16.0 2022-04-06 11:08:56 -07:00
Trevor Perrin
7e12a71889
zkgroup: Optimize credential presentation and FFI cleanup
Optimize presentation of credentials (AuthCredentialPresentationV2, ProfileKeyCredentialPresentationV2, PniCredentialPresentationV2). Server will accept V1 or V2 presentations. Clients will produce V2.

Various improvements to FFI to support this, and some minor optimizations (in particular "lazy statics" to avoid redundant loading of SystemParams).
2022-04-06 11:07:08 -07:00
Jordan Rose
29998598e3 GitHub: Pin cbindgen version rather than using what's installed 2022-04-04 12:25:33 -07:00
Jordan Rose
459938a3bc update_versions.py: accept both '0.1.2' and 'v0.1.2' 2022-04-04 12:25:33 -07:00
Jordan Rose
07a51f0211 Release docs: changes to the Rust API are now considered breaking 2022-04-04 12:25:33 -07:00
Jordan Rose
e003feaf74 Add missing "license" lines to Cargo.toml files
This helps tools that read metadata from Cargo.toml, but has no other
effect.
2022-04-04 12:25:33 -07:00
Jordan Rose
93bfcea1ce Build the JNI component of libsignal-server for M1 Macs too 2022-04-04 12:25:33 -07:00
Jordan Rose
300b57fa9e Java: Add a ProGuard file to preserve our JNI bindings 2022-03-29 17:08:48 -07:00
Jordan Rose
59b3a24621 jni: Don't construct keys and records by serialization
Similar to the previous commit, this would make sense if we lazily
deserialized these types, but we don't. It's faster to clone them
structurally in Rust than to serialize and deserialize them.
2022-03-29 17:08:48 -07:00
Jordan Rose
07f6577640 jni: convert ProtocolAddresses to Java like any other bridge_handle
At one point we experimented with Java's SignalProtocolAddress only
wrapping a String + integer, rather than a boxed Rust handle, but we
gave that up because it was more difficult to pass them across the
bridge. That means there's no longer a need to go through
SignalProtocolAddress's main constructor when trying to box one from
Rust.
2022-03-29 17:08:48 -07:00
Jordan Rose
48ce4bf27d java: Test devicetransfer with java.security.cert.CertificateFactory
...instead of the deprecated javax.security.cert.X509Certificate.
2022-03-28 09:49:31 -07:00
Jordan Rose
8247be4840 Java: Fix package for InvalidSenderKeySessionException 2022-03-25 15:34:30 -07:00
Jordan Rose
df2d4ae9fa swift: Remove unnecessary Tests/LinuxMain.swift
This was previously necessary because the Linux implementation of
SwiftPM+XCTest didn't support automatic test discovery, but that's no
longer a problem with newer versions of Swift.
2022-03-25 12:04:17 -07:00
Jordan Rose
ba47c9d681 Bump to version v0.15.1 2022-03-24 17:01:23 -07:00
Jordan Rose
355e2006c4 Java: update reproducible build to Debian Buster (from Stretch)
The main advantage here is that we don't need any dependencies from
the unstable repo, which means we can be sure that the glibc version
we build against is suitable for Buster instead of being pulled in
from a later train. (We can't do this for Stretch because Stretch is
too old for all our build tools.)

While here, simplify the build a little bit: we're already using
snapshots of the Debian repo, so drop the separate file for pinned
dependencies.
2022-03-24 16:59:36 -07:00
Jordan Rose
b5d48df116 Bump to version v0.15.0 2022-03-23 10:57:54 -07:00
Jordan Rose
cbc2103f24 Update README 2022-03-23 10:49:09 -07:00
Jordan Rose
970677795a Node: Rename SignalClientError to LibSignalError 2022-03-23 10:49:09 -07:00
Jordan Rose
0542686e70 Update artifact/package/module names across all three app languages
- Java: org.whispersystems:signal-client-java ->
    org.signal:libsignal-client
- Java: org.whispersystems:signal-client-android ->
    org.signal:libsignal-android
- Java: org.whispersystems:libsignal-server ->
    org.signal:libsignal-server
- Swift: SignalClient -> LibSignalClient
- NPM: @signalapp/signal-client -> @signalapp/libsignal-client
- Repository: github.com/signalapp/libsignal-client ->
    github.com/signalapp/libsignal
2022-03-23 10:49:09 -07:00
Jordan Rose
a0c1745f8b Java: reorganize package structure
- org.whispersystems.libsignal -> org.signal.libsignal.protocol
- org.whispersystems.libsignal.protocol ->
    org.signal.libsignal.protocol.messages
- org.whispersystems.libsignal.util.AndroidSignalProtocolLogger ->
    org.signal.libsignal.logging.AndroidSignalProtocolLogger
- org.signal.zkgroup -> org.signal.libsignal.zkgroup
- org.signal.devicetransfer -> org.signal.libsignal.devicetransfer
  (test only)
- org.signal.client.internal -> org.signal.libsignal.internal
2022-03-23 10:49:09 -07:00
Jordan Rose
f98b7394ec Gradle: Conditionally throw an error when building without JDK 11
Previously the project would error out during the configuration stage,
since the Android Gradle plugin requires JDK 11 to even load. Now it
throws an error if you try to build a top-level task or a task in the
Android subproject, but allows you to build, e.g. 'client:test' with
no problems.
2022-03-22 10:19:47 -07:00
Jordan Rose
526cbab04f Gradle: Fix conditional execution of :downloadNonLinuxLibraries
This helper task was supposed to only execute when publishing the
client or server artifacts, but at the point where that was checked
the task graph *hasn't been built yet*. Instead, add the task to the
task graph unconditionally, but disable it by default, and have its
dependents enable it only when publishing.
2022-03-22 10:19:47 -07:00
Jordan Rose
4e10836255 Java: fix directory structure for org.signal.libsignal.metadata 2022-03-22 10:19:47 -07:00
Jordan Rose
d26cf8b46d Add dedicated error types for invalid 1:1 and Sender Key sessions
In Java these are subclasses of IllegalStateException, a
RuntimeException, so that every session operation isn't annotated as
throwing InvalidSessionException. Swift and TypeScript don't have
typed errors, so they're just additional specific cases that can be
caught.
2022-03-21 14:12:04 -07:00
Jordan Rose
6bd001f244 protocol: Tweak error text for NoSenderKeyState error
We use this when the record for a given distribution ID is missing the
state for a particular chain ID.
2022-03-21 14:12:04 -07:00
Jordan Rose
6591567d31 protocol: Audit the failability of SenderKey session operations
Similar to the previous commit, this makes crate-internal operations
use a dedicated error type, or not produce an error at all, in order
to make sure that errors for invalid sessions always have the
distribution ID attached.
2022-03-21 14:12:04 -07:00
Jordan Rose
601454d201 protocol: Audit the failability of 1:1 session operations
Anything that stays within the crate gets a dedicated error type, or
no error at all if the operation cannot actually fail. The "defensive"
signatures remain for public operations.

Apart from making 'Result' more meaningful, this also keeps from
propagating low-level errors out that really indicate a corrupt
session.
2022-03-21 14:12:04 -07:00
Jordan Rose
c22f7c76b9 java: Fix exception specifications
Some were overzealous, others were missing. Some are still not really
appropriate; see further commits.
2022-03-21 14:12:04 -07:00
Jordan Rose
13292a001c node: Update devDependencies with yarn upgrade
No updates needed for the run-time dependencies.
2022-03-21 11:32:56 -07:00
Jordan Rose
a2182ca348 Update other Rust dependencies
This was done by `cargo update`, followed by reverting to earlier
versions of specific crates that have trouble on our current pinned
nightly.
2022-03-21 11:32:56 -07:00