Data Storage and Persistence

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Data Storage and Persistence

Post by jacque » Fri Aug 07, 2015 9:19 pm

physicsclassroom wrote:Does Android OS have any type of backup/syncing that would put sensitive data at risk?
Android has a similar backup system. In addition, it is fairly common to root an Android device and many Android users do so. A rooted Android device has read/write access to all files on the entire drive. You could consider storing the user data on a server, and read it in from there on startup if you're concerned.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Data Storage and Persistence

Post by Simon » Fri Aug 07, 2015 10:25 pm

I say Encrypt!
It's very easy with liveCode.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Data Storage and Persistence

Post by jacque » Fri Aug 07, 2015 10:38 pm

Simon wrote:I say Encrypt!
It's very easy with liveCode.

Simon
Good idea. Easier, too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

physicsclassroom
Posts: 50
Joined: Sun Jun 30, 2013 1:43 am
Contact:

Re: Data Storage and Persistence

Post by physicsclassroom » Fri Aug 07, 2015 11:31 pm

If I use a stack to store some data, would the stack and its data be secure as well? This is part of my plan since the program operates by storing and retrieving data from a stack.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Data Storage and Persistence

Post by jacque » Mon Aug 10, 2015 11:12 pm

physicsclassroom wrote:If I use a stack to store some data, would the stack and its data be secure as well? This is part of my plan since the program operates by storing and retrieving data from a stack.
Anyone with root access and a copy of LiveCode could still open the stack and see the values, though using a stack does reduce the likelihood a bit. You can still use the stack as a storage file (I do that all the time) but it would be safer to use the encrypt command on the data before putting it into the stack, and the decrypt command if you need to retrieve and work with it later.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

golive
Posts: 98
Joined: Wed Jul 01, 2015 5:16 am

Re: Data Storage and Persistence

Post by golive » Tue Aug 11, 2015 1:10 am

jacque wrote:You can still use the stack as a storage file (I do that all the time).
How do you do that?
(Pardon me if that is a dumb question - I am a beginner trying to get up to speed quickly).

physicsclassroom
Posts: 50
Joined: Sun Jun 30, 2013 1:43 am
Contact:

Re: Data Storage and Persistence

Post by physicsclassroom » Tue Aug 11, 2015 3:22 am

Hi Jacque,

You mentioned that ...
jacque wrote:Anyone with root access and a copy of LiveCode could still open the stack and see the values, though using a stack does reduce the likelihood a bit.
To help me determine what types of information would need to go where (stack, .txt file, encrypted in .txt file), I'd like to know if a user with a rooted Android phone could open a stack, change some of the data, and save the stack such that the changed data is incorporated into the app?

Also, is any of this possible on an iOS device ... even one that has been jailbroken?

Thanks for your insight.

Tom

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Data Storage and Persistence

Post by jacque » Tue Aug 11, 2015 8:50 am

Anyone with root permissions can access the file, export it to their computer and open it in LiveCode, providing they recognize what app created it. Then they can alter it and move the file back to the device. This is also true for iOS if the device is jailbroken.

So it's more secure to encrypt the data before storing it, whether that's in a text file, a stack, or anywhere else. Encrypted data is almost impossible to decipher without the cypher keys, and it doesn't matter what type of file contains it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Data Storage and Persistence

Post by jacque » Tue Aug 11, 2015 8:59 am

golive wrote:
jacque wrote:You can still use the stack as a storage file (I do that all the time).
How do you do that?
(Pardon me if that is a dumb question - I am a beginner trying to get up to speed quickly).
You just use the stack as a storage file. There are more ways to store data in a stack than in a text file because you have access to custom properties, fields, and can even copy images or other objects to it. The stack can be very plain with no scripts, and opened invisibly. It's just used as a container.

I usually store most things as custom properties since those can hold virtually all kinds of data, including arrays and raw image data.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

physicsclassroom
Posts: 50
Joined: Sun Jun 30, 2013 1:43 am
Contact:

Re: Data Storage and Persistence

Post by physicsclassroom » Tue Aug 11, 2015 6:33 pm

A have a line of questions regarding saving of files in the specialFolderPath("documents") that I can't seem to find the answers to:

1) Does a .txt file automatically save? In the IDE and in the simulator, it definitely seems to. Can I expect auto-save for .txt files on iOS, Android and the like or do I need to issue a save command. If a save command is needed, is it

Code: Select all

save URL ("file:specialFolderPath("documents") & "fileName.txt")
2) What about a data stack placed in documents. It seems it needs to be saved? For a small stack, is there a time delay for saving or does the saving take place asynchronously with the rest of the script that issues the command?

Thanks.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Data Storage and Persistence

Post by Simon » Tue Aug 11, 2015 8:15 pm

Hi physicsclassroom,
In the dictionary "save" is only for stacks
save URL ("file:specialFolderPath("documents") & "fileName.txt")
should be

Code: Select all

put tMyVar into URL ("file:" & specialFolderPath("documents") & slash & "fileName.txt")
note the added slash (could be ..."/fileName.txt") and "file:"

Your #1
No, to auto save, not sure how you are seeing this, but it must be coded as above.
#2
I won't comment on "...asynchronously..." but it takes just as much time as the size of the stack you are saving. A stack with a bizillion images in it takes longer then a stack with a 1000 lines of text.
OK that line doesn't sound convincing. It normally takes pretty much un-noticeable time to save a stack.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply