Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-drupal7-session-middleware

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-drupal7-session-middleware - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

lib/utils.js

12

lib/CSRFToken.js

@@ -10,6 +10,6 @@ "use strict";

var _crypto = _interopRequireDefault(require("crypto"));
var _knex = _interopRequireDefault(require("knex"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -57,8 +57,4 @@

const key = `${sessionId}${privateKey}${hashSalt}`;
const token = _crypto.default.createHmac('sha256', key).update(value).digest().toString('base64');
return token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
return (0, _utils.createDrupalToken)(sessionId, privateKey, hashSalt, value);
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9DU1JGVG9rZW4uanMiXSwibmFtZXMiOlsicHJpdmF0ZUtleSIsImdldENTUkZUb2tlbiIsImtuZXgiLCJzZXNzaW9uSWQiLCJoYXNoU2FsdCIsInZhbHVlIiwibGVuZ3RoIiwicmVzdWx0cyIsInJhdyIsImVycm9yIiwiY29uc29sZSIsImxvZyIsIlBIUFVuc2VyaWFsaXplIiwidW5zZXJpYWxpemUiLCJrZXkiLCJ0b2tlbiIsImNyeXB0byIsImNyZWF0ZUhtYWMiLCJ1cGRhdGUiLCJkaWdlc3QiLCJ0b1N0cmluZyIsInJlcGxhY2UiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7QUFDQTs7QUFDQTs7OztBQUVBLElBQUlBLFVBQVUsR0FBRyxFQUFqQjtBQUVBOzs7Ozs7OztBQU9lLGVBQWVDLFlBQWYsQ0FBNEJDLElBQTVCLEVBQWtDQyxTQUFsQyxFQUE2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drupal7-session-middleware",
"version": "1.0.2",
"version": "1.0.3",
"description": "Express middleware to retrieve a user session from a drupal 7 cookie",

@@ -29,8 +29,8 @@ "repository": "git@github.com:rawpixel1/express-drupal7-session-middleware.git",

"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.14.2",
"eslint-plugin-react": "^7.14.3",
"knex": "^0.17.6",
"mocha": "^6.1.4",
"mocha": "^6.2.0",
"prettier": "^1.18.2"

@@ -37,0 +37,0 @@ },

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { createDrupalToken } from '../src/utils';
describe('1 = 1', () => {
it('work', () => {
expect(1).to.eql(1);
describe('CSRF Token', () => {
it('create a valid Drupal token', () => {
expect(createDrupalToken('PHC0SZ6jHa_fOrBa55M8y4C3-gK29GHIG8gKVU1lU4s', 'sdfweger34tgq34', 'j09bh0jh45jh45-jg', 'service')).to.eql('G5EzHQeNfBfsCXvqji6uqytHT5g58Ya_Z98drJKjoMk');
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc