@fastify/secure-session
Advanced tools
Comparing version 7.0.0 to 7.1.0
@@ -301,2 +301,6 @@ 'use strict' | ||
} | ||
touch () { | ||
this.changed = true | ||
} | ||
} | ||
@@ -303,0 +307,0 @@ |
{ | ||
"name": "@fastify/secure-session", | ||
"version": "7.0.0", | ||
"version": "7.1.0", | ||
"description": "Create a secure stateless cookie session for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -80,2 +80,11 @@ # @fastify/secure-session | ||
fastify.get('/ping', (request, reply) => { | ||
request.session.options({maxAge: 3600}) | ||
// Send the session cookie to the client even if the session data didn't change | ||
// can be used to update cookie expiration | ||
request.session.touch() | ||
reply.send('pong') | ||
}) | ||
fastify.post('/logout', (request, reply) => { | ||
@@ -207,3 +216,3 @@ request.session.delete() | ||
fastify.register(require('@fastify/secure-session'), { | ||
key: [mySecureKey] | ||
key: [mySecureKey], | ||
@@ -224,3 +233,3 @@ cookie: { | ||
fastify.register(require('@fastify/secure-session'), { | ||
key: [myNewKey, mySecureKey] | ||
key: [myNewKey, mySecureKey], | ||
@@ -227,0 +236,0 @@ cookie: { |
@@ -29,2 +29,3 @@ /// <reference types="node" /> | ||
options(opts: CookieSerializeOptions): void; | ||
touch(): void; | ||
} | ||
@@ -31,0 +32,0 @@ |
@@ -46,2 +46,3 @@ import SecureSessionPlugin, { Session, SessionData } from ".."; | ||
request.session.options({ maxAge: 42 }) | ||
request.session.touch(); | ||
@@ -53,2 +54,3 @@ request.foo.set("foo", "bar"); | ||
request.foo.options({ maxAge: 42 }); | ||
request.foo.touch(); | ||
}); | ||
@@ -55,0 +57,0 @@ |
71091
30
1864
375