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

incache-jws-session

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

incache-jws-session - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

package.json
{
"name": "incache-jws-session",
"version": "0.1.2",
"version": "0.1.3",
"description": "store json web signature sessions in cache",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -23,3 +23,2 @@

```javascript
const Session = require('incache-jws-session')

@@ -36,4 +35,3 @@

##### Generate a new token passing the user ID and the user type
With user type intends for example ‘root’, ‘admin’, ‘user’, ‘visitor’, etc
##### Generate a new token passing the user ID and the user type for example ‘root’, ‘admin’, ‘user’, ‘visitor’, etc

@@ -47,6 +45,5 @@ ```javascript

```javascript
const session = {
user: 1,
token,
token: 'your token string',
exp: new Date().getTime() + 1,

@@ -53,0 +50,0 @@ type: 'user'

const jws = require('jws')
const InCache = require('incache')
const store = new InCache({
storeName: 'jws-session'
})
const store = new InCache({ autoSave: true, autoSaveMode: 'timer' })
const TOKEN_NOT_VALID = 'Token is not valid'

@@ -98,10 +97,5 @@

* decodeToken return the information crypted inside the token
* @param {type} token description
* @param {string} token string
* @return {Object} contain serverHost, expiration date and an identificator
*/
/**
*
* @param token
* @returns {Promise.<boolean>}
*/
async decodeToken(token) {

@@ -113,4 +107,3 @@ let decoded = false

decoded = JSON.parse(decoded.payload)
}
catch(error) {
} catch(error) {
if(error){

@@ -123,4 +116,12 @@ return false

/**
* retrieveKey return the information crypted inside the token
* @param {key} id that we want search
* @return {object} return value or error
*/
retrieveKey(key) {
return store.get(key)
}
}
module.exports = Session
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