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

csrf

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csrf - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

5

HISTORY.md

@@ -0,1 +1,6 @@

3.0.6 / 2017-03-14
==================
* Remove `base64-url` dependency
3.0.5 / 2017-03-07

@@ -2,0 +7,0 @@ ==================

32

index.js

@@ -19,5 +19,13 @@ /*!

var crypto = require('crypto')
var escape = require('base64-url').escape
/**
* Module variables.
* @private
*/
var EQUAL_GLOBAL_REGEXP = /=/g
var PLUS_GLOBAL_REGEXP = /\+/g
var SLASH_GLOBAL_REGEXP = /\//g
/**
* Module exports.

@@ -106,7 +114,3 @@ * @public

Tokens.prototype._tokenize = function tokenize (secret, salt) {
var hash = crypto
.createHash('sha1')
.update(salt + '-' + secret, 'ascii')
.digest('base64')
return escape(salt + '-' + hash)
return salt + '-' + hash(salt + '-' + secret)
}

@@ -142,1 +146,17 @@

}
/**
* Hash a string with SHA1, returning url-safe base64
* @param {string} str
* @private
*/
function hash (str) {
return crypto
.createHash('sha1')
.update(str, 'ascii')
.digest('base64')
.replace(PLUS_GLOBAL_REGEXP, '-')
.replace(SLASH_GLOBAL_REGEXP, '_')
.replace(EQUAL_GLOBAL_REGEXP, '')
}

3

package.json
{
"name": "csrf",
"description": "primary logic behind csrf tokens",
"version": "3.0.5",
"version": "3.0.6",
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",

@@ -12,3 +12,2 @@ "contributors": [

"dependencies": {
"base64-url": "1.3.3",
"rndm": "1.2.0",

@@ -15,0 +14,0 @@ "tsscmp": "1.0.5",

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