This repository was archived by the owner on Mar 4, 2024. It is now read-only.
Refactor library - #3
Merged
Merged
Conversation
esarafianou
force-pushed
the
fixCrypto
branch
from
October 28, 2018 23:33
441d946 to
12aede3
Compare
gkwang
approved these changes
Oct 30, 2018
gkwang
left a comment
There was a problem hiding this comment.
Some nit comments; looks good otherwise. Merge at will.
| }); | ||
| exports.decrypt = function(secret, ciphertext, iv, authTag) { | ||
| try { | ||
| var decipher = crypto.createDecipheriv('aes-256-gcm', secret , Buffer.from(iv, 'hex')); |
| }); | ||
| }; | ||
| } | ||
| var splited = exports.split(str) |
added 2 commits
October 30, 2018 07:58
esarafianou
force-pushed
the
fixCrypto
branch
from
October 30, 2018 14:59
12aede3 to
f4f4de4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes bugs introduced in #2 and adds one more feature as option.
Highlights
The middleware now overrides
res.writeHeadsas the initial version did. This is needed, because the middleware must be re-triggered after the user has added some data inreq.sessionin order for the new cookie to be set.It no longer uses
auth0-magic, because all exported functions are asynchronous whereasres.writeHeadscannot work in an asynchronous mode. Theaes-256-gcmmode of the nodecryptolibrary is now used.The new feature introduced is the
autoRenewoption. If set to true, a new cookie will be set in each response with an updated expiration date (Date.now() + timeout). If set to false, the expiration date will be set only the first time data are added toreq.session.Lowlights