https://github.com/bryopsida/redis-key-store
A redis backed implementation of bryopsida/key-store in typescript
https://github.com/bryopsida/redis-key-store
data-encryption-key keystore nodejs redis typescript
Last synced: 15 days ago
JSON representation
A redis backed implementation of bryopsida/key-store in typescript
- Host: GitHub
- URL: https://github.com/bryopsida/redis-key-store
- Owner: bryopsida
- License: unlicense
- Created: 2023-02-05T21:05:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-01T04:40:01.000Z (15 days ago)
- Last Synced: 2025-07-01T07:05:27.758Z (15 days ago)
- Topics: data-encryption-key, keystore, nodejs, redis, typescript
- Language: TypeScript
- Homepage:
- Size: 1.52 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Redis-Key-Store
[](https://sonarcloud.io/summary/new_code?id=bryopsida_redis-key-store) [](https://sonarcloud.io/summary/new_code?id=bryopsida_redis-key-store) [](https://sonarcloud.io/summary/new_code?id=bryopsida_redis-key-store) [](https://sonarcloud.io/summary/new_code?id=bryopsida_redis-key-store)
## What is this?
This is a implenetation of [@bryopsida/key-store](http://github.com/bryopsida/key-store) using redis as a backing store for use in distributed systems.
## How do I use it?
```typescript
import { Redis } from 'ioredis'
import { describe, expect, it } from '@jest/globals'
import { randomBytes, randomUUID } from 'crypto'
import pino from 'pino'// create a redis client
const redisClient: Redis = new Redis(6379, 'localhost')// fetch your key for the store
let password: Buffer // 32 bytes
let salt: Buffer // 16 bytes
let context: Buffer // 32 bytes// create a logger
const logger: Logger = pino()
const keyPrefix: string = 'keys'// create the key store
const store = new RedisKeyStore(
logger,
redisClient,
keyPrefix,
() => Promise.resolve(password),
() => Promise.resolve(salt),
() => Promise.resolve(context)
)it('can manage a DEK', async () => {
// create random data to act as key store
const dek = randomBytes(32)
const id = randomUUID()// save it
await keyStore.saveSealedDataEncKey(id, dek)// ask for it back
const fetchedDek = await keyStore.fetchSealedDataEncKey(id)// should be the same
expect(fetchedDek).toEqual(dek)// delete it
await keyStore.destroySealedDataEncKey(id)
})
```