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

svelte-kit-sessions

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-kit-sessions - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "svelte-kit-sessions",
"description": "User-friendly session management module for SvelteKit. Effortlessly integrate efficient session handling into your projects. Session is stored in the store (ex. Redis, Cloudflare KV, etc.), not in a cookie.",
"version": "0.2.0",
"version": "0.2.1",
"author": "yutak23 <yuta.katayama.23+github@gmail.com> (https://github.com/yutak23)",

@@ -6,0 +6,0 @@ "repository": {

@@ -34,2 +34,4 @@ # svelte-kit-sessions

`svelte-kit-sessions` stores session data in a store, so a store is need (Store is optional and defaults to [_MemoryStore_](https://github.com/yutak23/svelte-kit-sessions/blob/main/src/lib/memory-store.ts) if omitted). You can find a list of compatible stores at [Compatible Session Stores](#compatible-session-stores).
```ts

@@ -39,4 +41,14 @@ // src/hooks.server.ts

import { sveltekitSessionHandle } from 'svelte-kit-sessions';
import RedisStore from 'svelte-kit-connect-redis';
import { Redis } from 'ioredis';
export const handle: Handle = sveltekitSessionHandle({ secret: 'secret' });
const client = new Redis({
host: '{your redis host}',
port: 6379
});
export const handle: Handle = sveltekitSessionHandle({
secret: 'secret',
store: new RedisStore({ client }) // other compatible stores are available
});
```

@@ -51,3 +63,10 @@

import { sveltekitSessionHandle } from 'svelte-kit-sessions';
import RedisStore from 'svelte-kit-connect-redis';
import { Redis } from 'ioredis';
const client = new Redis({
host: '{your redis host}',
port: 6379
});
const yourOwnHandle: Handle = async ({ event, resolve }) => {

@@ -60,3 +79,6 @@ // `event.locals.session` is available

export const handle: Handle = sequence(sveltekitSessionHandle({ secret: 'secret' }), yourOwnHandle);
export const handle: Handle = sequence(
sveltekitSessionHandle({ secret: 'secret', store: new RedisStore({ client }) }),
yourOwnHandle
);
```

@@ -266,3 +288,3 @@

| rolling | boolean | _optional_ | Force the session identifier cookie to be set on every response. The default value is `false`. If `cookie.maxAge` is not set, this option is ignored. |
| store | [Store](https://github.com/yutak23/svelte-kit-sessions/blob/main/src/lib/index.ts#L120) | _optional_ | The session store instance. The default value is `MemoryStore` instance. |
| store | [Store](https://github.com/yutak23/svelte-kit-sessions/blob/main/src/lib/index.ts#L120) | _optional_ | The session store instance. The default value is [_MemoryStore_](https://github.com/yutak23/svelte-kit-sessions/blob/main/src/lib/memory-store.ts) instance. |
| secret | string \| string[] | _required_ | This is the secret used to sign the session cookie. |

@@ -370,3 +392,3 @@ | saveUninitialized | boolean | _optional_ | Forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified. The default value is `false`. |

The session store instance. The default value is new `MemoryStore` instance.
The session store instance. The default value is `MemoryStore` instance.

@@ -373,0 +395,0 @@ **Note** See the chapter [Session Store Implementation](#session-store-implementation) for more information on the store.

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