Skip to content

Commit

Permalink
use conform hkdf
Browse files Browse the repository at this point in the history
  • Loading branch information
panva authored and joshcanhelp committed Jan 3, 2020
1 parent b6cd035 commit dc2be1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/session.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { createHmac } = require('crypto');
const { strict: assert } = require('assert');

const { JWK, JWKS, JWE } = require('jose');
const onHeaders = require('on-headers');
const cookie = require('cookie');
const hkdf = require('futoin-hkdf');

const deriveKey = (secret) => createHmac('sha256', secret).update('encryption').digest();
const deriveKey = (secret) => hkdf(secret, 32, { info: 'JWE CEK', hash: 'SHA-256' });
const epoch = () => Date.now() / 1000 | 0;

module.exports = ({ cookieName, propertyName, secret, duration, ephemeral, cookieOptions = {} }) => {
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"clone": "^2.1.2",
"cookie": "^0.4.0",
"cookie-parser": "^1.4.4",
"futoin-hkdf": "^1.2.1",
"http-errors": "^1.7.3",
"jose": "^1.17.2",
"on-headers": "^1.0.2",
Expand Down

0 comments on commit dc2be1a

Please sign in to comment.