10

In the official AsyncStorage example: https://facebook.github.io/react-native/docs/signed-apk-android.html Every key value has a @myAppStore: prefix.

await AsyncStorage.setItem('@myAppStore:key', '{ "data": [...] }');

However, in Save sensitive data in React Native, it seems Android and iOS both have their sandboxes, so the data is (kind of) secured.

Does the @myAppStore: prefix define the scope (eg. like creating a new collection in NoSQL), or it just a naming convention?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
FisNaN
  • 2,517
  • 2
  • 24
  • 39
  • This is a useful question, I am also not sure if we should do the former or latter. I hope someone knows more about this. – user2078023 Oct 04 '19 at 10:45
  • https://stackoverflow.com/questions/45733662/what-are-the-benefits-of-using-prefix-in-keys-in-local-storage-when-building-cli it is answered here, you can refer the answer – Burhan3759 Jul 09 '20 at 03:38

1 Answers1

0

As far as I understand the @something notation is nothing that actually does anything special to the content that you put into the storage. It rather is a nice naming convention that they use.

Having said this, I think you can use whatever you want there as keys, but I kept it there to make my code more readable and quickly see where I use the async storage.

I always use AsyncStorage.setItem(@key,data) not @name:key because whatever you put in there as a field is indeed already the "key". Or the value under which your data is stored.

To store user and temporary key seems to be okay while I would not store backend keys.

Fapi
  • 323
  • 2
  • 15