atsign-foundation / at_client_sdk

The Dart implementation of atSDK used for implementing Atsign's technology into other software
https://pub.dev/publishers/atsign.org/packages
BSD 3-Clause "New" or "Revised" License
1.46k stars 31 forks source link

Trying to connect with the wrong atKeys results in a lot of errors #900

Open cconstab opened 1 year ago

cconstab commented 1 year ago

Is your feature request related to a problem? Please describe.

When an atSign has been "reset" and new keys are cut by a client, old clients break as they are using the wrong keys. This is particulary acute with atclients that send notifications first (at_talk as an example).

Describe the solution you'd like

atclient should delete entire local datastore if it detects that the public key on the server is not the same as the public key in its local datastore

Describe alternatives you've considered

No response

Additional context

No response

gkc commented 1 year ago

Un-assigning myself as I am already at capacity in PR56. However, this is important, so it needs another assignee for PR56.

VJag commented 1 year ago

I will work with @purnimavenkatasubbu and @srieteja on this

purnimavenkatasubbu commented 1 year ago

The "reset" option is currently disabled in the staging and production dashboards.In order to debug the bug, We need the reset atsign option

gkc commented 1 year ago

You can test locally : tomorrow afternoon I will commit some scripts I use for testing which you can use to test reset scenarios

in the meanwhile - we should enable reset in staging - @athandle @naresh0689 can you do that please? (But it must remain disabled in prod for now)

gkc commented 1 year ago

Hi @purnimavenkatasubbu - see https://github.com/atsign-foundation/at_server/pull/1231 for some scripts I use to run things locally

gkc commented 1 year ago

@athandle @naresh0689 Can you re-enable reset in staging please? (But it must remain disabled in prod for now)

purnimavenkatasubbu commented 1 year ago

Hi @purnimavenkatasubbu - see atsign-foundation/at_server#1231 for some scripts I use to run things locally

Sure. I'll check

athandle commented 1 year ago

@athandle @naresh0689 Can you re-enable reset in staging please? (But it must remain disabled in prod for now)

I have a build to deploy after that I will move. If any thing urgent @gkc then I gave reset in admin, I can give demo to you

purnimavenkatasubbu commented 1 year ago

Hi @purnimavenkatasubbu - see atsign-foundation/at_server#1231 for some scripts I use to run things locally

Sure. I'll check

I see that this scripts are for macOS. Mine is Linux

gkc commented 1 year ago

@purnimavenkatasubbu Indeed. However, they are bash scripts, with nothing OS-specific in them, so they should work on Linux

purnimavenkatasubbu commented 1 year ago

Logs after testing locally. ErrorLogs.txt

srieteja commented 1 year ago

@VJag and I are brainstorming an approach for this. Moving to the next sprint for implementation

srieteja commented 1 year ago

Had to put the implementation on hold due to some unplanned work. Carrying this over to the next sprint.

srieteja commented 1 year ago

My intial approach:

Introduce two methods to atClient:

When initializing an atClient instance, check if the remote has been reset. Purge LocalSecondary storage if a reset has occurred. This would be preferably in the AtClientManager.setCurrentAtsign() as this is currently used to instantiate an AtClient for an atsign.

reset_loc_sec (1)

srieteja commented 1 year ago

The implementation of solution for this is https://github.com/atsign-foundation/at_client_sdk/tree/reset_local_secondary. Currently testing this and discussing the validity of the approach with @VJag

gkc commented 1 year ago

Is this still being actively worked on?

srieteja commented 1 year ago

I have an implementation ready in https://github.com/atsign-foundation/at_client_sdk/pull/1033. We need to discuss this in an arch call preferably. Will bring it up in the next arch call.

srieteja commented 1 year ago

I was able to complete the fix and testing in PR68. The PR is being reviewed and this ticket will be closed once the PR has been merged.

purnimavenkatasubbu commented 1 year ago

Tested the fix in the PR by the following steps

  1. Activated and authenticated an atSign through the onboarding_cli
  2. Call atClient?.deleteLocalSecondaryStorageWithConsent( userConsentToDeleteLocalStorage: true);
  3. Reset the AtSign from the dashboard
  4. call atClient?.isSecondaryReset()

isResetSecondary should return true as the atSign has been reset, but here it returns null.