Skip to content

feat(MWA): Introduce IMwaAuthCache abstraction for secure auth token storage #272

@coderabbitai

Description

@coderabbitai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions