russhwolf / multiplatform-settings

A Kotlin Multiplatform library for saving simple key-value data
Apache License 2.0
1.7k stars 67 forks source link

[Encryption] Provide a way for saving key-data value pairs more securely #85

Closed nrobi144 closed 1 week ago

nrobi144 commented 3 years ago

Could it be possible to provide a way for saving data more securely, with encryption?

I'm thinking about EncryptedSharedPreferences for the Android, if I'm correct Keychain should work on Apple targets and it's already covered somewhat, and I'm not sure about js targets.

@russhwolf What do you think? I could chip in with some initial research and development

vanniktech commented 3 years ago

Something like this? https://github.com/russhwolf/multiplatform-settings/issues/63#issuecomment-696525899

nrobi144 commented 3 years ago

Yes, exactly. I've missed that

russhwolf commented 3 years ago

Yeah, for Android you can use EncryptedSharedPreferences already without needing any explicit library support here because it implements SharedPreferences. Eventually I think there will be something similar for DataStore as well, but it's not clear what that will look like yet.

For iOS (or other Apple platforms) there's KeychainSettings, which hasn't been very battle-tested yet but it should work (and I'd love to hear whether or not it meets your security needs).

For JS there's nothing currently, so I'd definitely welcome contributions there. Same for other platforms.

russhwolf commented 1 week ago

Closing in favor of #186 which has more recent discussion on some other platform implementations