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

hyper-ts-session

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyper-ts-session - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [0.3.0](https://github.com/thewilkybarkid/hyper-ts-session/compare/v0.2.0...v0.3.0) (2023-03-06)
### Features
* allow the cookie name to be changed ([be3344c](https://github.com/thewilkybarkid/hyper-ts-session/commit/be3344c86e900170278d4a7ba0a1b37c423cd161))
## [0.2.0](https://github.com/thewilkybarkid/hyper-ts-session/compare/v0.1.3...v0.2.0) (2023-01-17)

@@ -7,0 +14,0 @@

1

dist/index.d.ts

@@ -13,2 +13,3 @@ import * as J from 'fp-ts/Json';

secret: string;
sessionCookie: string;
sessionStore: Keyv<JsonRecord>;

@@ -15,0 +16,0 @@ }

8

dist/index.js

@@ -82,5 +82,5 @@ "use strict";

function endSession() {
return (0, function_1.pipe)(RM.clearCookie('session', {
return (0, function_1.pipe)(RM.ask(), RM.chain(({ sessionCookie }) => RM.clearCookie(sessionCookie !== null && sessionCookie !== void 0 ? sessionCookie : 'session', {
httpOnly: true,
}), RM.chain(() => currentSessionId()), RM.chainReaderTaskEitherKW(deleteSession), RM.orElseW(error => (error === 'no-session' ? RM.right(undefined) : RM.left(error))));
})), RM.chain(() => currentSessionId()), RM.chainReaderTaskEitherKW(deleteSession), RM.orElseW(error => (error === 'no-session' ? RM.right(undefined) : RM.left(error))));
}

@@ -92,6 +92,6 @@ exports.endSession = endSession;

function currentSessionId() {
return (0, function_1.pipe)(RM.ask(), RM.chainMiddlewareK(({ secret }) => (0, function_1.pipe)(getCookie('session'), M.chainEitherKW(E.fromNullableK(() => 'no-session')(value => cookie_signature_1.default.unsign(value, secret) || null)), M.filterOrElseW(UUID.isUuid, () => 'no-session'), M.mapLeft(() => 'no-session'))));
return (0, function_1.pipe)(RM.ask(), RM.chainMiddlewareK(({ sessionCookie, secret }) => (0, function_1.pipe)(getCookie(sessionCookie), M.chainEitherKW(E.fromNullableK(() => 'no-session')(value => cookie_signature_1.default.unsign(value, secret) || null)), M.filterOrElseW(UUID.isUuid, () => 'no-session'), M.mapLeft(() => 'no-session'))));
}
function newSession() {
return (0, function_1.pipe)(RM.ask(), RM.chainMiddlewareK(({ secret }) => (0, function_1.pipe)(M.rightIO(UUID.v4()), M.chainFirst(sessionId => M.cookie('session', cookie_signature_1.default.sign(sessionId, secret), {
return (0, function_1.pipe)(RM.ask(), RM.chainMiddlewareK(({ sessionCookie, secret }) => (0, function_1.pipe)(M.rightIO(UUID.v4()), M.chainFirst(sessionId => M.cookie(sessionCookie, cookie_signature_1.default.sign(sessionId, secret), {
httpOnly: true,

@@ -98,0 +98,0 @@ })))));

{
"name": "hyper-ts-session",
"description": "hyper-ts middleware for sessions.",
"version": "0.2.0",
"version": "0.3.0",
"license": "MIT",

@@ -26,2 +26,3 @@ "homepage": "https://github.com/thewilkybarkid/hyper-ts-session",

"@commitlint/config-conventional": "^17.0.0",
"@fast-check/jest": "^1.6.0",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",

@@ -32,3 +33,2 @@ "@tsconfig/recommended": "^1.0.1",

"@types/express": "^4.17.13",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.35",

@@ -44,3 +44,2 @@ "@typescript-eslint/eslint-plugin": "^5.25.0",

"expect-type": "^0.13.0",
"fast-check": "^2.25.0",
"fp-ts": "^2.12.1",

@@ -51,3 +50,3 @@ "fp-ts-contrib": "^0.1.29",

"io-ts": "^2.2.16",
"jest": "^28.1.0",
"jest": "^29.5.0",
"keyv": "^4.2.9",

@@ -58,3 +57,3 @@ "node-mocks-http": "^1.11.0",

"standard-version": "^9.5.0",
"ts-jest": "^28.0.2",
"ts-jest": "^29.0.5",
"typescript": "^4.6.4"

@@ -61,0 +60,0 @@ },

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