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

Where this plugin store the data in the phone storage? #47

Closed
DhavalRKansara opened this issue Jul 24, 2020 · 8 comments
Closed

Where this plugin store the data in the phone storage? #47

DhavalRKansara opened this issue Jul 24, 2020 · 8 comments

Comments

@DhavalRKansara
Copy link

DhavalRKansara commented Jul 24, 2020

Hi, I have gone through this plugin and also I have used the localstorage for my application to store the sensitive data. You have just mentioned the Simple JSON file-based storage for flutter in the readme file. I have some doubts and I suggest you update your readme file with the answer to the below questions.

  1. Can you please add some more information that where this plugin store the data inside the phone(Android and iOS)?
  2. The stored data for the application is accessible for the user or not?
  3. Are you using any encryption algorithm to store the data?
@fabianMendez
Copy link

Hi there

I think you should use the flutter secure storage plugin if you need to store sensitive data

@DhavalRKansara
Copy link
Author

Hi there

I think you should use the flutter secure storage plugin if you need to store sensitive data

I know how secure storage work it store data in keychain and keystore and I am also storing some sensitive data for app into it such as token, PIN etc...

But is it okay to store json data which consume 30 to 40mb of memory in secure storage?

@fabianMendez
Copy link

I think it is fine because the plugin does not save the data inside the keystore but instead the keys used to encrypt/decrypt that data or at least that's what the readme says it does on Android.

Also, according to this issue, there does not seem to be any limit in the size of the data

@DhavalRKansara
Copy link
Author

@fabianMendez Okay That is once a solution to store the data using flutter_secure_storage but still I want to know the information which I have mentioned above. because this is good for my use case when directly I can store JSON and retrieve it. Do you have any idea from above 3 points which I have mentioned n the problem?

  1. Can you please add some more information where this plugin store the data inside the phone(Android and iOS)?
  2. The stored data for the application is accessible for the user or not?
  3. Are you using any encryption algorithm to store the data?

@fabianMendez
Copy link

Alright, answering your questions:

  1. For Android and iOS, this plugin saves the data inside the directory returned by the getApplicationDocumentsDirectory method of path_provider, the file's name is the name you gave to the storage, for instance, in this case the file would be called example.json:
final storage = new LocalStorage('example.json`);

In Android this file would end up in this path:

/data/data/your.app.package/app_flutter/example.json
  1. This should not be possible unless the device is rooted/jailbroken

If you try to cat the above path without root, you will get a "Permission denied" error:

generic_x86_64:/ $ cat /data/data/your.app.package/app_flutter/example.json
cat: /data/data/your.app.package/app_flutter/example.json: Permission denied
  1. No, the data is stored in plain text

If you cat the above path with root you will see it's content:

generic_x86_64:/ $ su
generic_x86_64:/ # cat /data/data/your.app.package/app_flutter/example.json
{"hello":"world"}

@DhavalRKansara
Copy link
Author

Thanks for the answer @fabianMendez.

@DhavalRKansara
Copy link
Author

@lesnitsky @fabianMendez anwer is correct?

@lesnitsky
Copy link
Owner

@DhavalRKansara yes
check out https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider for more info (local_storage uses getApplicationDocumentsDirectory from path_provider)

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

No branches or pull requests

3 participants