Skip to content

Commit

Permalink
docs: add new implementation on README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
michelonsouza committed Aug 12, 2022
1 parent 332c5bb commit ad1df81
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Using the `crypto-js` library as an encryption engine, it saves the encrypted da
- [State Management Persisters](#state-management-persisters)
- [*vuex-persist*](#vuex-persist)
- [*redux-persist*](#redux-persist)
- [*pinia-plugin-persist*](#pinia-plugin-persist)
- [License](#license)

## Features
Expand Down Expand Up @@ -451,8 +452,6 @@ const vuexLocal = new VuexPersistence<RootState>({

#### *redux-persist*

**NOTE**: In the case of `redux-persist` it is `necessary` to use an `asynchronous` implementation, already provided by `EncryptStorage`.

```typescript
// ...
import { AsyncEncryptStorage } from 'encrypt-storage';
Expand All @@ -467,6 +466,32 @@ const persistConfig = {
};
```

#### *pinia-plugin-persist*

```typescript
// ...
import { encryptStorage } from 'path/to/encryptStorage';

export const useUserStore = defineStore('storeUser', {
state () {
return {
firstName: 'S',
lastName: 'L',
accessToken: 'xxxxxxxxxxxxx',
}
},
persist: {
enabled: true,
strategies: [
{
storage: encryptStorage,
paths: ['accessToken']
},
],
},
})
```

# License

[MIT License](/LICENSE)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "encrypt-storage",
"version": "2.4.0",
"version": "2.4.1",
"description": "Wrapper for encrypted localStorage and sessionStorage in browser",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit ad1df81

Please sign in to comment.