Skip to content

Commit b4c2230

Browse files
JWT Refactoring, version 1.0.12
1 parent f8c480f commit b4c2230

File tree

4 files changed

+7
-37
lines changed

4 files changed

+7
-37
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uquik",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"description": "uQuik HTTP(S) framework",
55
"main": "index.js",
66
"scripts": {

src/JWT.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function convertToMs (time) {
5050
return parse(time)
5151
}
5252

53-
function JWT (context, options = {}) {
53+
function JWT (options = {}) {
5454
if (!options.secret) {
5555
throw new Error('Missing secret')
5656
}
@@ -59,14 +59,10 @@ function JWT (context, options = {}) {
5959
cookie,
6060
decode: decodeOptions = {},
6161
formatUser,
62-
jwtDecode,
63-
jwtSign,
64-
jwtVerify,
6562
secret,
6663
sign: initialSignOptions = {},
6764
trusted,
68-
verify: initialVerifyOptions = {},
69-
namespace
65+
verify: initialVerifyOptions = {}
7066
} = options
7167

7268
let secretOrPrivateKey
@@ -114,15 +110,9 @@ function JWT (context, options = {}) {
114110
throw new Error('ECDSA Signatures set as Algorithm in the options require a private and public key to be set as the secret')
115111
}
116112

117-
let jwtDecodeName = 'jwtDecode'
118-
let jwtVerifyName = 'jwtVerify'
119-
let jwtSignName = 'jwtSign'
120-
121-
if (namespace) {
122-
jwtDecodeName = jwtDecode ? (typeof jwtDecode === 'string' ? jwtDecode : 'jwtDecode') : `${namespace}JwtDecode`
123-
jwtVerifyName = jwtVerify || `${namespace}JwtVerify`
124-
jwtSignName = jwtSign || `${namespace}JwtSign`
125-
}
113+
const jwtDecodeName = 'jwtDecode'
114+
const jwtVerifyName = 'jwtVerify'
115+
const jwtSignName = 'jwtSign'
126116

127117
const signerConfig = checkAndMergeSignOptions()
128118
const signer = createSigner(signerConfig.options)

src/Server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class Server extends Router {
295295
const jwtOptions = record.options.get('jwt')
296296

297297
if (typeof jwtOptions === 'object') {
298-
const [requestVerifier, responseSigner] = JWT(this, jwtOptions)
298+
const [requestVerifier, responseSigner] = JWT(jwtOptions)
299299
route.setRequestDecorator(requestVerifier)
300300
route.setResponseDecorator(responseSigner)
301301
}

test.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)