Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
92d1ecd7e0 | |||
0e3055a6b5 | |||
5f3e5ceb37 | |||
68724248eb |
41
.github/workflows/codeql-analysis.yml
vendored
41
.github/workflows/codeql-analysis.yml
vendored
@ -1,41 +0,0 @@
|
||||
# For more information see: https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code
|
||||
|
||||
name: 'CodeQL'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, develop]
|
||||
pull_request_review:
|
||||
branches: [master, develop]
|
||||
types: [submitted]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
if: ${{ (github.event_name == 'push') || (github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && (github.event.review.author_association == 'COLLABORATOR' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'OWNER') && !github.event.pull_request.draft && github.event.pull_request.state == 'open') }}
|
||||
name: 'Analyze'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['javascript']
|
||||
|
||||
steps:
|
||||
- name: 'Checkout repository'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
- name: 'Initialize CodeQL'
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: 'Autobuild'
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
- name: 'Perform CodeQL Analysis'
|
||||
uses: github/codeql-action/analyze@v1
|
@ -1,3 +1,9 @@
|
||||
# [1.0.0](https://github.com/Thream/socketio-jwt/compare/v4.6.2...v1.0.0) (2020-12-29)
|
||||
# Changelog
|
||||
|
||||
## [1.0.1](https://github.com/Thream/socketio-jwt/compare/v1.0.0...v1.0.1) (2020-12-29)
|
||||
|
||||
- docs(readme): fix usage section by correctly importing `authorize`
|
||||
|
||||
## [1.0.0](https://github.com/Thream/socketio-jwt/compare/v4.6.2...v1.0.0) (2020-12-29)
|
||||
|
||||
Initial release.
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h1 align="center">Thream/socketio-jwt</h1>
|
||||
<h1 align="center"><a href="https://www.npmjs.com/package/@thream/socketio-jwt">Thream/socketio-jwt</a></h1>
|
||||
|
||||
<p align="center">
|
||||
<strong>Authenticate socket.io incoming connections with JWTs.</strong>
|
||||
@ -8,6 +8,7 @@
|
||||
<a href="https://github.com/Thream/socketio-jwt/actions?query=workflow%3A%22Node.js+CI%22"><img src="https://github.com/Thream/socketio-jwt/workflows/Node.js%20CI/badge.svg" alt="Node.js CI" /></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>
|
||||
<a href="https://dependabot.com/"><img src="https://badgen.net/github/dependabot/Thream/socketio-jwt?icon=dependabot" alt="Dependabot badge" /></a>
|
||||
<a href="https://www.npmjs.com/package/@thream/socketio-jwt"><img src="https://img.shields.io/npm/v/@thream/socketio-jwt.svg" alt="npm version"></a>
|
||||
<a href="https://www.npmjs.com/package/ts-standard"><img alt="TypeScript Standard Style" src="https://camo.githubusercontent.com/f87caadb70f384c0361ec72ccf07714ef69a5c0a/68747470733a2f2f62616467656e2e6e65742f62616467652f636f64652532307374796c652f74732d7374616e646172642f626c75653f69636f6e3d74797065736372697074"/></a>
|
||||
<a href="./LICENSE"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="Licence MIT"/></a>
|
||||
<a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg" alt="Conventional Commits" /></a>
|
||||
@ -34,7 +35,7 @@ npm install --save @thream/socketio-jwt
|
||||
|
||||
```ts
|
||||
import { Server } from 'socket.io'
|
||||
import socketioJWT from '@thream/socketio-jwt'
|
||||
import { authorize } from '@thream/socketio-jwt'
|
||||
|
||||
const io = new Server(9000)
|
||||
io.use(
|
||||
@ -47,7 +48,9 @@ io.on('connection', async () => {
|
||||
const clients = await io.sockets.allSockets()
|
||||
for (const clientId of clients) {
|
||||
const client = io.sockets.sockets.get(clientId)
|
||||
console.log(client.decodedToken) // we can access the jwt payload of each connected client
|
||||
client.emit('messages', { message: 'Success!' })
|
||||
// we can access the jwt payload of each connected client
|
||||
console.log(client.decodedToken)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thream/socketio-jwt",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Authenticate socket.io incoming connections with JWTs.",
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
|
Reference in New Issue
Block a user