https://github.com/meysammoghaddam/protectedbrowserstorage
Provides services for storing data in the browser's localStorage. The stored data is protected using AES encryption and decryption functions.
https://github.com/meysammoghaddam/protectedbrowserstorage
aes-encryption asp-net-core blazor blazor-client blazor-webassembly blazorwasm browser-localstorage decryption-functions localstorage netstandard protected sessionstorage
Last synced: about 1 year ago
JSON representation
Provides services for storing data in the browser's localStorage. The stored data is protected using AES encryption and decryption functions.
- Host: GitHub
- URL: https://github.com/meysammoghaddam/protectedbrowserstorage
- Owner: MeysamMoghaddam
- Created: 2020-05-30T15:02:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-14T19:42:26.000Z (about 6 years ago)
- Last Synced: 2025-05-01T01:05:24.683Z (about 1 year ago)
- Topics: aes-encryption, asp-net-core, blazor, blazor-client, blazor-webassembly, blazorwasm, browser-localstorage, decryption-functions, localstorage, netstandard, protected, sessionstorage
- Language: C#
- Size: 17.6 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ProtectedBrowserStorage
Provides services for storing data in the browser's localStorage. The stored data is protected using AES encryption and decryption functions.
I'm use this in my Blazor WebAssembly client-side project.
# Install
```
Install-Package ProtectedBrowserStorage.NETStandard -Version x.x
```
x.x is version of package for use last version see https://www.nuget.org/packages/ProtectedBrowserStorage.NETStandard
# How to use
Add this line to Startup.cs. Register into DI container
```
services.AddProtectedLocalStore(new EncryptionService(
new KeyInfo("45BLO2yoJkvBwz99kBEMlNkxvL40vUSGaqr/WBu3+Vg=", "Ou3fn+I9SVicGWMLkFEgZQ==")));
```
## For Use Blazor WebAssembly client-side Register into Program.cs
```
builder.Services.AddProtectedLocalStore(new EncryptionService(
new KeyInfo("45BLO2yoJkvBwz99kBEMlNkxvL40vUSGaqr/WBu3+Vg=", "Ou3fn+I9SVicGWMLkFEgZQ==")));
```
In _Imports.razor add this
```
@using ProtectedLocalStore
@inject ProtectedLocalStore _protectedLocalStore
```
Now we can use it in our Component.
### Use browser session storage
set Synchronous protected data
```
_protectedLocalStore.SetSession("key", data);
```
set Asynchronous protected data
```
_protectedLocalStore.SetSessionAsync("key", data);
```
get Synchronous data
```
_protectedLocalStore.GetSession("key");
```
get Asynchronous data
```
_protectedLocalStore.GetSessionAsync("key");
```
### Use browser local storage
set Synchronous protected data
```
_protectedLocalStore.SetLocal("key", data);
```
set Asynchronous protected data
```
_protectedLocalStore.SetLocalAsync("key", data);
```
get Synchronous data
```
_protectedLocalStore.GetLocal("key");
```
get Asynchronous data
```
_protectedLocalStore.GetLocalAsync("key");
```
*** I'm glad to see your comments ***