npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aegis-fluxion/browser-client

v0.1.0

Published

Browser-native SecureClient for aegis-fluxion using Web Crypto and WebSocket APIs.

Readme

@aegis-fluxion/browser-client

Browser-native secure WebSocket client for the aegis-fluxion ecosystem.

Version: 0.1.0


Why this package

@aegis-fluxion/browser-client is a lightweight browser SDK that mirrors the core SecureClient messaging model without Node.js built-ins.

It uses only:

  • Browser Web Crypto API (crypto.subtle) for ECDH + AES-256-GCM
  • Browser-native WebSocket for transport

No node:crypto, no ws, no Buffer dependency at runtime.


Install

npm install @aegis-fluxion/browser-client

Features

  • Ephemeral ECDH handshake (P-256) against SecureServer
  • AES-256-GCM encrypted event envelopes
  • Promise/callback ACK flow (emit(..., { timeoutMs }))
  • Binary payload support (Uint8Array, ArrayBuffer, Blob)
  • Encrypted chunked streaming:
    • emitStream(...)
    • onStream(...)
  • Optional reconnect backoff

Basic browser usage

import { BrowserSecureClient } from "@aegis-fluxion/browser-client";

const client = new BrowserSecureClient("wss://api.example.com/socket", {
  autoConnect: true,
  reconnect: {
    enabled: true,
    initialDelayMs: 250,
    maxDelayMs: 10_000,
    factor: 2,
    jitterRatio: 0.2,
    maxAttempts: null
  }
});

client.on("ready", async () => {
  const ack = await client.emit(
    "notes:create",
    { title: "From browser" },
    { timeoutMs: 1500 }
  );

  console.log("ACK", ack);
});

client.on("notes:created", (payload) => {
  console.log("push event", payload);
});

React example

import { useEffect, useMemo, useState } from "react";
import { BrowserSecureClient } from "@aegis-fluxion/browser-client";

export function SecureNotesWidget() {
  const [status, setStatus] = useState("connecting");
  const [notes, setNotes] = useState<string[]>([]);

  const client = useMemo(() => {
    return new BrowserSecureClient("wss://api.example.com/socket", {
      autoConnect: false,
      reconnect: true
    });
  }, []);

  useEffect(() => {
    const handleReady = () => setStatus("ready");
    const handleDisconnect = () => setStatus("disconnected");
    const handleNewNote = (payload: unknown) => {
      const data = payload as { title?: string };
      if (typeof data.title === "string") {
        setNotes((prev) => [data.title, ...prev]);
      }
    };

    client.on("ready", handleReady);
    client.on("disconnect", handleDisconnect);
    client.on("notes:created", handleNewNote);

    client.connect();

    return () => {
      client.off("ready", handleReady);
      client.off("disconnect", handleDisconnect);
      client.off("notes:created", handleNewNote);
      client.disconnect();
    };
  }, [client]);

  const createNote = async () => {
    await client.emit("notes:create", { title: "React note" }, { timeoutMs: 1500 });
  };

  return (
    <section>
      <p>Secure socket status: {status}</p>
      <button onClick={createNote}>Create note</button>
      <ul>
        {notes.map((note) => (
          <li key={note}>{note}</li>
        ))}
      </ul>
    </section>
  );
}

Chunked stream example

import { BrowserSecureClient } from "@aegis-fluxion/browser-client";

const client = new BrowserSecureClient("wss://api.example.com/socket");

client.on("ready", async () => {
  const selectedFile = (document.querySelector("#file") as HTMLInputElement)
    .files?.[0];

  if (!selectedFile) {
    return;
  }

  const result = await client.emitStream("files:upload", selectedFile, {
    chunkSizeBytes: 64 * 1024,
    totalBytes: selectedFile.size,
    metadata: { filename: selectedFile.name }
  });

  console.log(result);
});

client.onStream("files:download", async (stream) => {
  const reader = stream.getReader();
  const chunks: Uint8Array[] = [];

  while (true) {
    const { value, done } = await reader.read();
    if (done) {
      break;
    }

    if (value) {
      chunks.push(value);
    }
  }

  const merged = new Uint8Array(chunks.reduce((a, c) => a + c.length, 0));
  let offset = 0;

  for (const chunk of chunks) {
    merged.set(chunk, offset);
    offset += chunk.length;
  }

  console.log("Downloaded bytes", merged.byteLength);
});

API summary

  • new BrowserSecureClient(url, options?)
  • connect() / disconnect(code?, reason?)
  • isConnected() / readyState
  • on(...) / off(...)
  • emit(event, data, ackOptionsOrCallback?)
  • emitStream(event, source, options?)
  • onStream(event, handler) / offStream(event, handler)

Compatibility notes

  • Requires a runtime with WebSocket, crypto.subtle, and ReadableStream.
  • Designed to connect to @aegis-fluxion/core SecureServer endpoints.
  • This package is transport/client focused; server-side primitives remain in @aegis-fluxion/core.

License

MIT