import { storage } from '@wasp/storage';
// Sets 'value' at 'key'
storage.set('key', 'value')
// Gets value at 'key'
storage.get('key')
// Removes 'key'
storage.remove('key')
// Clears only things that were set by `storage.set`
storage.clear()
Help with security
We could provide an API for storing user sensitive data which we could then automatically clear on log out. Something like
This might be useful, but I feel like we should do a bit more convincing ourselves before we go into this! What is the benefit of this, why should Wasp do it?
We want to provide a helper for storing data locally on the clients.
Abstract away the storage implementation
We want to wrap
localStorage
orsessionStorage
(something like https://www.npmjs.com/package/use-browser-storage) and expose it to the user.Help with security
We could provide an API for storing user sensitive data which we could then automatically clear on log out. Something like