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

redis.token

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis.token - npm Package Compare versions

Comparing version 0.1.2 to 0.1.4

.coveralls.yml

21

index.js

@@ -8,3 +8,3 @@ //Dependencies

module.exports = function(config) {
module.exports = function(config, callback) {

@@ -21,3 +21,3 @@ //Supply configuration object

client.on("error", function(err) {
if (err) throw err
if (err) return callback(err)
})

@@ -28,5 +28,8 @@

//The generate token function
module.exports.generate = function(config,callback) {
if (!config) throw "Must supply a parameter"
//If no object is supplied
if (!config) return callback("Must supply a parameter")
var data = []
//Converts the object into a hashtable
Object.keys(config).map(function(key) {

@@ -36,6 +39,7 @@ data.push(key)

})
//Create a random SHA3 key
var rKey = crypto.SHA3(secret + Math.random()).toString()
//Set the key as the hashtable in Redis
client.hmset(rKey,data, function(err,res) {
if (err) throw err
return callback({
return callback(err,{
"token": rKey

@@ -46,7 +50,10 @@ })

//The get token function
module.exports.get = function(key,callback) {
if (!key) throw "Must supply a key"
//If no key is supplied return an error
if (!key) return callback("Must supply a key")
//Get the key and it's associated objects
client.HGETALL(key, function(err,reply) {
return callback(reply)
return callback(err,reply)
})
}
{
"name": "redis.token",
"version": "0.1.2",
"version": "0.1.4",
"description": " token based storage system in Redis that uses hashtables.",
"main": "index.js",
"scripts": {
"test": "mocha tests.js"
"test": "mocha tests.js",
"nyc": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
},
"bin": {
"codecov": "./bin/codecov"
},
"repository": {

@@ -29,3 +33,7 @@ "type": "git",

"redis": "^2.6.0-1"
},
"devDependencies": {
"coveralls": "^2.11.9",
"nyc": "^6.4.0"
}
}
[![Build Status](https://travis-ci.org/ChrisCates/redis.token.svg?branch=master)](https://travis-ci.org/ChrisCates/redis.token)
[![Coverage Status](https://coveralls.io/repos/github/ChrisCates/redis.token/badge.svg?branch=master)](https://coveralls.io/github/ChrisCates/redis.token?branch=master)
[![NPM](https://nodei.co/npm/redis.token.png)](https://nodei.co/npm/redis.token/)
# redis.token

@@ -36,3 +39,5 @@ ## A token based storage system in Redis that uses hashtables.

var redis = require("redis.token")(config)
var redis = require("redis.token")(config, function(err) {
if (err) throw err
})

@@ -44,7 +49,8 @@ redis.generate(

},
function(key) {
function(err, key) {
if (err) throw err
//Returns randomly generated SHA3 token
console.log(key)
//Returns randomly generated SHA3 token
redis.get(key.token, function(reply) {
console.log(reply)
redis.get(key.token, function(err, reply) {
if (err) throw err
/*

@@ -57,2 +63,3 @@ Returns

*/
console.log(reply)
})

@@ -59,0 +66,0 @@ }

Sorry, the diff of this file is not supported yet

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