Commit Graph

686 Commits

Author SHA1 Message Date
Evan Hahn
63bdeb5cf4
Update SignalCoreKit to get Guarantee's nilTimeout
See [the SignalCoreKit commit][0] we're pulling in.

[0]: 75f61972e0
2023-03-20 08:11:24 -05: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
Harry
a31fb00368
Change all e164 references in reg coordinator to E164 type 2023-03-16 11:32:13 -07:00
Harry
be743e4862
remove unused transaction param on pni change number 2023-03-16 11:27:49 -07:00
Max Radermacher
22d23b688a Refactor common logic in SignalServiceAddressTest 2023-03-15 17:10:10 -07:00
Evan Hahn
91c841dc3c Merge redundant callingCode(fromCountryCode:) tests
This test-only change should have no user impact.

`PhoneNumberUtil.callingCode(fromCountryCode:)` was tested in two
places. This combines them and moves the tests to Swift.
2023-03-15 12:41:19 -05:00
Sasha Weiss
367fdd769c
Rename KeyBackupServiceProtocol 2023-03-14 16:29:21 -07:00
Harry
8ca2d81d27
Add mcc/mnc to registration session if available 2023-03-14 12:41:31 -07:00
Pete Walters
3e3e0e5acf
Add manager to periodically validate usernames 2023-03-14 09:56:08 -05:00
Sasha Weiss
837c7776a8
Add tests for ChangePhoneNumberPniManagerImpl 2023-03-10 14:07:38 -08:00
Harry
a146e18aaf
Set up account state and exit registration
* Go to chat list view after registration

* sync system contacts during registration

* Use explicit local credentials for storage service operations during registration

* fix tests

* Quick hack to get through double pin confirmation

* Finishing touches

* lint

* fix build

* reload phone number discoverability after storage service sync

* fix tests again

* Take chat auth on account and contact record initializers

* Change around branches for clarity in OWSUserProfile

* pr comments

* Split ChatServiceAuth into the same and AuthedAccount

* fix tests

* merge woes
2023-03-09 21:54:51 -08:00
Sasha Weiss
82fad84831
Initial implementation of PNI change-number 2023-03-09 17:13:16 -08:00
Max Radermacher
93d97da82b
Split “in progress” & “saved” voice message drafts 2023-03-08 15:31:56 -08:00
Evan Hahn
7deb93ee98 Test scheduler: handle advancement to current time or earlier
This change should have no user impact.

Two changes:

1. Calling `advance(to: timeInThePast)` is now a fatal error.
2. Calling `advance(to: currentTime)` is now tested.
2023-03-06 12:23:13 -06:00
Harry
8c42d66489
Wipe related state on RegCoordinator when session id changes
* Wipe related state on RegCoordinator when session id changes

* Update Signal/Registration/RegistrationCoordinatorImpl.swift

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>

* Update Signal/Registration/RegistrationCoordinatorImpl.swift

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>

---------

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
2023-03-06 09:50:18 -08:00
Max Radermacher
98f3c03d41
Remove unused OWSDispatch class 2023-02-27 14:17:05 -08:00
Sasha Weiss
9b115c1cdb
Use LibSignalClient for local validation of username nicknames 2023-02-27 11:01:44 -08:00
Harry
cb6e99dd1d
Mark registration complete in RegistrationCoordinator 2023-02-24 11:12:22 -08:00
Max Radermacher
6dede44db6
Remove unused CDSv1 code
It’s been replaced by CDSv2.
2023-02-22 14:43:09 -08:00
Max Radermacher
0598c3f9b9
Clean up JobRecordFinder 2023-02-22 13:54:56 -08:00
Max Radermacher
42bfe615ff
Check PNI before E164 in CDS lookups 2023-02-22 10:37:39 -08:00
Max Radermacher
59593c3c97
Add ServiceId & E164 types
* Use the new E164 type in a few places
* Use the new ServiceId type in a few places
2023-02-21 23:13:46 -08:00
Max Radermacher
7ac03076e6
Consolidate link preview fetching code 2023-02-21 12:49:25 -08:00
Evan Hahn
96cc668158
Move isWeakPin function, add tests
This change moves `PinSetupViewController`'s `isWeakPin` method to
`OWS2FAManager`, adds tests, and adds an additional length check.

This change should have no user impact and is useful for an upcoming
task.
2023-02-21 09:00:57 -08:00
Harry
a6b2326ef3
Update registation API responses to match updated server spec
* Interpret nil nextVerificationAttempt as a code not having been sent yet, not as no code able to be submitted

* Update request and submit verification code handlers to latest server spec

* Update CreateAccountResponse codes to match server spec

* Update ChangeNumberResponse codes to match server spec

* Rename some cases for clarity, propagate up network errors vs generic errors

* pr comments
2023-02-17 14:11:43 -08:00
Harry
a23d469aac
Finish registration in RegistrationCoordinator
* Finish registration in RegistrationCoordinator

* Get tests to compile again (but not pass)

* Tests passing again

* Test session happy path all the way through to completion

* Test KBS auth credential happy path all the way through to completion

* Test KBS reg recovery password happy path all the way through to completion

* PR comments
2023-02-16 17:21:21 -08:00
Evan Hahn
3586894501
Consolidate E164 -> PhoneNumber code 2023-02-16 09:57:15 -08:00
Harry
9501a5bbf5
Populate AccountAttributes in RegistrationCoordinator
* Populate AccountAttributes in RegistrationCoordinator

* pr comments and cleanup
2023-02-14 10:40:47 -08:00
Harry
3d6225060d
Add RegistrationCoordinator
* Add ability to compute registration recovery password

* Add RegistrationCoordinator

* remove repeat nav controller that evan added

* Scaffolding for RegistrationCoodinator test

* Add first round of RegistrationCoordinator tests, some stuff I needed to get them working, and some fixes to RegistrationCoordinator itself I discovered thanks to the tests

* switch to owsFailBeta

* Add auth credential candidate flow tests, related fixes and additions to coordinator and friends

* Add tests for session based registration path and associated fixes

* PR comment nits
2023-02-14 08:50:24 -08:00
Max Radermacher
56154557dd
Add isStructurallyValidE164
This merges & replaces `resemblesE164:` and `isValidE164`.

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
2023-02-13 13:45:00 -08:00
Max Radermacher
90769ea381
Swiftify OWSDeviceProvisioner 2023-02-13 12:12:16 -08:00
Sasha Weiss
bcfd291f9c
Add support for username hashing 2023-02-08 16:02:02 -08:00
Harry
fc4ec188e8
Implement RegistrationSessionManager
* Add RegistrationSession object

* Add RegistrationSessionManager protocol

* Add skeleton RegistrationSessionManagerImpl - just kvstore persistence implemented

* Issue requests in RegistrationSessionManagerImpl

* let tests access the in memory kv store

* Add TSRequestOWSURLSessionMock. Rename OWSURLSessionMock

* Add DateProvider

* Take a dateProvider in RegistrationSessionManagerImpl

* Add tests for RegistrationSessionManager

* pre-emptively update timeout for tests. will remove once promise Scheduler code is merged

* PR comments

* Use Schedulers
2023-02-08 15:37:12 -08:00
Max Radermacher
73ac0c69a1
Add SignalRecipient.deviceIds 2023-02-08 13:46:15 -08:00
Harry
3c38092f8f
[RFC] Implement TestScheduler for synchronous promise-based tests
* Add Schedulers protocol and TestScheduler implementation

* Use schedulers in KeyBackupService+tests

* add tests for TestScheduler

* typo
2023-02-08 11:19:13 -08:00
Sasha Weiss
e5f1af6c2e
Support lookup-by-username 2023-02-08 10:16:57 -08:00
Harry
003cc19e62
Update SignalCoreKit. Use explicit DispatchQueue instead of relying on the implicit type on promise 'on' params
* Use explicit DispatchQueue instead of relying on the implicit type on promise 'on' params

* Update SignalCoreKit
2023-02-07 16:14:39 -08:00
Harry
ff7567370c
Add request/response types for Registration Session APIs
* Add UnknownEnumCodable+tests

* Add Registration session requests and responses + tests

* Use shared Accept-Language code
2023-02-06 12:44:31 -08:00
Evan Hahn
b95a1c4363
Make FullTextSearchFinder stateless
This change should have no user impact. I think this is a useful
cleanup.
2023-02-06 13:33:43 -06:00
Evan Hahn
3cacae049f
Add utilities for recovering corrupted FTS tables
This change should have no user impact. These utilities are currently
unused but will be soon.
2023-02-06 10:38:53 -06:00
Evan Hahn
7efe024940 Explain why a migration lacks a column type
This change should have no user impact.

I created a column in 8d707a9c74. I wanted
it to be a `BLOB`. I succeeded because [SQLite chooses `BLOB` by
default][0], but I wish I had been explicit.

I *could've* updated the migration, but didn't want to make a mistake
and cause divergent migrations. Instead, I added a comment.

I also updated a test.

[0]: https://www.sqlite.org/datatype3.html#determination_of_column_affinity
2023-02-06 08:34:00 -08:00
Harry
60af527ed8 Uptimeouts on KeyBackupServiceTest 2023-02-04 01:07:50 +00:00
Harry
9a511cdda0
Add deprecated prefix to all existing onboarding/registration types
* Add deprecated prefix to all existing onboarding/registration types. (Will be forked to new versions later, potentially untouched)

* Mark old requests deprecated
2023-02-03 15:02:04 -08:00
Harry
bf88b99836
Up timeouts for KBS test 2023-02-02 14:32:52 -08:00
Harry
43ce863362
Support for re-registration 2023-02-02 10:17:52 -08:00
Harry
6576349613
Migrate KeyBackupService to the Swift Way™️
* Put KeyBackupService in its own folder

* Put SDSKeyValueStore in its own directory

* Put SDSDatabaseStorage in its own directory

* Stop doing useless dispatches in SDSTransactable

* Add V2 DB classes

* Wrap SDSKeyValueStore in a protocol and factory

* Make TSConstantsProtocol public to take it as a param in other places

* Take explicit transactions and do single lookups in TSAccountManager registration state methods

* Take explicit transaction on OWS2FAManager

* Make KeyBackupService an instance that takes dependencies on init

* Protocolize KeyBackupService

* Put Dependencies+SSK in its own directory

* Add DependenciesBridge

* add ViewControllerContext

* used shared context in OnboardingController

* Don't check KeyBackupService in RemoteConfigManager; the one and only callsite already checks it separately

* All the random cleanup that needed to happen to get the app to build again.

* Add mock dbv2 classes

* Migrate existing KeyBackupServiceTests

* Namespace KBS shims

* DBV2 -> DB, after changing the min swiftlint type length to 2 chars

* add toy example

* Unwrap writes as reads

* pr comments

* pr comments 2: return of the nits

* final Pr comment
2023-02-02 09:42:05 -08:00
Evan Hahn
1ba45411ae
Enable a RingRTC field trial for all users, with kill switch
The successor to 389515b0fa.

This enables the "WebRTC-Network-UseNWPathMonitor" RingRTC field trial
for all users.

The hard part: adding a remote config kill switch. I added a bunch of
comments (and tests) to try to make the intention clear.
2023-02-01 16:20:16 -06:00
Max Radermacher
3a1556ca46 Clean up & Swiftify allSortedContacts 2023-01-30 12:15:11 -08:00
Evan Hahn
cc92abdc90
Clean up "delete subscriber ID" request
This is similar to 227f05e932.

This change should have no user impact.

This changes the "delete subscriber ID" request in the following ways:

- Adds tests
- Converts it to Swift
- Renames `deleteSubscriptionIDRequest` to `deleteSubscriberID`
- Serializes the data inside the method, rather than requiring callers
  to do so
2023-01-27 15:11:48 -08:00
Evan Hahn
227f05e932 Clean up "set subscriber ID" request
This change should have no user impact.

This changes the "set subscriber ID" request in the following ways:

- Adds tests
- Converts it to Swift
- Renames `setSubscriptionIDRequest` to `setSubscriberID`
- Serializes the data inside the method, rather than requiring callers
  to do so

Tested this with automated tests and manually starting a subscription in
staging.
2023-01-26 13:45:25 -06:00