Correct me if I'm wrong but I feel like every single article about service workers I have read, covers only one use-case: very simple, "static" website. Like "Here, you can cache your images using SW and now your app can work offline. The end.".
Well... I have an existing app, let's say it's a "TODO-list": user logs in and can view/modify the list. Server communication is based on POST requests (JSON).
Now, I want to make it work offline: user should be able to still view the list (this time from cache). Its pretty easy to cache POST requests using IndexedDB but how do it securely? Lists can contain sensitive data and if not encrypted, everyone could just open DevTools and browse them.
Any tips, ideas? I need at least some level of security. My first -not a bright- idea was to encrypt the cached data using user's credentials but that wouldn't work: credentials are known only when loggin in and are lost after page refresh.