Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/silverbucket/secure-store-redis
Encrypt the data you store in redis
https://github.com/silverbucket/secure-store-redis
Last synced: 2 months ago
JSON representation
Encrypt the data you store in redis
- Host: GitHub
- URL: https://github.com/silverbucket/secure-store-redis
- Owner: silverbucket
- License: mit
- Created: 2014-12-17T17:38:07.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T00:16:51.000Z (2 months ago)
- Last Synced: 2024-10-24T00:41:01.207Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 211 KB
- Stars: 7
- Watchers: 4
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# secure-store-redis
A simple wrapper to encrypt and decrypt data stored in redis.
The main point is to ensure that any data you store in redis cannot be accessed
by anyone else, without the key.## Installation
```bash
npm install secure-store-redis
```## Initialization
```javascript
import SecureStore from "secure-store-redis";const store = new SecureStore({
uid: "myApp:store",
secret: "823HD8DG26JA0LK1239Hgb651TWfs0j1",
redis: {
url: 'redis://localhost:6379',
}
));
await store.init();
```## Save
```javascript
await store.save("quote", "hello world");
```### Get
```javascript
let res = await store.get("quote");
// res: 'hello world'
```## Delete
```javascript
const num = await store.delete("quote");
// num: 1
let res = await store.get("quote");
// res: null
```## Attempt to fetch encrypted data from another store
```javascript
await store.save("quote", "hello world again");const otherStore = new SecureStore({
uid: "myApp:store",
secret: "this is the wrong secret 32 char",
redis: {
url: "redis://localhost:6379",
},
});
await otherStore.init();let res = await otherStore.get("quote");
// res: null
```## Disconnect from Redis
```javascript
await otherStore.disconnect();
await store.disconnect();
```