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

github.com/omar2205/squishy_cookies

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/omar2205/squishy_cookies

  • v0.2.4
  • Source
  • Go
  • Socket score

Version published
Created
Source

Squishy Cookies 🍪

Easily sign and verify cookies.

Be Careful out there, there are alpha software out there with no guarantee.

Usage

import {
  cookieSign, cookieVerify
  createSignedCookie, verifySignedCookie,
} from 'mod.ts'

const cookie = await cookieSign('hello', 'super_secret')
// hello.gsSaKanhysk-CuNkIJhUWsHItAOcFZbrNNTa95qCfAE.

await cookieVerify('hello.gsSaKanhysk-CuNkIJhUWsHItAOcFZbrNNTa95qCfAE.', 'super_secret')
// true



const { headers, cookie } = await createSignedCookie(
    'id', '1', 'super_secret',
    { httpOnly: true, path: '/' }
)
return new Response(page, { headers })

// or

const headers = new Headers()
headers.append('set-cookie', cookie)


// Verifying a cookie

headers.append('cookie', cookie) // verifySignedCookie will search for 'cookie' header
const userId = await verifySignedCookie(headers, 'id', 'super_secret')
// userId is false if the verification failed or the cookie value

FAQs

Package last updated on 26 Aug 2022

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