Socket
Book a DemoInstallSign in
Socket

felid-cookie

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

felid-cookie

Send files for Felid.js

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Build Status JavaScript Style Guide

A Felid plugin that provides support for cookies.

Install

npm install felid-cookie

or

yarn add felid-cookie

Usage

const Felid = require('felid')
const cookie = require('felid-cookie')

const app = new Felid()
app.plugin(cookie, options)

app.get('/', (req, res) => {
  const cookies = req.cookies              // cookies from client
  req.unsign('signed cookie')              // unsign the request cookie
  res.cookie('cookie key', 'cookie value') // set a single cookie pair
  res.cookies({ foo: 'bar' })              // set cookies
})

Options

  • secret String: The default secret key for cookies signature. If a non-empty secret has been set, the cookie will be signed.
  • unsign Boolean: Unsign the request cookies automatically if a secret key is given. You can manually unsign the cookie by invoking request.unsign() if this option is set to false. Default is false.
  • parseOptions Object: The options for cookie.parse().
  • decorator Object: Customize the decorator names. Default is:
{
  reqGetCookie: 'cookies',
  unsignCookie: 'unsign',
  resSetCookie: 'cookie',
  resSetCookies: 'cookies'
}

For more options, please check cookie.

Some has default values:

  • httpOnly: true

Api

  • request.cookies: The parsed request cookies.
  • request.unsign(key: String, secret?: String): Unsign the given cookie pair. The secret passed here will override the plugin secret.
  • response.cookie(key: String, value: String, options?: Object): Set a single cookie pair. The options passed here will override the plugin options.
  • response.cookies(cookies: Object, options?: Object): Set a set of cookie pairs. The options passed here will override the plugin options.

License

MIT

Keywords

cookie

FAQs

Package last updated on 18 Aug 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.