remotestorage/modules — pull request #46 by michielbdejong (2014-05-14 13:55:36+00:00)
Title: Add 'CredentialsStore' class (fixes #44)

The CredentialsStore can be used in any module that stores some
kind of config or credentials. It offers the option to do client-side
encryption.
For now, the module needs to supply the password both when setting and
when getting, but in the future, the widget may take care of letting
the user enter their client-side encryption password. As soon as that
code lands in rs.js master, we can update this class so that it calls
something like `remoteStorage.widget.getPassword` instead.
The password must be a string or undefined for no encryption. Setting
will always work; getting will only work if the password matches the one
that was used the last time when setting. Even though the password does
not leave the device, it is not a per-device password; it is of course
necessary to use the same password on all your devices, because they
all sync and if one device writes an encrypted config, all other devices
will receive that same encrypted config when they read from the remote
storage.

Will add more unit tests and naturaldocs-style comments.