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

@kehto/services

v0.2.0

Published

Reference service implementations for the napplet protocol — audio, notifications, and extensible service handlers

Readme

@kehto/services

Reference service handlers for the napplet protocol — audio, notifications, identity, relay pool, cache, keys (stub), media (stub), notify, theme.

Install

pnpm add @kehto/services

Overview

@kehto/services ships the reference implementations of the ServiceHandler contract defined by @kehto/runtime. Each factory returns an object that the runtime routes NIP-5D envelopes to based on the domain prefix of the incoming message type (e.g., identity.* goes to the handler registered under identity).

Host apps wire services into the runtime via runtime.registerService(name, handler). The services are browser-agnostic — they have no DOM dependency. Browser-specific behaviors (audio element pool, OS notifications) are delivered through host-supplied callbacks.

Canonical v1.2 posture:

  • The v1.1 signer service is deleted outright. Its responsibilities split into two: read-only identity lookups go through createIdentityService (getPublicKey, getRelays, getProfile, getFollows, getList, getZaps, getMutes, getBlocked, getBadges); signing happens inside the shell as part of relay.publish / relay.publishEncrypted and is never exposed to napplets.
  • createKeysService and createMediaService are stub-only in v1.3 — they accept the canonical envelopes and return well-formed responses, but real host backends (OS keybinding registration, audio/video playback control) must be plugged in by the host app in future milestones.
  • createNotifyService (NIP-5D notify.* NUB) coexists with the legacy createNotificationService (ifc-emit notifications:* channel). Both may be registered simultaneously until the legacy handler is retired.

Quick Start

import {
  createIdentityService,
  createNotificationService,
} from '@kehto/services';

// Identity service — read-only lookups backed by a signer adapter.
runtime.registerService(
  'identity',
  createIdentityService({
    getPublicKey: () => signer.getPublicKey(),
    getRelays: () => signer.getRelays(),
    getProfile: (pk) => nostrClient.fetchProfile(pk),
  }),
);

// Notification service — legacy ifc-emit channel, browser badge fan-out.
runtime.registerService(
  'notifications',
  createNotificationService({ onChange: (list) => updateBadge(list) }),
);

Public API

Each factory returns a ServiceHandler registrable via runtime.registerService(). The bullets below note the canonical NIP-5D domain the handler owns and the ACL capability napplets need in order to reach it.

Identity NUB

  • createIdentityServiceidentity.* reads (identity:read). No signing surface; shell mediates signing internally.

Notify NUB

Relay NUB

Keys NUB (stub in v1.3)

  • createKeysServicekeys.bind/unbind/bindings stub (keys:bind / keys:forward). Plug a real backend via the onBind/onForward hooks when the host supports OS key registration.

Media NUB (stub in v1.3)

  • createMediaServicemedia.* playback/transport stub (media:control). Plug a real media backend via the service options.

Theme NUB

  • createThemeServicetheme.get + theme.changed fan-out (theme:read). Returns a ThemeService with publishTheme() / setTheme() utilities for host-side updates.

Audio (legacy ifc-emit)

  • createAudioServiceaudio:* ifc-emit topic handler. Browser-agnostic registry of per-window audio sources; host wires onChange to update transport UI.

Types

AudioSource, AudioServiceOptions, Notification, NotificationServiceOptions, IdentityServiceOptions, RelayPoolServiceOptions, CacheServiceOptions, CoordinatedRelayOptions, KeysServiceOptions, MediaServiceOptions, NotifyServiceOptions, ThemeServiceOptions, ThemeService.

API Reference

Full API reference: docs/api/@kehto/services/ (generated via pnpm docs:api).

License

MIT