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 BethGriggs committed Feb 12, 2019
1 parent c0423cf commit 31c1ee4
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 31c1ee4

Please sign in to comment.