An open API service indexing awesome lists of open source software.

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.

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 ***