-
Notifications
You must be signed in to change notification settings - Fork 53
[PM-10388] Copy TOTP when autofilling #809
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
[PM-10388] Copy TOTP when autofilling #809
Conversation
…ic of this to the TOTPService so it can be reused and it's easier to test.
No New Or Fixed Issues Found |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #809 +/- ##
=======================================
Coverage 88.42% 88.43%
=======================================
Files 596 596
Lines 30093 30115 +22
=======================================
+ Hits 26611 26633 +22
Misses 3482 3482 ☔ View full report in Codecov by Sentry. |
|
||
var clientService: MockClientService! | ||
var pasteboardService: MockPasteboardService! | ||
var stateService: MockStateService! |
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.
🎨 This should probably be set to nil in the tearDown
as well
BitwardenShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift
Outdated
Show resolved
Hide resolved
BitwardenShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift
Outdated
Show resolved
Hide resolved
BitwardenShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift
Outdated
Show resolved
Hide resolved
} | ||
|
||
/// `copyTotpIfPossible(cipher:)` doesn't copy the code because auto copying totp is disabled. | ||
func test_copyTotpIfPossible_autoTotpCopyDisabled() async throws { |
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.
🎨 To the best of my knowledge, we generally alphabetize tests, even though it means success tests get put in the middle. (This is often why when there's just one success test, it's just test_functionName()
, so that it sorts to the top)
|
||
// MARK: Methods | ||
|
||
func copyTotpIfPossible(cipher: CipherView) async throws { |
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 really like pulling this sort of functionality into the TOTPService. I was very confused when I first got into the codebase and a fair number of TOTP-related things were scattered about in different places.
Co-authored-by: Katherine Bertelsen <kbertelsen@bitwarden.com>
Co-authored-by: Katherine Bertelsen <kbertelsen@bitwarden.com>
Co-authored-by: Katherine Bertelsen <kbertelsen@bitwarden.com>
…iption of a test to be more complete.
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.
Looks good!
🎟️ Tracking
PM-10388
📔 Objective
Copy TOTP code if possible/allowed when autofilling before giving back the credential to the OS.
Move the logic from password autofill totp copying to
TOTPService
so it can be reused and it's easier to test. Additionally, if copying the TOTP raises an error we should log it but we shouldn't fail the autofill request; applied this as well to password autofill.⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes