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

fix: Enable at_client to initialize in offline when network is down #1348

Merged
merged 6 commits into from
Jul 22, 2024

Conversation

sitaram-kalluri
Copy link
Member

- What I did

  • This PR introduces offline access capabilities to the AtClient SDK, allowing the client to initialize for offline access when network connection is not available during the authentication of an atSign.

- How I did it

  • The "authenticate" method has been updated to support offline access for the AtClient. Within the method, the call to "authenticate" from the AtAuth package is enclosed in a try block. If a network failure occurs during this call, the exception is caught. The code then checks if the user is already onboarded. If the user is onboarded, the AtClient is subsequently initialized for offline access.
  • Added AtLookup as optional parameter to AtAuthServiceImpl to enable injecting mock instance for writing unit tests. If the optional parameter "AtLookup" is not injected, then the it is initialized in "_initAtClient" method which is the existing behaviour.

- How to verify it

  • Added unit tests for the below scenarios
    • Test to verify AtClient initializes successfully in offline mode upon network failure when keychain manager contains keys.
    • Test to verify AtClient initialization fails when network is offline and keychain manager does not have keys.
    • Test to verify authenticate is successful and initialization is successful

- Description for the changelog

  • Enable at_client to initialize in offline when network is down

@gkc
Copy link
Contributor

gkc commented Jul 1, 2024

Thanks @sitaram-kalluri ... I will set aside some time tomorrow to test this out in various scenarios with noports and at_talk. @cconstab you may be interested also

@gkc
Copy link
Contributor

gkc commented Jul 18, 2024

Thanks @sitaram-kalluri ... I will set aside some time tomorrow to test this out in various scenarios with noports and at_talk. @cconstab you may be interested also

Ah this only applies to at_client_mobile. What manual testing has been done with apps, @sitaram-kalluri ?

@gkc
Copy link
Contributor

gkc commented Jul 18, 2024

Thanks @sitaram-kalluri ... I will set aside some time tomorrow to test this out in various scenarios with noports and at_talk. @cconstab you may be interested also

Ah this only applies to at_client_mobile. What manual testing has been done with apps, @sitaram-kalluri ?

Manual testing documented here

@gkc
Copy link
Contributor

gkc commented Jul 18, 2024

Following discussion with @sitaram-kalluri, we will look at introducing a feature flag so that application code needs to opt in to this behaviour rather than having it happen by default, as it can lead to changes in app behaviour if this feature is enabled by default

@gkc
Copy link
Contributor

gkc commented Jul 22, 2024

Following discussion with @sitaram-kalluri, we will look at introducing a feature flag so that application code needs to opt in to this behaviour rather than having it happen by default, as it can lead to changes in app behaviour if this feature is enabled by default

After further discussion, we have decided not to introduce a feature flag.

@sitaram-kalluri sitaram-kalluri merged commit 614028e into trunk Jul 22, 2024
10 checks passed
@sitaram-kalluri sitaram-kalluri deleted the at_client_offline_access branch July 22, 2024 10:26
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.

Being able to get an AtClient without having connectivity to your atServer (i.e offline access)
2 participants