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

@ralalabs/manifest-signer

v0.1.0

Published

JavaScript/TypeScript utility for generating **signed restreamer manifest URLs** used by Rala Media infrastructure.

Readme

@ralalabs/manifest-signer

JavaScript/TypeScript utility for generating signed restreamer manifest URLs used by Rala Media infrastructure.

A small, runtime-agnostic cryptographic helper designed to work in:

  • Node.js 18+
  • Browsers
  • Cloudflare Workers
  • Edge runtimes (WebCrypto-based)

Zero runtime dependencies.


What it does

This package generates deterministic restreamer URLs in the format:

https://<publicHost>/manifest/<sid>.<ext>?u=<sealed>

Compatibility contract

Must match the Media Restreamer implementation:

  • sid

    • sid = HMAC-SHA256(PROXY_SECRET_HEX, originUrl) truncated to 16 hex chars (first 8 bytes).
  • sealed token (u)

    • AES-256-GCM encrypted JSON payload:
{
  "u": "<originUrl>",
  "iat": 1700000000
}
  • AAD (Additional Authenticated Data)

    • "u:manifest:<sid>"
  • Wire format (base64url, no padding)

    • [12B IV][16B TAG][CIPHERTEXT]

Features

  • Fully typed TypeScript API
  • Works in Node + Edge (WebCrypto only)
  • ESM + CJS exports
  • Deterministic sid
  • No runtime dependencies
  • Small footprint

Installation

pnpm add @ralalabs/manifest-signer
# or
npm install @ralalabs/manifest-signer

Usage

Basic function

import { signManifest } from '@ralalabs/manifest-signer';

const result = await signManifest({
  originUrl: 'https://cdn.example.com/master.m3u8',
  proxySecretHex: process.env.PROXY_SECRET_HEX!,
  publicHost: 'https://stream.example.com',
});

console.log(result.url);

Using the class (recommended for bulk signing)

Use .sign() when signing many URLs — it reuses cached CryptoKeys per instance.

import { ManifestSigner } from '@ralalabs/manifest-signer';

const signer = new ManifestSigner(process.env.PROXY_SECRET_HEX!);

const signed = await signer.sign(
  'https://cdn.example.com/master.m3u8',
  'https://stream.example.com',
);

console.log(signed.url);

You can also use the object-style wrapper:

const signed2 = await signer.signManifest({
  originUrl: 'https://cdn.example.com/master.m3u8',
  publicHost: 'https://stream.example.com',
});

API

signManifest(input)

| Field | Type | Required | | -------------- | ----------------- | -------- | | originUrl | string | ✅ | | proxySecretHex | string (64hex) | ✅ | | publicHost | string | ✅ | | ext | 'mpd' \| 'm3u8' | optional |

Returns:

{
  url: string;
  sid: string;
  ext: 'mpd' | 'm3u8';
  originUrl: string;
}

new ManifestSigner(proxySecretHex)

  • sign(originUrl, publicHost, ext?)
  • signManifest({ originUrl, publicHost, ext? })

Runtime compatibility

| Environment | Supported | | ------------------ | --------- | | Node.js 18+ | ✅ | | Browsers | ✅ | | Cloudflare Workers | ✅ | | Bun | ✅ | | Deno | ✅ |

This library relies only on the standard WebCrypto API.


Security notes

  • This package does not validate upstream hostnames.
  • Keep PROXY_SECRET_HEX secret and never expose it publicly.
  • Tokens are infrastructure-level and generally not meant to be user-visible.

License

MIT