Summary
Currently, SolanaMobileWalletAdapter stores the MWA authToken in PlayerPrefs as a default fallback. While functional, PlayerPrefs is plain unencrypted app storage on Android, meaning a local compromise or backup extraction could expose the bearer token and allow session replay.
The agreed long-term solution is to introduce an IMwaAuthCache abstraction that developers can implement to inject platform-secure storage backends (e.g., Android Keystore / EncryptedSharedPreferences).
Proposed Work
- Define an
IMwaAuthCache interface with Set, Get, and Delete methods for the auth token.
- Update
SolanaMobileWalletAdapter to use IMwaAuthCache for all _authToken read/write/clear operations across:
_Login()
_SignAllTransactions()
SignMessage()
Logout()
DisconnectWallet()
ReconnectWallet()
- Provide a default
PlayerPrefsAuthCache : IMwaAuthCache implementation as the fallback (preserving current behaviour).
- Document how developers can supply a secure
EncryptedSharedPreferences-backed or Keystore-backed implementation via constructor injection.
References
Summary
Currently,
SolanaMobileWalletAdapterstores the MWAauthTokeninPlayerPrefsas a default fallback. While functional,PlayerPrefsis plain unencrypted app storage on Android, meaning a local compromise or backup extraction could expose the bearer token and allow session replay.The agreed long-term solution is to introduce an
IMwaAuthCacheabstraction that developers can implement to inject platform-secure storage backends (e.g., Android Keystore / EncryptedSharedPreferences).Proposed Work
IMwaAuthCacheinterface withSet,Get, andDeletemethods for the auth token.SolanaMobileWalletAdapterto useIMwaAuthCachefor all_authTokenread/write/clear operations across:_Login()_SignAllTransactions()SignMessage()Logout()DisconnectWallet()ReconnectWallet()PlayerPrefsAuthCache : IMwaAuthCacheimplementation as the fallback (preserving current behaviour).EncryptedSharedPreferences-backed or Keystore-backed implementation via constructor injection.References