Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neoskop/ethereal-secrets-middleware

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neoskop/ethereal-secrets-middleware

An express middleware to expose a REST endpoint to issue secrets for client to encrypt their local stores with (the so called local mode) or to store encrypted data for later retrieval (remote mode). The keys and the cipher texts are stored in a Redis DB.

  • 4.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
117
increased by101.72%
Maintainers
0
Weekly downloads
 
Created
Source

Ethereal Secrets Middleware

An express middleware to expose a REST endpoint to issue secrets for client to encrypt their local stores with (the so called local mode) or to store encrypted data for later retrieval (remote mode). The keys and the cipher texts are stored in a Redis DB. Each entry in the database is assigned a time-to-live thus making the secretes ethereal.

Local mode

let app = express();
app.use(
  '/secrets',
  etherealSecrets({
    local: {
      ttl: 15 * 60,
      cookie: {
        secret: 'icanhazcheezburger?',
      },
    },
    redis: {
      client: new IORedis(),
    },
  }),
);

If a client now issues GET /secrets the API will return JSON in the form of:

{
  "key": "<the key>"
}

Along with a cookie containing a session ID. On subsequent requests the same key is returned as long as the session is valid and the same cookie is sent with the request.

Remote mode

let app = express();
app.use(
  '/secrets',
  etherealSecrets({
    remote: {
      defaultTtl: 24 * 60 * 60,
    },
    redis: {
      host: 'redis',
    },
  }),
);

If a client issues POST /secrets with arbitrary data as post body parameter data, the API will return status code 201 and JSON in the form of:

{
  "key": "<the key>"
}

If a client now accesses GET /secrets/<the key> the API will return JSON in the form of:

{
  "data": "<the data>"
}

FAQs

Package last updated on 18 Oct 2024

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