From d01bcc29fa10eb804f50f4de0b79a6206ef53c8f Mon Sep 17 00:00:00 2001 From: divlo Date: Thu, 18 Feb 2021 20:14:56 +0100 Subject: [PATCH] docs: add authorize options --- README.md | 5 +++++ src/authorize.ts | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 042c53c..733846f 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,11 @@ io.on('connection', async (socket) => { }) ``` +### `authorize` options + +- `secret` is a string containing the secret for HMAC algorithms, or a function that should fetch the secret or public key as shown in the example with `jwks-rsa`. +- `algorithms` (default: `HS256`) + ### Client side ```ts diff --git a/src/authorize.ts b/src/authorize.ts index ce21fe1..0576ace 100644 --- a/src/authorize.ts +++ b/src/authorize.ts @@ -59,7 +59,6 @@ export const authorize = (options: AuthorizeOptions): SocketIOMiddleware => { }) ) } - // Store encoded JWT socket.encodedToken = encodedToken let keySecret: string | null = null let decodedToken: any @@ -78,7 +77,6 @@ export const authorize = (options: AuthorizeOptions): SocketIOMiddleware => { }) ) } - // Store decoded JWT socket.decodedToken = decodedToken return next() }