Socket
Socket
Sign inDemoInstall

csrf-tokens

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

1

index.js

@@ -42,2 +42,3 @@

function verify(secret, token) {
if (!token || typeof token !== 'string') return false
var expected = tokensize(secret, token.split('-')[0])

@@ -44,0 +45,0 @@ return scmp(token, expected)

2

package.json
{
"name": "csrf-tokens",
"description": "primary logic behind csrf tokens",
"version": "1.0.1",
"version": "1.0.2",
"author": {

@@ -6,0 +6,0 @@ "name": "Jonathan Ong",

@@ -14,6 +14,14 @@

})
it('should create a secret asynchronously', function (done) {
csrf.secret(function (err, secret) {
assert.ifError(err)
assert.equal('string', typeof secret)
done()
})
})
})
describe('.create()', function () {
it('should create a token', function () {
it('should create a token synchronously', function () {
var token = csrf.create(secret)

@@ -36,3 +44,8 @@ assert.equal('string', typeof token)

})
it('should return `false` with invalid tokens', function () {
assert(!csrf.verify(secret, undefined))
assert(!csrf.verify(secret, []))
})
})
})
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc