{"name":"csrf-tokens","description":"primary logic behind csrf tokens","version":"1.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/expressjs/csrf-tokens"},"dependencies":{"rndm":"1"},"devDependencies":{"mocha":"1"},"scripts":{"test":"mocha --reporter spec"},"bugs":{"url":"https://github.com/expressjs/csrf-tokens/issues"},"homepage":"https://github.com/expressjs/csrf-tokens","_id":"csrf-tokens@1.0.0","_shasum":"2dd7d67afbda568428d5ac8a31f43c42ce62cc92","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"dist":{"shasum":"2dd7d67afbda568428d5ac8a31f43c42ce62cc92","tarball":"http://registry-npm.ywwl.com/csrf-tokens/download/csrf-tokens-1.0.0.tgz","integrity":"sha512-SWgGH+w00YcPtWRjpbMiLiWPrsCXTd1Mk+/lkzyOudV/fdsaePYhTYU/8gMbI6FfJu0TKtMTwUt76b69jfwwWg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDdn9ucJRHJsJ0W2c7KArzPGRma+/ZYioXBZeyHSVGFaQIhAN9Nmqy65oAUZ48vsHVHeI1xlfUUq17ZCvtttEOaduu1"}],"size":2318,"noattachment":false,"key":"/csrf-tokens/-/csrf-tokens-1.0.0.tgz"},"directories":{},"readme":"\n# CSRF Tokens\n\nLogic behind CSRF token creation and verification.\nRead [Understanding-CSRF](http://www.jongleberry.com/understanding-csrf.html) for more information on CSRF.\nUse this module to create custom CSRF middleware and what not.\n\n## API\n\n```js\nvar tokens = require('csrf-tokens')(options)\n\nvar secret = tokens.secretSync()\nvar token = tokens.create(secret)\nvar valid = tokens.verify(secret, token)\n```\n\nOptions:\n\n- `secretLength: 24` - the byte length of the secret key\n- `saltLength: 8` - the string length of the salt\n- `tokensize: (secret, salt) => token` - a custom token creation function\n\n### tokens.secret([cb])\n\nAsynchronously create a new `secret` of length `secretLength`.\nIf `cb` is not defined, a promise is returned.\nYou don't have to use this.\n\n```js\ntokens.secret().then(function (secret) {\n\n})\n\ntokens.secret(function (err, secret) {\n\n})\n```\n\n### var secret = tokens.secretSync()\n\nSynchronous version of `tokens.secret()`\n\n### var token = tokens.token(secret)\n\nCreate a CSRF token based on a `secret`.\nThis is the token you pass to clients.\n\n### var valid = tokens.verify(secret, token)\n\nCheck whether a CSRF token is valid based on a `secret`.\nIf it's not valid, you should probably throw a `403` error.\n","publish_time":1402264001232,"_cnpm_publish_time":1402264001232,"dist-tags":{"latest":"2.0.0"}}