Fixed regressions of b0cd246 and 3128fdf

3128fdf:
- Secret can be a string or function
- Compatibility with older node versions

b0cd246:
- Fixed dependencies
This commit is contained in:
Fabian Arndt
2019-10-08 18:56:18 +02:00
parent 3128fdfee2
commit 3f980a5c71
2 changed files with 6 additions and 6 deletions

View File

@ -111,9 +111,9 @@ function noQsMethod(options) {
function authorize(options, onConnection) {
options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options);
if (typeof options.secret !== 'string') {
throw new Error(`Provided secret "${options.secret}" is invalid, must be of type string.`)
if (typeof options.secret !== 'string' && typeof options.secret !== 'function') {
throw new Error('Provided secret "' + options.secret + '" is invalid, must be of type string or function.')
}
if (!options.handshake) {