@@ -101,7 +101,7 @@ function session(options) {
101
101
var saveUninitializedSession = opts . saveUninitialized
102
102
103
103
// get the cookie signing secret
104
- var secret = opts . secret
104
+ var secrets = opts . secret
105
105
106
106
if ( typeof generateId !== 'function' ) {
107
107
throw new TypeError ( 'genid option must be a function' ) ;
@@ -124,16 +124,16 @@ function session(options) {
124
124
// TODO: switch to "destroy" on next major
125
125
var unsetDestroy = opts . unset === 'destroy'
126
126
127
- if ( Array . isArray ( secret ) && secret . length === 0 ) {
127
+ if ( Array . isArray ( secrets ) && secrets . length === 0 ) {
128
128
throw new TypeError ( 'secret option array must contain one or more strings' ) ;
129
129
}
130
130
131
- if ( secret && ! Array . isArray ( secret ) ) {
132
- secret = [ secret ] ;
131
+ if ( secrets && ! Array . isArray ( secrets ) ) {
132
+ secrets = [ secrets ] ;
133
133
}
134
134
135
- if ( ! secret ) {
136
- deprecate ( 'req. secret; provide secret option ') ;
135
+ if ( ! secrets ) {
136
+ throw new Error ( ' secret option required for sessions ') ;
137
137
}
138
138
139
139
// notify user that this store is not
@@ -188,16 +188,6 @@ function session(options) {
188
188
return
189
189
}
190
190
191
- // ensure a secret is available or bail
192
- if ( ! secret && ! req . secret ) {
193
- next ( new Error ( 'secret option required for sessions' ) ) ;
194
- return ;
195
- }
196
-
197
- // backwards compatibility for signed cookies
198
- // req.secret is passed from the cookie parser middleware
199
- var secrets = secret || [ req . secret ] ;
200
-
201
191
var originalHash ;
202
192
var originalId ;
203
193
var savedHash ;
0 commit comments