New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bryopsida/redis-key-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bryopsida/redis-key-store

Implementation of @bryopsida/redis-key-store using redis as backing store

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Redis-Key-Store

Coverage Security Rating Bugs Code Smells

What is this?

This is a implenetation of @bryopsida/key-store using redis as a backing store for use in distributed systems.

How do I use it?

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)
})

Keywords

FAQs

Package last updated on 30 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc