@cocreate/authenticate
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -0,1 +1,9 @@ | ||
## [1.3.5](https://github.com/CoCreate-app/CoCreate-authenticate/compare/v1.3.4...v1.3.5) (2023-10-09) | ||
### Bug Fixes | ||
* decodeToken accepts a token ([bfd47fb](https://github.com/CoCreate-app/CoCreate-authenticate/commit/bfd47fb27d6285245c765918fb572713ba500ef6)) | ||
* return user_id and expiration ([58e9e4b](https://github.com/CoCreate-app/CoCreate-authenticate/commit/58e9e4b73522f1157bd1f26223a6e2fbd3e69f4a)) | ||
## [1.3.4](https://github.com/CoCreate-app/CoCreate-authenticate/compare/v1.3.3...v1.3.4) (2023-09-18) | ||
@@ -2,0 +10,0 @@ |
{ | ||
"name": "@cocreate/authenticate", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "A simple authenticate component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", | ||
@@ -43,5 +43,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@cocreate/uuid": "^1.7.1", | ||
"@cocreate/uuid": "^1.7.2", | ||
"jsonwebtoken": "^9.0.0" | ||
} | ||
} |
@@ -114,5 +114,3 @@ const jwt = require('jsonwebtoken'); | ||
// Verify and decode a token using the available keys | ||
function decodeToken(req) { | ||
const headers = req.headers; | ||
const token = headers['sec-websocket-protocol']; | ||
function decodeToken(token) { | ||
const currentTime = new Date().getTime(); | ||
@@ -122,3 +120,3 @@ | ||
if (user && currentTime < user.expires) | ||
return user._id; | ||
return { user_id: user._id, expires: user.expires }; | ||
@@ -125,0 +123,0 @@ users.delete(token) |
72240
148
Updated@cocreate/uuid@^1.7.2