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

@elysiajs/cookie

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elysiajs/cookie - npm Package Compare versions

Comparing version 0.1.0-rc.7 to 0.1.0-rc.8

10

dist/index.js
import { serialize, parse } from 'cookie';
import { sign } from 'cookie-signature';
const unsign = (input, secret) => {
if (secret === null)
throw new TypeError('Secret key must be provided');
if (!input)
return false;
const value = input.slice(0, input.lastIndexOf('.'));
return sign(value, secret) === input ? value : false;
};
import { sign, unsign } from 'cookie-signature';
export const cookie = ({ signed, secret: secretKey, ...defaultOptions } = {}) => (app) => {

@@ -12,0 +4,0 @@ const secret = !secretKey

2

package.json
{
"name": "@elysiajs/cookie",
"version": "0.1.0-rc.7",
"version": "0.1.0-rc.8",
"description": "Plugin for Elysia that add supports for get/set cookie",

@@ -5,0 +5,0 @@ "author": {

import type { Elysia, Handler } from 'elysia'
import { serialize, parse, type CookieSerializeOptions } from 'cookie'
import { sign } from 'cookie-signature'
import { sign, unsign } from 'cookie-signature'

@@ -29,13 +29,2 @@ export interface SetCookieOptions extends CookieSerializeOptions {

// ? Bun doesn't support `crypto.timingSafeEqual` yet, using string equality instead
// Temporary fix until native support
const unsign = (input: string, secret: string | null) => {
if (secret === null) throw new TypeError('Secret key must be provided')
if (!input) return false
const value = input.slice(0, input.lastIndexOf('.'))
return sign(value, secret) === input ? value : false
}
export const cookie =

@@ -42,0 +31,0 @@ ({ signed, secret: secretKey, ...defaultOptions }: CookieOptions = {}) =>

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