8000 [PM-10388] Copy TOTP when autofilling by fedemkr · Pull Request #809 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[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

Merged
merged 9 commits into from
Aug 13, 2024

Conversation

fedemkr
Copy link
Member
@fedemkr fedemkr commented Aug 9, 2024

🎟️ 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

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

@fedemkr fedemkr requested review from matt-livefront and a team August 9, 2024 19:30
Copy link
Contributor
github-actions bot commented Aug 9, 2024

Logo
Checkmarx One – Scan Summary & Details99dfb7d8-6de8-4f35-9622-186c864ece89

No New Or Fixed Issues Found

Copy link
codecov bot commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.43%. Comparing base (6f6c1e0) to head (20cd0ec).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.


var clientService: MockClientService!
var pasteboardService: MockPasteboardService!
var stateService: MockStateService!
Copy link
Contributor

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

}

/// `copyTotpIfPossible(cipher:)` doesn't copy the code because auto copying totp is disabled.
func test_copyTotpIfPossible_autoTotpCopyDisabled() async throws {
Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Collaborator
@matt-livefront matt-livefront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@fedemkr fedemkr merged commit 6addd46 into main Aug 13, 2024
8 checks passed
@fedemkr fedemkr deleted the mobiletf/pm-10388/copy-totp-when-autofill-passkey branch August 13, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0