._safeset - macmcmeans/localDataStorage GitHub Wiki
localDataStorage._safeset( keyName, value, [user scramble key] )
This method stores value under keyName, creating a new key if necessary, where the key prefix is prepended to keyName, and value is stored obfuscated. A user scramble key is optional, and if omitted, the global scramble key will be used.
This will overwrite an existing value for keyName. When this happens, the prior value cannot be retrieved.
While value is obscured, it is not encrypted. This means, for example, that value is not padded to a certain amount to disguise its true length.
Scramble keys (user or global) may be set to any data type, just the same as value.
EXAMPLES:
- localData._safeset( 'safeMemKey1', 'my obfuscated data', 123456 )
- localData._safeset( 'safeMemKey2', .007, 'my secret scramble key' )
- localData._safeset( 'safeMemKey3', new Date(), 'BR549' )
- localData._safeset( 'safeMemKey4', true, {'z':['10']} )
✨ The complement to this is _safeget.
🛢 The corresponding disk-based method is safeset.
📝 NOTE: To examine the obfuscated data internally, retrieve keyName with _get.