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

@notip/crypto-sdk

v2.0.2

Published

Client-side decryption library for NoTIP telemetry payloads

Readme

@notip/crypto-sdk

Quality Gate Status Coverage

Client-side decryption library for NoTIP telemetry payloads.

Fetches encrypted sensor measurements from the NoTIP Data API, resolves the encryption keys from the Management API, and decrypts the data on the client using AES-GCM.

Installation

npm install @notip/crypto-sdk

Quick start

import { CryptoSdk } from "@notip/crypto-sdk";

const sdk = new CryptoSdk({
    baseUrl: "https://your-notip-instance.example.com",
    tokenProvider: () => "your-bearer-token",
});

// Query a page of decrypted measures
const page = await sdk.queryMeasures({
    from: "2026-01-01T00:00:00Z",
    to: "2026-01-02T00:00:00Z",
    limit: 100,
});

console.log(page.data); // PlaintextMeasure[]

Configuration

| Option | Type | Required | Description | | --------------- | --------------------------------- | -------- | -------------------------------------------------------- | | baseUrl | string | yes | Base URL of the NoTIP backend (no trailing slash) | | tokenProvider | () => string \| Promise<string> | yes | Callback that returns a valid Bearer token | | fetcher | typeof fetch | no | Custom fetch implementation (defaults to global fetch) |

API

CryptoSdk

Main entry point. Implements MeasureQuerier, MeasureStreamer, and MeasureExporter. Prefer depending on the narrow interfaces rather than the concrete class.

queryMeasures(query: QueryModel): Promise<QueryResponsePage>

Fetches and decrypts a paginated page of measures.

const page = await sdk.queryMeasures({
    from: "2026-01-01T00:00:00Z",
    to: "2026-01-02T00:00:00Z",
    limit: 50,
    cursor: page.nextCursor, // pagination
    gatewayId: ["gw-1"], // optional filters
    sensorId: ["sensor-42"],
    sensorType: ["temperature"],
});

streamMeasures(query: StreamModel, signal?: AbortSignal): AsyncGenerator<PlaintextMeasure>

Streams live measures over SSE and decrypts each one as it arrives.

const controller = new AbortController();

for await (const measure of sdk.streamMeasures(
    { gatewayId: ["gw-1"] },
    controller.signal
)) {
    console.log(measure);
}

// Stop the stream early
controller.abort();

The SSE connection stays open for the lifetime of the generator. Always either exhaust the generator or abort via signal to release the connection.

exportMeasures(query: ExportModel): AsyncGenerator<PlaintextMeasure>

Exports and decrypts a full range of measures in bulk (no pagination).

for await (const measure of sdk.exportMeasures({
    from: "2026-01-01T00:00:00Z",
    to: "2026-01-31T23:59:59Z",
    sensorType: ["humidity"],
})) {
    console.log(measure);
}

Models

PlaintextMeasure

interface PlaintextMeasure {
    gatewayId: string;
    sensorId: string;
    sensorType: string;
    timestamp: string;
    value: number;
    unit: string;
}

QueryResponsePage

interface QueryResponsePage {
    data: PlaintextMeasure[];
    nextCursor?: string;
    hasMore: boolean;
}

QueryModel

interface QueryModel {
    from: string; // ISO 8601 datetime
    to: string; // ISO 8601 datetime
    limit?: number;
    cursor?: string; // opaque pagination cursor
    gatewayId?: string[];
    sensorId?: string[];
    sensorType?: string[];
}

StreamModel

interface StreamModel {
    gatewayId?: string[];
    sensorId?: string[];
    sensorType?: string[];
}

ExportModel

interface ExportModel {
    from: string; // ISO 8601 datetime
    to: string; // ISO 8601 datetime
    gatewayId?: string[];
    sensorId?: string[];
    sensorType?: string[];
}

Errors

All errors extend SdkError.

| Class | When thrown | | ----------------- | ----------------------------------------------------------- | | ApiError | The backend returns a non-2xx HTTP response | | ValidationError | A response payload fails schema validation after decryption | | DecryptionError | AES-GCM decryption fails (wrong key, corrupted ciphertext) |

import { ApiError, DecryptionError, ValidationError } from "@notip/crypto-sdk";

try {
    const page = await sdk.queryMeasures({ from, to });
} catch (err) {
    if (err instanceof ApiError) {
        console.error(`HTTP ${err.status}: ${err.message}`);
    }
}

Development

npm install
npm run build          # compile to dist/
npm test               # run tests once
npm run test:watch     # watch mode
npm run check          # format + typecheck + lint

Update generated API types

npm run fetch-dtos

This fetches the OpenAPI contracts from the running backend and regenerates the Zod DTOs under src/generated/.

License

AGPL-3.0-only