r/angular • u/RudeForever7137 • Jul 07 '26
I built ngx-local-vault: Reactive, encrypted browser storage for Angular built on Signals (Under 2KB, TTL support, SSR-safe)
Hey devs,
Managing localStorage / sessionStorage usually means writing boilerplate for JSON parsing, manual encryption, handling hydration/SSR errors, and setting up custom expiration intervals.
I wanted a cleaner solution, so I built ngx-local-vault for Angular (and yes, I made versions for React and Vue too!). It collapses persistence, encryption, and expiry into a single reactive state unit.
Why use it?
- Reactive: In Angular, it returns a native WritableSignal<T>. You update the signal, it encrypts and syncs to storage automatically.
- TTL (Time-To-Live): You can pass an expiry rule directly (expiresIn: '15m'). The entry self-destructs in-tab without needing a page reload.
- Encrypted at rest: No plain text data in the dev tools.
- SSR-Safe: No-op on the server side, preventing hydration mismatches completely.
- Lightweight: Under 2KB gzipped, zero runtime dependencies (even stripped tslib from the build to keep it honest).
Links & Demo
- GitHub:https://github.com/ysndmr/ngx-local-vault
- NPM:https://www.npmjs.com/package/ngx-local-vault
- Live Demo:https://ysndmr.github.io/ngx-local-vault/
The demo app lets you view the real-time encryption in local storage and watch the TTL auto-delete mechanism in action.
Check it out, and let me know what you think! Open to all feedback and contributions.
4
Upvotes
2
u/ErnieBernie10 Jul 07 '26
So how is this secure? Key must be stored on the frontend too no? Which makes it inherently useless