Closed auravoid closed 3 years ago
I understand the sentiment, but we don't really have any key to encrypt with, and it's not really different from all the other stored passwords in other apps. One possible solution would be to use the platform capabilities for this, i.e. Keychain Access on Mac, through the keyring crate: https://crates.io/crates/keyring. PRs welcome!
Hey, looking at the keyring crate, this looks easy enough so I'm gonna give it a try!
I have one question @jpochyla How do you want to handle the transition from "Password stored in config file" to "Use keyring"?
I am thinking for the next release we make the password
field in Config
to only be de-serializable but not serializable so we can read it but not write it.
Additionally we will save it in the keyring if it's not already there and we will delete it from the file.
In the next release we will tell serde to completely skip the password and we can remove some code since we will now assume the the password is either in the keyring or nowhere.
This way we give a transactional period for user and we will only have issues if a user skips the next release.
Alternatively we can tell serde to skip the password
and just force the user to tell us the password again so we can save it in the keyring.
Thoughts?
Thoughts?
@jpochyla Perhaps we could take inspiration from the (recent) switch that ncspot
has made, from storing plaintext(albeit base64-encoded) credentials to a librespot token (see https://github.com/hrkfdn/ncspot/commit/d6db7a54d634e7d5015ee03daddb939d7c225668).
Original ncspot issue for reference: https://github.com/hrkfdn/ncspot/issues/447
@BachoSeven Yup! master
is now storing the token instead of user credentials. Unfortunately it means users need to re-authenticate.
Saving the authentication credentials to the disk in a config file is great, but saving them raw is a bit insecure. It would be really helpful if the passwords get encrypted for user's privacy and safety.