Skip to content

Commit e0bbb61

Browse files
committed
feat: remove compatibility with cookie parser
1 parent 4537773 commit e0bbb61

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

index.js

+6-16
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function session(options) {
112112
var saveUninitializedSession = opts.saveUninitialized
113113

114114
// get the cookie signing secret
115-
var secret = opts.secret
115+
var secrets = opts.secret
116116

117117
if (typeof generateId !== 'function') {
118118
throw new TypeError('genid option must be a function');
@@ -135,16 +135,16 @@ function session(options) {
135135
// TODO: switch to "destroy" on next major
136136
var unsetDestroy = opts.unset === 'destroy'
137137

138-
if (Array.isArray(secret) && secret.length === 0) {
138+
if (Array.isArray(secrets) && secrets.length === 0) {
139139
throw new TypeError('secret option array must contain one or more strings');
140140
}
141141

142-
if (secret && !Array.isArray(secret)) {
143-
secret = [secret];
142+
if (secrets && !Array.isArray(secrets)) {
143+
secrets = [secrets];
144144
}
145145

146-
if (secret === undefined) {
147-
throw new Error('secret is required for sessions');
146+
if (secrets === undefined) {
147+
throw new Error('secret option required for sessions');
148148
}
149149

150150
// notify user that this store is not
@@ -199,16 +199,6 @@ function session(options) {
199199
return
200200
}
201201

202-
// ensure a secret is available or bail
203-
if (!secret && !req.secret) {
204-
next(new Error('secret option required for sessions'));
205-
return;
206-
}
207-
208-
// backwards compatibility for signed cookies
209-
// req.secret is passed from the cookie parser middleware
210-
var secrets = secret;
211-
212202
var originalHash;
213203
var originalId;
214204
var savedHash;

0 commit comments

Comments
 (0)