Commit Graph

182 Commits

Author SHA1 Message Date
Evan Hahn
349681ff85
Attempt to recover corrupted databases
If a user's database is corrupted, we now try to fix it. I recommend
reviewing `DatabaseRecovery` to see how this works, and
`DatabaseRecoveryViewController` for the bulk of the UI.
2022-10-06 16:42:19 -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
4d55d95869 Autofix SwiftLint whitespace issues
I recommend reviewing this with whitespace changes disabled.
2022-09-15 16:37:44 +00:00
Evan Hahn
48c3c08c10 Fix vertical_parameter_alignment SwiftLint violations
This fixes violations of [SwiftLint's `vertical_parameter_alignment`
rule][0]. This should have no user impact.

[0]: https://realm.github.io/SwiftLint/vertical_parameter_alignment.html
2022-08-18 10:37:09 -05:00
Evan Hahn
e679707038 Fix SwiftLint shorthand_operator violations
The gist is:

```diff
-foo = foo + 1
+foo += 1
```

Most of the violations were in generated files, so I changed and re-ran the generator.

A few of these violations required implementing some new methods, which I added tests for.

See [the docs for this rule][0].

[0]: https://realm.github.io/SwiftLint/shorthand_operator.html
2022-06-07 14:51:57 +00:00
Evan Hahn
16aa421d3e More Python 3 script fixes 2022-03-24 10:28:27 -05:00
Dimitris Apostolou
62724cf0be Fix typos 2022-03-18 11:31:06 -07:00
Martin Böttcher
000c4c282b Merge branch 'master' into martin/IOS-2234 2022-03-17 09:09:37 +01:00
Nora Trapp
80d1fce505 Convert TSGroupMember to SDSCodableModel 2022-03-16 18:06:59 -07:00
Jordan Rose
cbe6744313 Audit hardcoded OWSIdentityACI uses and leave TODO comments
Or don't, if the hardcoded "ACI" is correct (e.g. for outgoing
messages).
2022-03-16 14:31:06 -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
Martin Böttcher
eedfd70f3e merged master and pod files 2022-03-15 12:49:11 +01:00
Martin Böttcher
8f9be31ba3 replaced NSLocalizedStringFromAppBundle with OWSLocalizedString 2022-03-08 10:17:25 +01:00
Jordan Rose
15d13517fa Add SDSCursor protocol, for common functionality across cursors 2022-03-07 15:01:39 -08:00
George Nachman
d305bc66a3 Optimize searching for verification status, redux.
Commit 451fa08c22
had some bugs and was reverted by commit
12883e5db5.

This commit brings it back along with fixes.

Specific bug fixes:

* Verification status for a group was inverted.
* The local address should not be considered for
  deciding if a group is verified.
2022-03-01 14:15:11 -08:00
Michelle Linington
12883e5db5 Revert "Optimize searching for verification status."
This reverts commit 451fa08c22.
2022-02-23 15:22:28 -08:00
George Nachman
451fa08c22 Optimize searching for verification status.
When opening a group chat we check if all
participants are verified (which confers to the
chat verified status and a "✓ Verified" label in
the header) and we also check if any participants
have the "no longer verified" status so we can
warn you about potential misdeeds.

Previously, this was done by performing a select
statement for each participant twice (once for
"are all verified" and again for "is any
no-longer-verified").

This change uses a join in a select statement
instead to reduce the number of queries performed.

Given existing indexes in the DB this can be done
efficiently. Adding additional indexes does not
seem to help - or at least I wasn't able to get
sqlite to use them.

Since most chats are not verified, we use a LIMIT
clause when possible to allow the DB to stop
early, which should make queries even cheaper.
2022-02-18 12:32:58 -08:00
Jordan Rose
61232780ee Don't reindex conversations on every model change
Every single message updates a TSThread model, but only a change in a
member's profile name or phone number, or a change to a group's model,
can update the indexing information. Turn 'shouldBeIndexedForFTS' into
a tri-state 'FTSIndexMode' with options 'never', 'manualUpdates', and
'always', and use 'manualUpdates' for TSThreads. Then explicitly
reindex on any of the changes listed above.
2022-02-01 15:05:34 -08:00
Ehren Kret
41a289946b Add support for new certificate authority
TextSecure CA expires in ~1 year; time for new one.
2022-01-26 12:59:45 -06:00
Ehren Kret
c8cbd0bca0 Regenerate SDS extensions 2022-01-24 12:47:21 -06:00
Jordan Rose
d1e52563c0 SSK: Replace AFSecurityPolicy with OWSHTTPSecurityPolicy
OWSHTTPSecurityPolicy was originally a subclass of AFSecurityPolicy
specifically for use with Signal-run services, but it already contains
the part of AFSecurityPolicy that we use elsewhere.
2021-12-17 14:40:25 -08:00
Matthew Chen
9963df1f23 Reduce statics. 2021-11-02 10:36:25 -03:00
Michelle Linington
77b7ea5c40 Fix a whole bunch of warnings 2021-10-21 21:11:26 -07:00
Matthew Chen
91ad7d1df7 Respond to CR. 2021-10-21 09:21:31 -03:00
Matthew Chen
5d780d1589 Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Matthew Chen
b28131de13 Refine error localizedDescription. 2021-08-18 15:01:03 -03:00
Matthew Chen
37052a302a Fix build warnings around imports. 2021-06-07 11:11:30 -04:00
Matthew Chen
10778e915c Improve handling of db corruption. 2021-05-03 15:00:33 -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
Jordan Rose
68a27a76e2 Move AxolotlKit model classes into SSK and remove the dependency
We still need the AxolotlKit model classes to migrate old sessions,
but we don't need any of the actual protocol support. This also
means we can drop HKDFKit.

Additionally, we do still use some utilities from AxolotlKit:

- AxolotlExceptions.h: NSException names, should eventually be
  replaced by NSErrors everywhere

- NSData+keyVersionByte.h: prepend/remove public key type byte,
  should eventually be replaced by strong types (ECPublicKey)

- SPKProtocolContext.h: defines the SPKProtocol{Read,Write}Context
  marker protocols, should be replaced by direct use of
  SDSAny{Read,Write}Transaction
2021-03-22 16:17:47 -07:00
Matthew Chen
3bb5f0777b Add profile bio fields to database schema. 2021-01-14 22:25:45 -03:00
Jordan Rose
4045f15800 OWSHTTPSecurityPolicy: Assert that loaded certificates are valid
These are loaded from our own bundle, so we should be able to
guarantee validity.
2020-09-30 17:44:54 -03:00
Jordan Rose
428002e439 Fix leaks of various CF types 2020-09-30 17:44:54 -03:00
Matthew Chen
c017e76aab Rename singleton accessors. 2020-09-17 21:11:09 -03:00
Matthew Chen
fdd3c513ca Rework Groups v2 & CDS feature flags. 2020-08-11 17:45:04 -03:00
Matthew Chen
c4b16ebb1e Add remove config flag for UUID-based safety numbers. 2020-08-07 17:53:38 -03:00
Nora Trapp
c5214e38b6 Add Codable adherance to proto wrappers 2020-07-22 14:34:24 -07:00
Matthew Chen
2a72d563ae Respond to CR. 2020-06-18 12:22:14 -03:00
Matthew Chen
b37c2bc713 Rework SDS extensions to support deep copies and cache lifecycle. 2020-06-18 12:05:07 -03:00
Matthew Chen
0891ce52e1 Copy model read cache values. Add deepCopy method to all models. 2020-06-11 13:22:16 -03:00
Matthew Chen
553fca16f6 Merge branch 'release/3.8.4' 2020-05-08 16:13:17 -03:00
Nora Trapp
a590bda73d Always use UUID capable sender certificate 2020-05-07 14:15:16 -07:00
Matthew Chen
e84168fa68 Merge remote-tracking branch 'private/release/3.8.2' 2020-05-05 13:38:30 -03:00
Matthew Chen
e541466913 Add requireUUIDs feature flag. 2020-05-01 17:15:02 -03:00
Matthew Chen
7246c613d5 Fix more build warnings. 2020-04-10 13:17:08 -03:00
Matthew Chen
fe18cd1596 Fix build warnings around initializers. 2020-04-08 16:05:54 -03:00
Matthew Chen
4fe82b041c Fix build warnings around initializers. 2020-04-08 16:05:54 -03:00
Matthew Chen
2d41ad42b4 Fix build warnings around initializers. 2020-04-08 16:05:54 -03:00
Matthew Chen
02f853a8dc Clean up code generation. 2020-04-02 13:31:14 -03:00