Commit Graph

67 Commits

Author SHA1 Message Date
Max Radermacher
ded1d2f5b8
Assume everybody is PNI-capable 2024-02-13 14:53:39 -06:00
Max Radermacher
abd97cd35f
Finish protocolizing SSKSessionStore 2023-10-11 10:59:21 -05:00
Harry
aa0e250cb7
[Death to TSAccountManager, long live TSAccountManager][9] Migrate usages of old TSAccountManager to new 2023-10-05 08:56:08 -07:00
Max Radermacher
434317cb02
Swiftify & protocolize OWSIdentityManager 2023-08-29 10:28:11 -05:00
Max Radermacher
08f7e848e1
[ServiceId] Clean up various odds and ends 2023-08-23 11:50:53 -05:00
Max Radermacher
be8ba49b4e
[ServiceId] Update protobuf field names 2023-08-02 17:21:59 -05:00
Max Radermacher
e6f5f41370
[ServiceId] Update incoming message handling 2023-08-02 17:11:25 -05:00
Max Radermacher
a58858b507 Remove redundant test
It does the same thing as `test_contactMessage_UuidOnlyEnvelope`.
2023-05-24 09:40:28 -07:00
Harry
8f8e74e2b5
Update message processor suspension-related behavior
* use set of enums for message suspensions

* Update meaning of isDrainingPendingEnvelopes

* rename messageProcessorDidFlushQueue -> ...DidDrainQueue
2023-03-16 14:23:10 -07:00
Sasha Weiss
82fad84831
Initial implementation of PNI change-number 2023-03-09 17:13:16 -08:00
Evan Hahn
370ff654e7
Change license to AGPL
Change license to AGPL

This commit:

- Updates the `LICENSE` file

- Start every file with something like:

      // Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
      // SPDX-License-Identifier: AGPL-3.0-only

---

First, I removed existing license headers with this Ruby 3.1.2 script:

    require 'set'

    EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']

    same = 0
    different = 0

    all_files = `git ls-files`.lines.map { |line| line.strip }
    all_files.each do |relative_path|
      if relative_path == 'Pods'
        next
      end

      unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
        next
      end

      path = File.expand_path(relative_path)

      contents = File.read(path)
      new_contents = contents.sub(/\/\/\n\/\/  Copyright .*\n\/\/\n\n/, '')

      if contents == new_contents
        same += 1
      else
        different += 1
      end

      File.write(path, new_contents)
    end

    puts "updated #{different} file(s), left #{same} untouched"

I'm sure this script could be improved, but it worked well enough.

Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.

Then I fixed some stragglers and updated the precommit script.

See [a similar change in the Desktop app][0].

[0]: 8bfaf598af
2022-10-13 08:25:37 -05:00
Evan Hahn
4a0141be41
Omit E164 from outgoing envelopes
[Android][0] and [Desktop][1] have already removed this field. This
follows suit.

The highlights:

- `SignalService.proto` removes some fields by making them `reserved`
- `ProtoWrappers.py` updates our code generation to support addresses
  that only have a UUID (previously, you needed both a UUID and E164
  field)
- Most everything else is removing E164s

[0]: 9c266e7995
[1]: 2b0d3cab40
2022-10-03 23:55:39 +00:00
Evan Hahn
e2f7ee47f4
Remove unused methods from message processing test
`MessageProcessingIntegrationTest` has some unused methods. These were
added in ec66f3b21e. According to George,
they're no longer needed and may have been added mistakenly.
2022-09-27 11:49:29 -07:00
george-signal
010eb64e9d
Record early receipts for server-generated DRs 2022-06-20 13:25:24 -07:00
george-signal
ec66f3b21e
Break envelope processing into two parts (#4340)
The purpose of this change is to alleviate the
main source of CPU-grinding after sending a
message to a large group: about 20% of the total
time is spent decoding and re-encoding messages as
they are fetched from the DB and then updated with
info about which recipients have acknowledged
delivery.

Prior to this commit, we decrypted the payload and
then processed the message in a single rather deep
call tree that began in `processNextBatch`. There
are two completely different paths through this
tree that lead to handling a delivery receipt
because server-generated delivery receipts have
the necessary info in plaintext in the envelope
and client-generated delivery receipts have it in
the ciphertext.

The idea here is to break incoming envelope
handling into two parts.

In the first part, each envelope is decrypted and
other common activities (like handling sender key
distribution messages) are performed. A processing
request is created for each. Next, processing
requests are handled. It's easy to examine a
processing request to determine if it is a
delivery receipt, and if so, for what outgoing
message. Doing so allows the new
DeliveryReceiptContext class to cache message
fetches and combine updates to the same message.

Processing requests are grouped together so that
sequential delivery receipt requests enjoy caching
of messages and coalescing of updates into a
single fetch/decode/encode/commit. Other kinds of
envelopes are handled immediately to avoid
increasing memory pressure that caching multiple
messages could cause.
2022-06-09 16:40:34 -07:00
Jordan Rose
309230a086 Set the "share my number" flag when receiving a message at our PNI
Enables the receipt of messages addressed to the local PNI, and sets
the necessary state so that replies will have a PNI signature
included.
2022-05-20 10:48:22 -07:00
Jordan Rose
30adb219d6 Recognize destinationUuid on envelopes, and filter out non-ACI
We're very close to being able to decrypt messages sent to our PNI,
but *until* that point it's best to just drop any such messages. This
should make testing easier.
2022-03-18 14:15:00 -07:00
Jordan Rose
49d4684013 Teach OWSIdentityManager about PNI identity keys
And make all callers explicitly say which one they want (which for now
is always the ACI identity key).
2022-03-16 13:29:20 -07:00
Jordan Rose
310638ad78 Fix MessageProcessingIntegrationTest database expectations
These tests fulfill an expectation when a write to the database causes
the desired state to be reached. However, there may still be writes to
the database in flight, and the *next* write will *also* probably be
in the desired state, resulting in the expectation being fulfilled
again. Because this happened *after* the test finished, an exception
was thrown, the test environment terminated, and the *next* test (or
possibly a later one) was being blamed for the failure.

Fix this issue in both places where it happens by allowing multiple
fulfills, and re-enable the test that was previously getting blamed
for this.
2022-02-03 09:44:11 -08:00
Michelle Linington
e6e09c83e7 Disable broken test 2022-02-01 10:23:40 -08:00
Michelle Linington
2559fa8bb4 Disable broken test 2022-02-01 10:14:51 -08:00
Matthew Chen
997f354f74 Only warn in logs when duplicate decryptions occur. 2021-09-28 17:22:17 -03:00
Matthew Chen
fc45ec8f63 Refine de-duplication logic. 2021-09-24 18:30:42 -03:00
Michelle Linington
6cb440dc26 Fix tests 2021-09-23 09:56:02 -03:00
Michelle Linington
a9121b9ea3 Fix test compilation 2021-09-23 09:56:02 -03:00
Matthew Chen
4df6394564 Fix broken tests. 2021-09-20 17:51:16 -03:00
Matthew Chen
fcdca12cf5 Deprecate REST, Part 1
* Port socket manager to Swift.
* Clean up HTTP request success/failure state & errors.
* Rework network manager.
* Rework HTTP errors.
* Rework errors "properties": isRetryable, etc.
* Fix test breakage.
2021-08-18 14:25:36 -03:00
Matthew Chen
f2b76e60f9 Refine names. 2021-07-02 22:08:53 -03:00
Matthew Chen
8b73e93be2 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f06b72bc2a Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f65d6e8e2d Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
86b8eb08b8 Remove YapDatabase.
Apply asset from design.

Fix rebase breakage.
2021-03-25 11:41:16 -03:00
Matthew Chen
d0cbf8cfd0 Rework dependency access. 2021-03-25 09:24:27 -03:00
Nora Trapp
5f8f048202 Fix tests 2021-02-23 10:45:50 -08:00
Nora Trapp
91d2953843 Begone OWSMessageReceiver 2021-02-23 10:45:50 -08:00
Nora Trapp
3991802fa8 Add appropriate restrictions to when message processing can run. 2021-02-23 10:45:50 -08:00
Nora Trapp
ad6583facb Eliminate usage of decrypt job queue 2021-02-23 10:45:50 -08:00
Jordan Rose
07c20a5f6f Rename the SignalClient test protocol to avoid conflicts 2021-01-28 12:03:50 -08:00
Matthew Chen
b13ff0c879 Respond to CR. 2020-10-08 17:31:29 -03:00
Matthew Chen
fa96fecdcf Fix spurious test failures. 2020-09-17 17:30:38 -03:00
Nora Trapp
18e19088a5 Fix broken tests 2020-08-28 13:10:47 -07:00
Matthew Chen
4c6f2c22b4 Use protocol contexts in prekey stores. 2020-08-25 21:31:56 -03:00
Matthew Chen
fdd3c513ca Rework Groups v2 & CDS feature flags. 2020-08-11 17:45:04 -03:00
Matthew Chen
154805cf68 Fix broken tests. 2020-06-23 10:04:39 -03:00
Matthew Chen
3cedd3ccdf Overhaul database observation. 2020-06-18 09:28:49 -03:00
Nora Trapp
22f7298654 Fix tests 2020-06-01 13:07:56 -07:00
Nora Trapp
5c976b0acd PR Feedback 2020-03-16 16:30:58 -07:00
Nora Trapp
72842e094d Disable some tests temporarily 2020-03-14 15:40:02 -07:00
Michael Kirk
329fffb8e2 Fixing up phonenumber parsing tests 2019-10-25 18:33:56 -07:00
Matthew Chen
f56aae7ac9 Merge remote-tracking branch 'private/release/2.43.0'
# Conflicts:
#	SignalServiceKit/src/Util/FeatureFlags.swift
#	SignalServiceKit/tests/Storage/SDSDatabaseStorageObservationTest.swift
2019-09-16 14:41:22 -03:00