Skip to content

Commit 13ff45f

Browse files
committed
Rename cookies
1 parent 9688ee6 commit 13ff45f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

server/encrypted-session.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ export const ENCRYPTED_COOKIE_REQUEST_DECORATOR = 'encryptedSessionInternal';
1313
export const UNDERLYING_SESSION_NAME_REQUEST_DECORATOR = 'underlyingSessionNotPerUserEncrypted';
1414

1515
// name of the secure-session cookie that stores the encryption key on user side.
16-
export const ENCRYPTION_KEY_COOKIE_NAME = 'session_encryption_key';
16+
export const ENCRYPTION_KEY_COOKIE_NAME = 'session-encryption-key';
1717
// the key used to store the encryption key in the secure-session cookie on user side.
1818
export const ENCRYPTED_COOKIE_KEY_ENCRYPTION_KEY = 'encryptionKey';
1919
// name of the cookie that stores the session identifier on user side.
20-
export const SESSION_COOKIE_NAME = 'session-cookie';
20+
export const SESSION_COOKIE_NAME = 'session';
2121

2222
async function encryptedSession(fastify) {
2323
const { COOKIE_SECRET, SESSION_SECRET } = fastify.config;
@@ -31,7 +31,7 @@ async function encryptedSession(fastify) {
3131
cookie: {
3232
path: '/',
3333
httpOnly: true,
34-
sameSite: "None", // cross-site cookies are needed for the session to work when embedded. By setting CORS to None and CSP.frame-anchestors we restrict the api calls from the browser that contain the cookies to originating from our site only.
34+
sameSite: 'None', // cross-site cookies are needed for the session to work when embedded. By setting CORS to None and CSP.frame-anchestors we restrict the api calls from the browser that contain the cookies to originating from our site only.
3535
partitioned: true, // use for modern isolation of third party cookies when embedded, every embedded iframe (or not embedded) gets its own cookie partition
3636
secure: true,
3737
maxAge: 60 * 60 * 24 * 7, // 7 days
@@ -44,7 +44,7 @@ async function encryptedSession(fastify) {
4444
cookie: {
4545
path: '/',
4646
httpOnly: true,
47-
sameSite: "None", // see secureSession cookie for explanation
47+
sameSite: 'None', // see secureSession cookie for explanation
4848
partitioned: true, // see secureSession cookie for explanation
4949
secure: true,
5050
maxAge: 60 * 60 * 24 * 7, // 7 days
@@ -54,7 +54,7 @@ async function encryptedSession(fastify) {
5454
await fastify.decorateRequest(REQUEST_DECORATOR, {
5555
getter() {
5656
return createStore(this);
57-
}
57+
},
5858
});
5959
}
6060

@@ -105,21 +105,21 @@ function createStore(request) {
105105
return {
106106
async set(key, value) {
107107
unencryptedStore[key] = value;
108-
await save()
108+
await save();
109109
},
110110
get(key) {
111111
return unencryptedStore[key];
112112
},
113113
async delete(key) {
114114
delete unencryptedStore[key];
115-
await save()
115+
await save();
116116
},
117117
print() {
118-
console.log("printing", unencryptedStore)
118+
console.log('printing', unencryptedStore);
119119
},
120120
async clear() {
121121
unencryptedStore = {}; // Clear all data
122-
await save()
122+
await save();
123123
},
124124
};
125125
}

0 commit comments

Comments
 (0)