
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
@nightnetwork/plus-client
Advanced tools
Night+ authentication client with Enigma WebSocket protocol interceptor
WebSocket authentication for Night+ using Enigma protocol injection.
Since browsers block custom WebSocket headers, authentication data is passed via the protocols parameter:
npm install @nightnetwork/plus-client localforage
Load the module via Enigma for automatic authentication injection:
import { BareMuxConnection } from '@mercuryworkshop/bare-mux';
import { authenticate } from '@nightnetwork/plus-client';
const accessToken = '...';
await authenticate(accessToken, '/auth');
const connection = new BareMuxConnection('/baremux/worker.js');
await connection.setTransport('/enigma/index.mjs', {
base: '/epoxy/index.mjs',
wisp: 'wss://wisp.example.com/',
modules: [
'/plusClient/module.mjs'
]
});
Import functions directly for manual token management:
import { setSessionToken, getSessionToken, clearSessionToken, createPlusAuthModule } from '@nightnetwork/plus-client';
const accessToken = '...';
await authenticate(accessToken, '/auth');
const connection = new BareMuxConnection('/baremux/worker.js');
await connection.setTransport('/enigma/index.mjs', {
base: '/epoxy/index.mjs',
wisp: 'wss://wisp.example.com/',
modules: [
createPlusAuthModule()
]
});
// Set token
await setSessionToken('your-session-token');
// Get token
const token = await getSessionToken();
// Clear token
await clearSessionToken();
import { validateSession } from '@nightnetwork/plus-client';
const isValid = await validateSession('/validate');
if (!isValid) {
// Re-authenticate
await authenticate(accessToken);
}
authenticate(accessToken, authUrl?)Exchanges access token for session token. Stores in IndexedDB.
accessToken: JWT access token from loginauthUrl: Auth endpoint (default: /auth)Promise<string> - Session tokensetSessionToken(token)Stores session token in IndexedDB (NightPlus database).
token: Session token stringPromise<void>getSessionToken()Retrieves session token from IndexedDB.
Promise<string | null>clearSessionToken()Removes session token from IndexedDB.
Promise<void>validateSession(validateUrl?)Checks if current session token is valid.
validateUrl: Validation endpoint (default: /validate)Promise<boolean>createPlusAuthModule()Creates Enigma module for WebSocket protocol injection.
EnigmaModuleAuthentication data is encoded as:
const authData = { "Night-Auth": "session-token" };
const protocol = btoa(JSON.stringify(authData));
The reverse proxy decodes this:
const decoded = JSON.parse(atob(protocol));
const token = decoded['Night-Auth'];
Uses localforage with IndexedDB:
NightPlussessiontokenWorks in web workers - NO localStorage dependency.
import BareMux from '@mercuryworkshop/bare-mux';
import { authenticate, createPlusAuthModule, validateSession } from '@nightnetwork/plus-client';
// 1. Login to get access token
const loginRes = await fetch('https://auth.night-x.com/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: 'user@example.com', password: 'pass' })
});
const { access_token } = await loginRes.json();
// 2. Exchange for session token
await authenticate(access_token, 'http://localhost:8081/auth');
// 3. Setup transport with auth module
const connection = new BareMux.BareClient();
await connection.setTransport('/enigma/index.mjs', {
base: '/epoxy/index.mjs',
modules: [createPlusAuthModule()]
});
// 4. WebSockets are now authenticated
const ws = new WebSocket('wss://api.example.com/ws');
// 5. Handle session expiry
ws.addEventListener('close', async (event) => {
if (event.code === 1008) { // Unauthorized
await authenticate(access_token);
// Retry connection
}
});
Sessions expire 15 minutes after inactivity. When expired:
FAQs
Night+ authentication client with Enigma WebSocket protocol interceptor
The npm package @nightnetwork/plus-client receives a total of 10 weekly downloads. As such, @nightnetwork/plus-client popularity was classified as not popular.
We found that @nightnetwork/plus-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.