Skip to content

Kehto Runtime Documentation

Kehto is an early runtime implementation for NIP-5D napplets. It is one runtime, not the runtime for the napplet ecosystem. It is likely the first implementation and may become a useful reference implementation as other runtimes are built.

Alpha status: NIP-5D is still under development, and NAP contracts are not final. Package APIs, capability names, requires declarations, and injected-domain behavior may change as the spec evolves. See Alpha Status.

Kehto provides host-side packages that let a Nostr client embed sandboxed napplet iframe applications: access control, protocol dispatch, browser shell integration, reference services, relay discovery, and shell-owned window-management contracts.

Kehto works with the @napplet packages. @napplet/core, @napplet/shim, @napplet/nap, and @napplet/vite-plugin define the portable napplet-side protocol and build surface. Kehto consumes those contracts and implements the shell/runtime side.

Start Here

ReaderStart pathWhat you are trying to do
Host-app implementerRuntime implementation guideBuild a shell that hosts sandboxed napplets.
Protocol evaluatorAlpha statusUnderstand what is still draft-stage before treating Kehto as a reference implementation.
Package API consumerPackage referenceUnderstand one @kehto/* package and its exports.
Napplet authorNapplet integration tutorialDeclare requires, check injected domains, and use NAP helpers safely.
MaintainerDocs maintenance guideKeep README, site, API reference, and milestone history aligned.

Package Map

PackageRole
@kehto/aclPure capability state and enforcement primitives.
@kehto/runtimeBrowser-agnostic protocol engine, dispatch, ACL gates, service registry, and lifecycle.
@kehto/shellBrowser adapter: iframe/session lifecycle, postMessage, gateway loading, injected window.napplet domains, and shell policy.
@kehto/servicesReference service handlers for identity, relay, keys, media, notify, config, resource, cache, theme, and audio.
@kehto/nipFramework-agnostic unique Nostr NIP utilities (NIP-51 lists, NIP-65 outbox, NIP-66 relay discovery, NIP-89 app handlers).
@kehto/wmStructural window-management contracts for consumer-owned layout strategies.
@kehto/playground9-napplet browser demo and Playwright verification target.

Current Documentation Shape

  • Start explains the project, packages, and reader routes.
  • Concepts explain architecture, security boundaries, capability negotiation, and source-of-truth decisions.
  • Napplet Web Cache Strategy explains the recommended browser cache layer and eviction policy for verified napplet artifacts.
  • Implement a Napplet Artifact Cache shows how to wire the shipped @kehto/nip/5d Cache Storage adapter into a host resolver.
  • Tutorials walk through complete implementation paths.
  • How-tos answer focused operational tasks.
  • Package Reference documents each public package and links to generated API pages.
  • API Reference links to generated TypeDoc output under docs/api/.
  • Policies host current shell/NIP-5D policy documents.
  • Migration Archive keeps historical transition documents clearly marked as non-current guidance.

Historical Material

Documents under docs/migrations/ are preserved for project history. They describe already-shipped transitions and should not be used as current integration guidance unless a current guide links to a specific section deliberately.