-
-
Notifications
You must be signed in to change notification settings - Fork 15
Data Scrambling
Since the data held in localStorage is always viewable, you may opt to obscure key values using lightweight data scrambling. This is not encryption, merely obfuscation, and is easily implemented using a global scramble key. Alternatively, for higher protection you may set a user scramble key on a per key basis when placing sensitive data into the store.
While not technically encryption, data scrambling is however quite robust. As such, there is no way to retrieve the original value from a key that's been scrambled in the event the scramble key become lost or forgotten. Likewise, it is impossible to get the original value from a renamed key. The difference between plain and scrambled data is shown below.
EXAMPLES:
Setting the key normally
● localData.set( 'safeKey2', 99.97 )
👉 Inspecting safeKey2 shows that the key value is stored as 99.97.
Setting the key using the global scramble key (internal default is 123456789)
● localData.safeset( 'safeKey2', 99.97 )
👉 Inspecting safeKey2 shows that 99.97 is stored as ßЭȲĂߩ.
Setting the key with an explicit user scramble key
● localData.safeset( 'safeKey2', 99.97, 'secret-user-key' )
👉 Inspecting safeKey2 shows that 99.97 is stored as ó̡ƿÂґ.
Array Keys:
push / pull, pullall poke contains where
Broadcasting:
broadcast
Data Transfer:
import / export
Duplicates:
countdupes, showdupes, listdupes
Internals:
cancrunch crunch / uncrunch
shufflestring / unshufflestring
Management:
keys
Memory Consumption:
Memory Quota:
showquota
Query:
haskey, hasval, hastype
setscramblekey / getscramblekey
Type Check:
isarray isbigint isboolean iscrunch
isdate isfloat isinteger isnull
Utility:
chopget copy softset rename
_set / _get _clear _key _remove
Management:
_keys
Type Check:
_isarray _isbigint _isboolean _iscrunch