mirror of
https://github.com/Darkrock-Studios/hammer-editor.git
synced 2026-08-05 07:40:00 +00:00
Replace the plaintext FileAuthTokenStore binding with platform-specific encrypted stores behind the same AuthTokenStore interface, wired via a new expect/actual authTokenStoreModule. Android: EncryptedSharedPrefsAuthTokenStore backed by EncryptedSharedPreferences with a Keystore-backed AES256_GCM master key (androidx.security:security-crypto). Desktop: EncryptedFileAuthTokenStore writes the token-map JSON as AES/GCM/NoPadding to the config directory. The key is derived (PBKDF2WithHmacSHA256) from the OS user name and home dir plus a static salt, with no key file on disk, so a copied token file is useless on another machine or user. A random 12-byte IV is prepended per write and owner-only POSIX perms are applied best-effort. Decryption failure is treated as no tokens rather than crashing. This guards against casual disk scraping and off-machine copies, not same-user local malware that can re-derive the key. iOS: still uses the plaintext file store pending a Keychain-backed implementation (TODO marker in the iOS binding). Migration: a legacy plaintext auth_tokens.json from an intermediate build is imported into the encrypted store and deleted on first access; existing encrypted tokens win on key collision so a stale plaintext entry cannot clobber a fresh session. |
||
|---|---|---|
| .. | ||
| wrapper | ||
| libs.versions.toml | ||