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

self encryption key is not set for atsign #324

Closed sachins-geekyants closed 2 years ago

sachins-geekyants commented 3 years ago

Describe the bug I onboarded with @ minorgettingplayed7 on @ mosphere pro , when tried to add contact I started getting exception in encryption service and contact was not added.

Exception: Self encryption key is not set for atsign @minorgettingplayed7

after resetting the keychain and onboarding again I did not got this issue and was able add contacts. This behaviour was seen on multiple devices while testing.

Expected behavior contact should be added without any encryption exception.

Screenshots

Screenshot 2021-11-08 at 12 01 22 PM

Were you using an @‎application when the bug was found?


Gayathri-GA commented 2 years ago

I have faced the similar issue, While I am trying to add contact on @mosphere pro app, The contacts is not getting added also it results below exception

Screenshot 2022-03-14 at 5 20 25 PM
sitaram-kalluri commented 2 years ago

Analysed the code and found the root cause of the issue. The issue occurs only in iOS devices. When an app in iOS is uninstalled the local storage gets cleared but the keychain remains as is. Hence, during onboarding the app gets the data from the key-chain manager. But in onboard method in at_client_service.dart, we do not have the logic to persist the keys from key-chain manager to local storage.

As a temporary fix, calling persistKeys in onboard method in at_client_service.dart after line no. 220 resolved the issue.

sachins-geekyants commented 2 years ago

@kalluriramkumar is this fix available to test by pointing to any branch ?

gkc commented 2 years ago

@sachins-geekyants I just spoke to @kalluriramkumar - he has fix in local branch which resolves this, and he will be raising a PR shortly

gkc commented 2 years ago

Going to add this into the current sprint as it looks important to resolve for the next AtmospherePro release

gkc commented 2 years ago

@sachins-geekyants Sita's created the PR #473 branch https://github.com/atsign-foundation/at_client_sdk/tree/persist_keys

gkc commented 2 years ago

@kalluriramkumar previously in this ticket you said, "As a temporary fix, calling persistKeys in onboard method in at_client_service.dart after line no. 220 resolved the issue."

Does Sachin still need to do that, or does this PR fix the issue such that your suggested temporary fix is no longer needed?

sitaram-kalluri commented 2 years ago

@kalluriramkumar previously in this ticket you said, "As a temporary fix, calling persistKeys in onboard method in at_client_service.dart after line no. 220 resolved the issue."

Does Sachin still need to do that, or does this PR fix the issue such that your suggested temporary fix is no longer needed?

This PR fixes the issue and the temporary fix is not needed.

gkc commented 2 years ago

@sachins-geekyants once you've done a test against at_client trunk to verify this fix, we can publish a new at_client package version which includes this fix

sachins-geekyants commented 2 years ago

It's working fine with the trunk branch.

sitaram-kalluri commented 2 years ago

The fix is published in at_client_mobile: ^3.1.12.