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

@thream/socketio-jwt

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thream/socketio-jwt - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

48

build/__test__/authorize.test.js

@@ -15,7 +15,7 @@ import tap from 'tap';

};
await tap.test('authorize', async (t1)=>{
await t1.test('with secret as string in options', async (t2)=>{
await tap.test('authorize', async (t)=>{
await t.test('with secret as string in options', async (t)=>{
let token = '';
let socket = null;
t2.beforeEach(async ()=>{
t.beforeEach(async ()=>{
await fixtureStart();

@@ -25,7 +25,7 @@ const response = await api.post('/login', {});

});
t2.afterEach(async ()=>{
t.afterEach(async ()=>{
socket?.disconnect();
await fixtureStop();
});
await t2.test('should emit error with no token provided', (t)=>{
await t.test('should emit error with no token provided', (t)=>{
t.plan(4);

@@ -45,3 +45,3 @@ socket = io(API_URL);

});
await t2.test('should emit error with bad token format', (t)=>{
await t.test('should emit error with bad token format', (t)=>{
t.plan(4);

@@ -65,3 +65,3 @@ socket = io(API_URL, {

});
await t2.test('should emit error with unauthorized handshake', (t)=>{
await t.test('should emit error with unauthorized handshake', (t)=>{
t.plan(4);

@@ -85,3 +85,3 @@ socket = io(API_URL, {

});
await t2.test('should connect the user', (t)=>{
await t.test('should connect the user', (t)=>{
t.plan(1);

@@ -101,6 +101,6 @@ socket = io(API_URL, {

});
await t1.test('with secret as callback in options', async (t3)=>{
await t.test('with secret as callback in options', async (t)=>{
let token = '';
let socket = null;
t3.beforeEach(async ()=>{
t.beforeEach(async ()=>{
await fixtureStart({

@@ -112,7 +112,7 @@ secret: secretCallback

});
t3.afterEach(async ()=>{
t.afterEach(async ()=>{
socket?.disconnect();
await fixtureStop();
});
await t3.test('should emit error with no token provided', (t)=>{
await t.test('should emit error with no token provided', (t)=>{
t.plan(4);

@@ -132,3 +132,3 @@ socket = io(API_URL);

});
await t3.test('should emit error with bad token format', (t)=>{
await t.test('should emit error with bad token format', (t)=>{
t.plan(4);

@@ -152,3 +152,3 @@ socket = io(API_URL, {

});
await t3.test('should emit error with unauthorized handshake', (t)=>{
await t.test('should emit error with unauthorized handshake', (t)=>{
t.plan(4);

@@ -172,3 +172,3 @@ socket = io(API_URL, {

});
await t3.test('should connect the user', (t)=>{
await t.test('should connect the user', (t)=>{
t.plan(1);

@@ -188,7 +188,7 @@ socket = io(API_URL, {

});
await t1.test('with onAuthentication callback in options', async (t4)=>{
await t.test('with onAuthentication callback in options', async (t)=>{
let token = '';
let wrongToken = '';
let socket = null;
t4.beforeEach(async ()=>{
t.beforeEach(async ()=>{
await fixtureStart({

@@ -210,7 +210,7 @@ secret: secretCallback,

});
t4.afterEach(async ()=>{
t.afterEach(async ()=>{
socket?.disconnect();
await fixtureStop();
});
await t4.test('should emit error with no token provided', (t)=>{
await t.test('should emit error with no token provided', (t)=>{
t.plan(4);

@@ -230,3 +230,3 @@ socket = io(API_URL);

});
await t4.test('should emit error with bad token format', (t)=>{
await t.test('should emit error with bad token format', (t)=>{
t.plan(4);

@@ -250,3 +250,3 @@ socket = io(API_URL, {

});
await t4.test('should emit error with unauthorized handshake', (t)=>{
await t.test('should emit error with unauthorized handshake', (t)=>{
t.plan(4);

@@ -270,3 +270,3 @@ socket = io(API_URL, {

});
await t4.test('should connect the user', (t)=>{
await t.test('should connect the user', (t)=>{
t.plan(1);

@@ -285,3 +285,3 @@ socket = io(API_URL, {

});
await t4.test('should contains user properties', (t)=>{
await t.test('should contains user properties', (t)=>{
t.plan(2);

@@ -302,3 +302,3 @@ const socketServer = getSocket();

});
await t4.test('should emit error when user validation fails', (t)=>{
await t.test('should emit error when user validation fails', (t)=>{
t.plan(2);

@@ -305,0 +305,0 @@ socket = io(API_URL, {

import { Server as SocketIoServer } from 'socket.io';
import { AuthorizeOptions } from '../../index.js';
import type { AuthorizeOptions } from '../../index.js';
interface FastifyIo {

@@ -4,0 +4,0 @@ instance: SocketIoServer;

@@ -55,6 +55,8 @@ import jwt from 'jsonwebtoken';

});
application.addHook('onClose', (fastify1)=>{
fastify1.io.instance.close();
application.addHook('onClose', (fastify)=>{
fastify.io.instance.close();
});
await application.listen(PORT);
await application.listen({
port: PORT
});
};

@@ -61,0 +63,0 @@ export const fixtureStop = async ()=>{

@@ -1,3 +0,3 @@

import { Algorithm } from 'jsonwebtoken';
import { Socket } from 'socket.io';
import type { Algorithm } from 'jsonwebtoken';
import type { Socket } from 'socket.io';
import { UnauthorizedError } from './UnauthorizedError.js';

@@ -4,0 +4,0 @@ declare module 'socket.io' {

{
"name": "@thream/socketio-jwt",
"version": "3.0.0",
"version": "3.0.1",
"type": "module",

@@ -38,3 +38,3 @@ "public": true,

"lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint \"**/*.md\" --dot --ignore-path \".gitignore\"",
"lint:markdown": "markdownlint-cli2",
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",

@@ -56,34 +56,34 @@ "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",

"devDependencies": {
"@commitlint/cli": "16.2.3",
"@commitlint/config-conventional": "16.2.1",
"@commitlint/cli": "17.1.2",
"@commitlint/config-conventional": "17.1.0",
"@swc/cli": "0.1.57",
"@swc/core": "1.2.164",
"@types/jsonwebtoken": "8.5.8",
"@types/node": "17.0.23",
"@types/tap": "15.0.6",
"@typescript-eslint/eslint-plugin": "5.18.0",
"@typescript-eslint/parser": "5.18.0",
"axios": "0.26.1",
"c8": "7.11.0",
"@swc/core": "1.2.249",
"@types/jsonwebtoken": "8.5.9",
"@types/node": "18.7.16",
"@types/tap": "15.0.7",
"@typescript-eslint/eslint-plugin": "5.36.2",
"@typescript-eslint/parser": "5.36.2",
"axios": "0.27.2",
"c8": "7.12.0",
"editorconfig-checker": "4.0.2",
"eslint": "8.12.0",
"eslint-config-conventions": "2.0.0",
"eslint": "8.23.0",
"eslint-config-conventions": "4.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-promise": "6.0.0",
"eslint-plugin-unicorn": "42.0.0",
"fastify": "3.28.0",
"husky": "7.0.4",
"lint-staged": "12.3.7",
"markdownlint-cli": "0.31.1",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-promise": "6.0.1",
"eslint-plugin-unicorn": "43.0.2",
"fastify": "4.5.3",
"husky": "8.0.1",
"lint-staged": "13.0.3",
"markdownlint-cli2": "0.5.1",
"pinst": "3.0.0",
"prettier": "2.6.2",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"semantic-release": "19.0.2",
"socket.io": "4.4.1",
"socket.io-client": "4.4.1",
"tap": "16.0.1",
"typescript": "4.6.3"
"semantic-release": "19.0.5",
"socket.io": "4.5.2",
"socket.io-client": "4.5.2",
"tap": "16.3.0",
"typescript": "4.8.3"
}
}

@@ -15,3 +15,2 @@ <h1 align="center">Thream/socketio-jwt</h1>

<a href="https://github.com/Thream/socketio-jwt/actions/workflows/test.yml"><img src="https://github.com/Thream/socketio-jwt/actions/workflows/test.yml/badge.svg?branch=develop" /></a>
<a href="https://codecov.io/gh/Thream/socketio-jwt"><img src="https://codecov.io/gh/Thream/socketio-jwt/branch/develop/graph/badge.svg" alt="codecov" /></a>
<br />

@@ -137,3 +136,3 @@ <a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg" alt="Conventional Commits" /></a>

import { io } from 'socket.io-client'
import { isUnauthorizedError } from '@thream/socketio-jwt'
import { isUnauthorizedError } from '@thream/socketio-jwt/UnauthorizedError.js'

@@ -140,0 +139,0 @@ // Require Bearer Token

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