# @toruslabs/secure-pub-sub

> Helper methods secure publish and subscribe to a topic

Latest version **4.3.0** (published 2026-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @toruslabs/secure-pub-sub
pnpm add @toruslabs/secure-pub-sub
yarn add @toruslabs/secure-pub-sub
bun add @toruslabs/secure-pub-sub
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2026-03-20 |
| First published | 2023-10-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.x |
| Dependencies | 5 |
| Unpacked size | 18.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Torus Labs |
| Maintainers | torusresearch, chaitanyapotti, tetratorus, archit_web3, himanshunpm009 |
| Keywords | secure-pub-sub |

## Links

- npm: https://www.npmjs.com/package/@toruslabs/secure-pub-sub
- Repository: https://github.com/torusresearch/secure-pub-sub
- Homepage: https://github.com/torusresearch/secure-pub-sub#readme
- Issues: https://github.com/torusresearch/secure-pub-sub/issues
- npm.io page: https://npm.io/package/@toruslabs/secure-pub-sub

## Dependencies (5)

- [loglevel](https://npm.io/package/loglevel.md) ^1.9.2
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.8.3
- [@toruslabs/eccrypto](https://npm.io/package/@toruslabs/eccrypto.md) ^7.0.0
- [@toruslabs/http-helpers](https://npm.io/package/@toruslabs/http-helpers.md) ^9.0.0
- [@toruslabs/metadata-helpers](https://npm.io/package/@toruslabs/metadata-helpers.md) ^8.2.0

## Recent versions

- 4.3.0 (latest) — 2026-03-20
- 4.2.0 — 2026-03-05
- 4.1.0 — 2026-02-23
- 4.0.0 — 2026-02-05
- 3.0.2 — 2025-03-24
- 3.0.1 — 2025-03-11
- 3.0.0 — 2025-02-27
- 2.0.0 — 2025-01-20
- 1.1.0 — 2024-11-08
- 1.0.0 — 2024-06-13
- 0.2.0 — 2024-03-15
- 0.1.0 — 2024-03-12
- 0.0.1 — 2023-10-19

## README

# secure-pub-sub

![Build Status](https://github.com/torusresearch/secure-pub-sub/actions/workflows/master.yml/badge.svg)

[![npm downloads](https://img.shields.io/npm/dm/@toruslabs/secure-pub-sub.svg?style=flat-square)](https://www.npmjs.com/package/@toruslabs/secure-pub-sub)

[![NPM](https://nodei.co/npm/@toruslabs/secure-pub-sub.png)](https://www.npmjs.com/package/@toruslabs/secure-pub-sub)

## Introduction

This repo allow you to publish and subscribe to a single message in a topic

## Features

- Typescript compatible. Includes Type definitions
- All API's return `Promises`

## Installation

### Bundling

This module is distributed in 3 formats

- `lib.esm` build `dist/lib.esm/index.js` in es6 format
- `lib.cjs` build `dist/lib.cjs/index.js` in es5 format

By default, the appropriate format is used for your specified usecase
You can use a different format (if you know what you're doing) by referencing the correct file

The cjs build is not polyfilled with core-js.
It is upto the user to polyfill based on the browserlist they target

### Directly in Browser

CDN's serve the non-core-js polyfilled version by default. You can use a different

jsdeliver

```js
<script src="https://cdn.jsdelivr.net/npm/@toruslabs/secure-pub-sub"></script>
```

unpkg

```js
<script src="https://unpkg.com/@toruslabs/secure-pub-sub"></script>
```

### Tips for NUXT

This is a plugin that works [only on the client side](https://nuxtjs.org/guide/plugins/#client-side-only). So please register it as a ssr-free plugin.

## Usage

Add [`@toruslabs/secure-pub-sub`](https://www.npmjs.com/package/@toruslabs/secure-pub-sub) to your project:

To allow your web app to retrieve keys:

Install the package
`npm i @toruslabs/secure-pub-sub`
or
`yarn add @toruslabs/secure-pub-sub`

## Requirements

- This package requires a peer dependency of `@babel/runtime`
- Node 22+

---
_Source: https://npm.io/package/@toruslabs/secure-pub-sub · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
