"Could not decrypt the item in SecureStore" and rewriting the encryption keys

Hello! This is a follow-up question to the issue described in https://github.com/expo/expo/issues/1459

SecureStore is saving the data as encrypted to the local storage and keeping the encryption keys in the Android keychain. To my understanding the following problem occurs on a reinstall situation where the encryption keys in the keychain become corrupted or the mechanism to decrypt the data using the keys does not work anymore because of missing data from the previous installation.

In the GitHub conversation the best solution (as I saw it) was to catch the error on getItemAsync and delete the item that we were not able to fetch. My question: is it sufficient to overwrite (setItemAsync) the corrupted data with the same key or should you first delete the data (deleteItemAsync)?

After a small test group result; it seems that setItemAsync is enough to replace the “broken” encryption key and to persist the saved and encrypted data (with the same key). To answer my original question: yes.