Commit Graph

22 Commits

Author SHA1 Message Date
Harry
7ba5f7384a
Handle being de-registered while still in the middle of registration
* put rereg mode params into a struct for sharability

* add step and UI handling for when we become deregistered during post-reg steps

* handle dereg when syncing push tokens

* show generic error on kbs backup failure

* handle dereg when restoring from kbs

* handle dereg during profile setup steps

* finalize pni stuff before deregistering

* add comment

* change debug fail to log

* Navigate to verification vc before showing popup so that we don't cancel the nav controller pop

* send a session sms code even if we get interrupted right after session creation

* improve state handling for initial session sms code

* nit: make var fileprivate

* show error when state changed on screen
2023-03-28 07:50:56 -07:00
Sasha Weiss
be4b132ea6
Rename StorageServiceManagerProtocol 2023-03-23 09:29:38 -07:00
Evan Hahn
319582e7cb
Use unsigned ints for PIN attempts
This change should have no user impact. I think it's useful on its own
but it also makes a future task easier.

You can't ever have a negative number of remaining PIN attempts, so I
made sure we're using unsigned ints everywhere.

We also had two identifiers for "remaining attempts" (`triesRemaining`
and `remainingAttempts`) so I standardized it.
2023-03-21 08:57:26 -07:00
Sasha Weiss
f20a663db8
Revert line that caused reentrant transactions 2023-03-14 17:44:48 -07:00
sashaweiss-signal
a83448c26a Rename KeyBackupServiceProtocol file 2023-03-14 16:43:53 -07:00
sashaweiss-signal
bec300c253 Rename KeyBackupService file 2023-03-14 16:43:53 -07:00
Sasha Weiss
367fdd769c
Rename KeyBackupServiceProtocol 2023-03-14 16:29:21 -07:00
Sasha Weiss
81b6201a03
Rename KeyValueStoreProtocol -> KeyValueStore 2023-03-14 13:26:06 -07:00
Harry
ac9a68688c
Set registration recovery password in AccountAttributes
* Move AccountAttributes into shared file

* Add AccountAttributesRequestFactory

* Add new AccountAttributes generators

* Migrate verifyPrimaryDeviceRequest

* Migrate verifySecondaryDeviceRequest

* clarify the role of secondary device account attributes

* Remove AuthKey from AccountAttributes; it was unused on the server and therefore totally vestigial

* remove old updatePrimaryDeviceAttributes request and associated code

* Add registration recovery password to AccountAttributes

* Unconditionally set account attributes when changing or setting the PIN

* fix tests

* easy pr comments

* dont set v1 2fa pin unless no kbs backups exist
2023-03-14 13:11:09 -07: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
Max Radermacher
898fd2c4d5
Clean up queue names 2023-02-27 14:16:09 -08:00
Harry
cb6e99dd1d
Mark registration complete in RegistrationCoordinator 2023-02-24 11:12:22 -08:00
Harry
38cba70b85
Hook up new registration PIN entry screen 2023-02-23 09:50:17 -08:00
Harry
cd63f67b3e
Retry most network failures in RegistrationCoordinator
* Retry most network failures in RegistrationCoordinator

* Update the way we identify network errors to be more flexible

* Retry remaining requests

* Automatically retry registration requests if time intervals are short

* fix error types not compiling on kbs

* Add test for reg recovery password reg with retries

* fix extra t
2023-02-17 14:50:54 -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
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
a47425f008
Use AES-GCM & AES-CTR from LibSignalClient 2023-02-13 11:29:41 -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
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
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