Skip to content

Protected browser storage in .Net 5 Preview 8 and Blazor wasm #25416

Discussion options

You must be logged in to vote

It doesn't make sense to use protected browser storage on WebAssembly.

The idea of data protection is to encrypt the data so it can't be read by the end user while in storage (plus to use a hash to ensure the data can't be tampered with). Neither of these concepts are applicable when your code runs client-side, because the end user can always observe and modify what the code is doing. There's no way for any client-side application, whether that's JavaScript or WebAssembly or any native code (besides DRM approaches) to hide data from the user.

So when you're on WebAssembly, you should just use sessionStorage or localStorage directly via JS interop without attempting to hide the data. Be su…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by SteveSandersonMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants