@supabase/realtime-js
Advanced tools
Comparing version 2.10.7 to 2.10.8
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.10.7"; | ||
export declare const version = "2.10.8"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '2.10.7'; | ||
exports.version = '2.10.8'; | ||
//# sourceMappingURL=version.js.map |
@@ -288,2 +288,17 @@ "use strict"; | ||
setAuth(token) { | ||
if (token) { | ||
let parsed = null; | ||
try { | ||
parsed = JSON.parse(atob(token.split('.')[1])); | ||
} | ||
catch (_error) { } | ||
if (parsed && parsed.exp) { | ||
let now = Math.floor(Date.now() / 1000); | ||
let valid = now - parsed.exp < 0; | ||
if (!valid) { | ||
this.log('auth', `provided token has expired, not sending it to realtime`); | ||
return; | ||
} | ||
} | ||
} | ||
this.accessToken = token; | ||
@@ -290,0 +305,0 @@ this.channels.forEach((channel) => { |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.10.7"; | ||
export declare const version = "2.10.8"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export const version = '2.10.7'; | ||
export const version = '2.10.8'; | ||
//# sourceMappingURL=version.js.map |
@@ -260,2 +260,17 @@ import { CHANNEL_EVENTS, CONNECTION_STATE, DEFAULT_HEADERS, DEFAULT_TIMEOUT, SOCKET_STATES, TRANSPORTS, VSN, WS_CLOSE_NORMAL, } from './lib/constants'; | ||
setAuth(token) { | ||
if (token) { | ||
let parsed = null; | ||
try { | ||
parsed = JSON.parse(atob(token.split('.')[1])); | ||
} | ||
catch (_error) { } | ||
if (parsed && parsed.exp) { | ||
let now = Math.floor(Date.now() / 1000); | ||
let valid = now - parsed.exp < 0; | ||
if (!valid) { | ||
this.log('auth', `provided token has expired, not sending it to realtime`); | ||
return; | ||
} | ||
} | ||
} | ||
this.accessToken = token; | ||
@@ -262,0 +277,0 @@ this.channels.forEach((channel) => { |
{ | ||
"name": "@supabase/realtime-js", | ||
"version": "2.10.7", | ||
"version": "2.10.8", | ||
"description": "Listen to realtime updates to your PostgreSQL database", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
"@types/ws": "^8.5.10", | ||
"ws": "^8.14.2" | ||
"ws": "^8.18.0" | ||
}, | ||
@@ -55,2 +55,3 @@ "devDependencies": { | ||
"jsdom-global": "3.0.0", | ||
"jsonwebtoken": "^9.0.2", | ||
"mock-socket": "^9.0.3", | ||
@@ -57,0 +58,0 @@ "npm-run-all": "^4.1.5", |
@@ -1,1 +0,1 @@ | ||
export const version = '2.10.7' | ||
export const version = '2.10.8' |
@@ -338,2 +338,20 @@ import type { WebSocket as WSWebSocket } from 'ws' | ||
setAuth(token: string | null): void { | ||
if (token) { | ||
let parsed = null | ||
try { | ||
parsed = JSON.parse(atob(token.split('.')[1])) | ||
} catch (_error) {} | ||
if (parsed && parsed.exp) { | ||
let now = Math.floor(Date.now() / 1000) | ||
let valid = now - parsed.exp < 0 | ||
if (!valid) { | ||
this.log( | ||
'auth', | ||
`provided token has expired, not sending it to realtime` | ||
) | ||
return | ||
} | ||
} | ||
} | ||
this.accessToken = token | ||
@@ -340,0 +358,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
384229
6864
13
18
1
Updatedws@^8.18.0