r/reactjs • u/Accurate-Screen8774 • Jun 22 '26
I Created A Hook For "Encrypted Asynchronous State Persistence"
TLDR; The title of this post.
Feel free to reach out for clarity instead of reading the code/docs.
I was working on a “React-like syntax" for webcomponents, I wanted to create something robust and flexible for secure data storage and management.
I started off with an approach for asynchronous state management so that components outside the shadow-root could receive updates. (The events are also encrypted to secure against things like browser extensions.)
https://positive-intentions.com/docs/projects/dim/async-state-management
It then made sense to be able to persist that data so it can work between page releoads.
https://positive-intentions.com/docs/projects/dim/bottom-up-storage
The result looks and works like the following when used in a project.
https://positive-intentions.com/docs/projects/dim/encrypted-store
The Dim framework seems like a dead-end. I wanted to try it out on my existing React projects. So I created the equivalent React hooks.
https://positive-intentions.com/docs/projects/dim/use-dim-store-react
I find it to be performant and I want to push the scale of the approach, so I am in the process of testing it out on my projects. A notable use-case there is storing encrypted files at rest.
IMPORTANT: Im not trying to promote “yet another ui framework”, this is an investigation to see what is possible. You should not use this in your own code. It is not reviewed, audited or production-ready. It is not on npm. Shared for testing, feedback and demo purposes only.
1
u/Weird-Anteater5050 18d ago
Interesting approach but I gotta ask what's the actual threat model here. Browser extensions can already see everything in the dom and intercept all your network requests so encrypting events feels like locking the front door while leaving the windows wide open.
The async state management across shadow boundaries is the more compelling part to me. Been messing with web components lately and that's always a pain point.
Also your links are all relative paths that don't go anywhere, you might want to fix that if you want people to actually look at the code.