Local Storage Adapter
Storage adapter backed by the browser's localStorage API.
Provides persistent credential and session storage that survives page reloads and browser restarts. Data is serialized as JSON using hex encoding for byte arrays.
Limitations:
Storage is limited to approximately 5 MB per origin.
Data is not encrypted and is accessible to any script on the same origin.
Only available in browser environments (throws on Node.js).
For production applications with larger storage needs, consider IndexedDBStorageAdapter.
Key scheme:
Credentials:
{prefix}cred_{credentialId_hex}Credential index:
{prefix}cred_indexSession:
{prefix}session
Example:
val storage = LocalStorageAdapter()
storage.save(credential)
val retrieved = storage.get(credential.credentialId)Parameters
Prefix for all localStorage keys. Defaults to stellar_sa_.
Functions
Clears the current session.
Retrieves a credential by its ID.
Retrieves all stored credentials.
Retrieves all credentials associated with a contract address.
Retrieves the current session.
Saves a credential to storage using upsert semantics.
Saves a session to storage.
Updates a credential with partial changes.