Skip to content

Commit

Permalink
test: minor refactoring of onticketkeycallback
Browse files Browse the repository at this point in the history
The motivation for this commit is to make the the onticketkeycallback
function more readable.

PR-URL: #24718
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
danbev authored and BridgeAR committed Dec 5, 2018
1 parent 540929d commit 026e03c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/parallel/test-https-resume-after-renew.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ const hmac = Buffer.alloc(16, 'H');

server._sharedCreds.context.enableTicketKeyCallback();
server._sharedCreds.context.onticketkeycallback = function(name, iv, enc) {
let newName, newIV;
if (enc) {
newName = Buffer.alloc(16, 'A');
newIV = crypto.randomBytes(16);
} else {
// Renew
return [ 2, hmac, aes ];
const newName = Buffer.alloc(16, 'A');
const newIV = crypto.randomBytes(16);
return [ 1, hmac, aes, newName, newIV ];
}

return [ 1, hmac, aes, newName, newIV ];
// Renew
return [ 2, hmac, aes ];
};

server.listen(0, function() {
Expand Down

0 comments on commit 026e03c

Please sign in to comment.