-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Refactor FXIOS-10788 [Logins] Apply necessary adjustments for A-S EncryptorDecryptor update #24108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Adding |
| let key = rustKeys.keychain.string(forKey: rustKeys.loginPerFieldKeychainKey) | ||
| let encryptedCanaryPhrase = rustKeys.keychain.string(forKey: rustKeys.canaryPhraseKey) | ||
| return (key, encryptedCanaryPhrase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for background call here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some code before that called getKeychainData in the background and removed it 😓 Looking at it now, I think it makes sense to keep it in the background still, since I am not sure how compute intensive it is. Good catch !
| let rustKeys = RustLoginEncryptionKeys() | ||
| let (key, encryptedCanaryPhrase) = getKeychainData(rustKeys: rustKeys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let rustKeys = RustLoginEncryptionKeys() | |
| let (key, encryptedCanaryPhrase) = getKeychainData(rustKeys: rustKeys) | |
| let rustKeys = RustLoginEncryptionKeys() | |
| let (key, encryptedCanaryPhrase) = getKeychainData(rustKeys: rustKeys) |
strange indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops 🙃
| // This method will be called internally by rust when it needs to encrypt/decrypt logins. | ||
| // NOTE: Since this is called internally by rust and each CRUD operation will acquire a mutex lock on the db | ||
| // before doing anything we must make sure that getStoredKey is called before doing any CRUD operation in swift. | ||
| public func getKey() throws -> Data { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: should put an example somewhere or show how this works for reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks
|
This pull request has conflicts when rebasing. Could you fix it @issammani? 🙏 |
9238a45 to
8ee6f31
Compare
3a6e775 to
8ee6f31
Compare
|
This pull request has conflicts when rebasing. Could you fix it @issammani? 🙏 |
8ee6f31 to
33af679
Compare
|
@issammani #24265 is the Application Services bump that contains mozilla/application-services#6469 |
eb022e8 to
e7f06db
Compare
30eac48 to
8536b0c
Compare
0ce0fca to
94f9815
Compare
dcd7e44 to
1451fac
Compare
1451fac to
5c9cadc
Compare
Client.app: Coverage: 32.37
CredentialProvider.appex: Coverage: 21.41
NotificationService.appex: Coverage: 25.99
ShareTo.appex: Coverage: 31.42
libStorage.a: Coverage: 56.12
Generated by 🚫 Danger Swift against 5c056ce |
5c9cadc to
a610d90
Compare
ef1f91d to
ebe047b
Compare
700c7a3 to
403ffe9
Compare
| } else { | ||
| XCTAssertEqual(app.tables["Login List"].cells.count, defaultNumRowsLoginsList + 2) | ||
| } | ||
| XCTAssertEqual(app.tables["Login List"].cells.count, defaultNumRowsLoginsList + 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isabelrios The conditional check was needed before because in Bitrise keychain is not accessible and the code failed silently on writes. So everytime the test attempted to add a login it generated a new encryption key and deleted the old logins, resulting in having only one login stored at a time on BR. Now that I am mocking keychain the key should be retrieved so we have access to both logins ( or any n number of logins ) on CI.
( confirmed by adding some debug logs on another BR run ⏬ )

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, thank you!
📜 Tickets
Jira ticket
Github issue
💡 Description
This PR:
Loginstruct instead ofEncryptedLogin.LoginEntryFlattenedsinceLoginEntryis flat in the new implementation.getKeyto implementKeyManagerinterface.I ran tests locally and the only failure is not related:
Also tested locally adding/deleting/updating and everything seems to work correctly.
We can only merge this once this PR merges and a new A-S swift component is created. We will need to update the A-S version in this PR as well for BR to pass.
This PR is big enough. I will address other nice-to-haves in follow-ups:
FXIOS-11049: UseTackled in this PR as well.is_emptyforHasSyncedLoginswhich doesn't require decryptionhas_logins_by_base_domainfor domain search related operations.Deferred<Maybe<...>>()since it's hard to read and instead use completions.📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120)