@@ -96,7 +96,7 @@ test('register', function (t) {
96
96
t . plan ( 1 )
97
97
const fastify = Fastify ( )
98
98
fastify . register ( jwt , {
99
- secret : ( request , token , callback ) => { callback ( null , Buffer . from ( 'some secret' , 'base64' ) ) }
99
+ secret : ( _request , _token , callback ) => { callback ( null , Buffer . from ( 'some secret' , 'base64' ) ) }
100
100
} ) . ready ( function ( error ) {
101
101
t . error ( error )
102
102
} )
@@ -106,7 +106,7 @@ test('register', function (t) {
106
106
t . plan ( 1 )
107
107
const fastify = Fastify ( )
108
108
fastify . register ( jwt , {
109
- secret : ( request , token ) => Promise . resolve ( Buffer . from ( 'some secret' , 'base64' ) )
109
+ secret : ( ) => Promise . resolve ( Buffer . from ( 'some secret' , 'base64' ) )
110
110
} ) . ready ( function ( error ) {
111
111
t . error ( error )
112
112
} )
@@ -116,7 +116,7 @@ test('register', function (t) {
116
116
t . plan ( 1 )
117
117
const fastify = Fastify ( )
118
118
fastify . register ( jwt , {
119
- secret : async ( request , token ) => Buffer . from ( 'some secret' , 'base64' )
119
+ secret : async ( ) => Buffer . from ( 'some secret' , 'base64' )
120
120
} ) . ready ( function ( error ) {
121
121
t . error ( error )
122
122
} )
@@ -263,7 +263,7 @@ test('register', function (t) {
263
263
return reply . send ( { token } )
264
264
} )
265
265
266
- fastify . get ( '/verify' , function ( request , reply ) {
266
+ fastify . get ( '/verify' , function ( request ) {
267
267
return request . jwtVerify ( )
268
268
} )
269
269
@@ -290,37 +290,37 @@ test('register', function (t) {
290
290
}
291
291
292
292
t . test ( 'secret as a function with callback' , t => {
293
- return runWithSecret ( t , function ( request , token , callback ) {
293
+ return runWithSecret ( t , function ( _request , _token , callback ) {
294
294
callback ( null , 'some-secret' )
295
295
} )
296
296
} )
297
297
298
298
t . test ( 'secret as a function returning a promise' , t => {
299
- return runWithSecret ( t , function ( request , token ) {
299
+ return runWithSecret ( t , function ( ) {
300
300
return Promise . resolve ( 'some-secret' )
301
301
} )
302
302
} )
303
303
304
304
t . test ( 'secret as an async function' , t => {
305
- return runWithSecret ( t , async function ( request , token ) {
305
+ return runWithSecret ( t , async function ( ) {
306
306
return 'some-secret'
307
307
} )
308
308
} )
309
309
310
310
t . test ( 'secret as a function with callback returning a Buffer' , t => {
311
- return runWithSecret ( t , function ( request , token , callback ) {
311
+ return runWithSecret ( t , function ( _request , _token , callback ) {
312
312
callback ( null , Buffer . from ( 'some-secret' , 'base64' ) )
313
313
} )
314
314
} )
315
315
316
316
t . test ( 'secret as a function returning a promise with a Buffer' , t => {
317
- return runWithSecret ( t , function ( request , token ) {
317
+ return runWithSecret ( t , function ( ) {
318
318
return Promise . resolve ( Buffer . from ( 'some secret' , 'base64' ) )
319
319
} )
320
320
} )
321
321
322
322
t . test ( 'secret as an async function returning a Buffer' , t => {
323
- return runWithSecret ( t , async function ( request , token ) {
323
+ return runWithSecret ( t , async function ( ) {
324
324
return Buffer . from ( 'some secret' , 'base64' )
325
325
} )
326
326
} )
@@ -386,7 +386,7 @@ test('sign and verify with HS-secret', function (t) {
386
386
} )
387
387
} )
388
388
389
- fastify . get ( '/verifySync' , function ( request , reply ) {
389
+ fastify . get ( '/verifySync' , function ( request ) {
390
390
return request . jwtVerify ( )
391
391
} )
392
392
@@ -554,7 +554,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
554
554
t . plan ( 4 )
555
555
556
556
try {
557
- fastifyVerifier . jwt . sign ( { foo : 'baz' } , function ( error , token ) {
557
+ fastifyVerifier . jwt . sign ( { foo : 'baz' } , function ( error ) {
558
558
// as for now, verifier-only error is not propagated here
559
559
t . error ( 'SHOULD NOT BE HERE' )
560
560
t . error ( error )
@@ -594,7 +594,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
594
594
} )
595
595
} )
596
596
597
- fastify . get ( '/verifySync' , function ( request , reply ) {
597
+ fastify . get ( '/verifySync' , function ( request ) {
598
598
return request . jwtVerify ( )
599
599
} )
600
600
@@ -692,7 +692,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
692
692
} )
693
693
} )
694
694
695
- fastifyVerifier . get ( '/verifySync' , function ( request , reply ) {
695
+ fastifyVerifier . get ( '/verifySync' , function ( request ) {
696
696
return request . jwtVerify ( )
697
697
} )
698
698
@@ -807,7 +807,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
807
807
} )
808
808
} )
809
809
810
- fastify . get ( '/verifySync' , function ( request , reply ) {
810
+ fastify . get ( '/verifySync' , function ( request ) {
811
811
return request . jwtVerify ( )
812
812
} )
813
813
@@ -962,7 +962,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
962
962
} )
963
963
} )
964
964
965
- fastify . get ( '/verifySync' , function ( request , reply ) {
965
+ fastify . get ( '/verifySync' , function ( request ) {
966
966
return request . jwtVerify ( )
967
967
} )
968
968
@@ -1117,7 +1117,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
1117
1117
} )
1118
1118
} )
1119
1119
1120
- fastify . get ( '/verifySync' , function ( request , reply ) {
1120
+ fastify . get ( '/verifySync' , function ( request ) {
1121
1121
return request . jwtVerify ( )
1122
1122
} )
1123
1123
@@ -1276,7 +1276,7 @@ test('sign and verify with RSA/ECDSA certificates and global options', function
1276
1276
} )
1277
1277
} )
1278
1278
1279
- fastify . get ( '/verifySync' , function ( request , reply ) {
1279
+ fastify . get ( '/verifySync' , function ( request ) {
1280
1280
return request . jwtVerify ( )
1281
1281
} )
1282
1282
@@ -1361,7 +1361,7 @@ test('sign and verify with trusted token', function (t) {
1361
1361
t . plan ( 2 )
1362
1362
1363
1363
const f = Fastify ( )
1364
- f . register ( jwt , { secret : 'test' , trusted : ( request , { jti } ) => jti !== 'untrusted' } )
1364
+ f . register ( jwt , { secret : 'test' , trusted : ( _request , { jti } ) => jti !== 'untrusted' } )
1365
1365
f . get ( '/' , ( request , reply ) => {
1366
1366
request . jwtVerify ( )
1367
1367
. then ( function ( decodedToken ) {
@@ -1391,7 +1391,7 @@ test('sign and verify with trusted token', function (t) {
1391
1391
t . plan ( 2 )
1392
1392
1393
1393
const f = Fastify ( )
1394
- f . register ( jwt , { secret : 'test' , trusted : ( request , { jti } ) => Promise . resolve ( jti !== 'untrusted' ) } )
1394
+ f . register ( jwt , { secret : 'test' , trusted : ( _request , { jti } ) => Promise . resolve ( jti !== 'untrusted' ) } )
1395
1395
f . get ( '/' , ( request , reply ) => {
1396
1396
request . jwtVerify ( )
1397
1397
. then ( function ( decodedToken ) {
@@ -1503,7 +1503,7 @@ test('errors', function (t) {
1503
1503
const fastify = Fastify ( )
1504
1504
fastify . register ( jwt , {
1505
1505
secret : 'test' ,
1506
- trusted : ( request , { jti } ) => jti !== 'untrusted' ,
1506
+ trusted : ( _request , { jti } ) => jti !== 'untrusted' ,
1507
1507
decode : { checkTyp : 'JWT' }
1508
1508
} )
1509
1509
@@ -1747,7 +1747,7 @@ test('errors', function (t) {
1747
1747
t . plan ( 2 )
1748
1748
1749
1749
const f = Fastify ( )
1750
- f . register ( jwt , { secret : 'test' , trusted : ( request , { jti } ) => Promise . resolve ( jti !== 'untrusted' ) } )
1750
+ f . register ( jwt , { secret : 'test' , trusted : ( _request , { jti } ) => Promise . resolve ( jti !== 'untrusted' ) } )
1751
1751
f . get ( '/' , ( request , reply ) => {
1752
1752
request . jwtVerify ( )
1753
1753
. then ( function ( decodedToken ) {
@@ -2353,7 +2353,7 @@ test('custom response messages', function (t) {
2353
2353
t . plan ( 6 )
2354
2354
2355
2355
const fastify = Fastify ( )
2356
- fastify . register ( jwt , { secret : 'test' , messages : { noAuthorizationInHeaderMessage : 'auth header missing' , authorizationTokenExpiredMessage : 'token expired' , authorizationTokenInvalid : 'invalid token' , authorizationTokenUntrusted : 'untrusted token' , authorizationTokenUnsigned : 'unsigned token' } , trusted : ( request , { jti } ) => jti !== 'untrusted' } )
2356
+ fastify . register ( jwt , { secret : 'test' , messages : { noAuthorizationInHeaderMessage : 'auth header missing' , authorizationTokenExpiredMessage : 'token expired' , authorizationTokenInvalid : 'invalid token' , authorizationTokenUntrusted : 'untrusted token' , authorizationTokenUnsigned : 'unsigned token' } , trusted : ( _request , { jti } ) => jti !== 'untrusted' } )
2357
2357
2358
2358
fastify . get ( '/verify' , function ( request , reply ) {
2359
2359
request . jwtVerify ( )
0 commit comments