Skip to content
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

Keep HostId in memory #303

Merged
merged 6 commits into from
Dec 12, 2024
Merged

Keep HostId in memory #303

merged 6 commits into from
Dec 12, 2024

Conversation

GhenadieVP
Copy link
Contributor

This is part of fixing the issue with user seeing Claim Profile prompt on iOS.

The root cause of the issue is that the iOS Wallet fails to resolve the host id and then we do consider that profile needs to be claimed. While this might be wrong assumption, just changing that to true is not the most correct fix.

The iOS wallet will fail to resolve the host id when the app is in background, as the access to the keychain is not allowed while the app is in background. We will try to resolve the host id every 15 minutes, which is the interval we do check for profile claim.
So this bug happens in a very specific scenario - when user moves the app to background somewhere at 13-14 minute - and when at 15 minute mark the wallet tries to resolve the host id, the following error is thrown by the secure storage:

OSStatus error:[-25308] User interaction is not allowed.

The fix, is to resolve the host id at boot time and then just read it from memory throughout the app lifecycle. Additionally, failing to resolve the host id is not considered a breaking error - even more, it is highly unlikely that the app will fail to perform secure storage operations at boot time.

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.

Project coverage is 93.2%. Comparing base (a2b1692) to head (a62d5b0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/sargon/src/system/sargon_os/sargon_os.rs 80.0% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #303     +/-   ##
=======================================
- Coverage   93.3%   93.2%   -0.1%     
=======================================
  Files       1095    1095             
  Lines      22962   22966      +4     
  Branches      77      77             
=======================================
  Hits       21427   21427             
- Misses      1521    1525      +4     
  Partials      14      14             
Flag Coverage Δ
kotlin 97.9% <ø> (ø)
rust 92.7% <80.9%> (-0.1%) ⬇️
swift 94.9% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/sargon/src/system/sargon_os/sargon_os_profile.rs 85.7% <100.0%> (-0.2%) ⬇️
crates/sargon/src/system/sargon_os/sargon_os.rs 78.8% <80.0%> (-1.6%) ⬇️

Copy link
Contributor

@CyonAlexRDX CyonAlexRDX left a comment

Choose a reason for hiding this comment

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

Excellent job tracking this one down! 👏

@GhenadieVP GhenadieVP marked this pull request as ready for review December 12, 2024 13:01
@GhenadieVP GhenadieVP merged commit 353dacc into main Dec 12, 2024
12 of 13 checks passed
@GhenadieVP GhenadieVP deleted the host_id_improvement branch December 12, 2024 13:53
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.

4 participants