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

@dignetwork/dig-web-resolver

v0.2.1

Published

A CDN-droppable <script> that teaches any webpage to resolve urn:dig:chia: and chia:// references in-page, fail-closed, via @dignetwork/dig-urn-resolver.

Downloads

277

Readme

@dignetwork/dig-web-resolver

A CDN-droppable <script> that teaches any webpage to resolve urn:dig:chia:… and chia://… references in-page — the seamless DIG protocol bridge, powered by the canonical @dignetwork/dig-urn-resolver wasm engine.

Drop in one tag and an ordinary <img src="urn:dig:chia:…"> renders on a normal browser, with no plugin and no wallet — the loader finds DIG references in your images, media, stylesheets, CSS url(...), and links, resolves each through the engine, and swaps in the verified result. Every failure is fail-closed: you get the engine's branded error image, never unverified bytes.

Quick start — one tag

<!-- Inlined wasm: a true single-tag drop, no second fetch. -->
<script src="https://cdn.dig.net/dig-web-resolver.iife.js"></script>

<img src="urn:dig:chia:STORE_ID:ROOT/img/logo.png" alt="logo" />
<a href="chia://STORE_ID:ROOT/index.html">open the store</a>

That is all. The loader claims the page, scans it, watches for dynamically-added nodes, and resolves every DIG reference it finds.

Size-sensitive alternative (sidecar wasm)

<script src="https://cdn.dig.net/dig-web-resolver.iife.external-wasm.js"></script>
<!-- serves dig-web-resolver.wasm from the same directory as the script -->

Bundler / ESM

import { activate } from "@dignetwork/dig-web-resolver";
import wasmUrl from "@dignetwork/dig-urn-resolver/web/dig_urn_resolver_bg.wasm?url";

await activate({ wasm: new URL(wasmUrl, import.meta.url) });

Use ROOT-PINNED URNs for public pages (important)

The engine derives the decryption key from the URN itself, so a keyless browser reads a public store with the URN alone. But there is one rule that decides whether a reference resolves for a visitor who has no local DIG node:

Over the public gateway (rpc.dig.net), only ROOT-PINNED references resolve.

  • Root-pinnedurn:dig:chia:STORE:ROOT/path / chia://STORE:ROOT/path — resolves everywhere, including for a visitor with no local node. Use this form for any image/link that must render for the public. (This matches how NFT URNs are already minted — root-pinned, #686.)
  • ⚠️ Rootlessurn:dig:chia:STORE/path — resolves ONLY when the visitor is running a local dig-node (dig.local / localhost), which acts as the trust anchor. Over the public gateway a rootless reference is rejected (RootRequired) and the loader shows the branded error image (fail-closed — never a spoofable image), because its trust root would otherwise come from the same untrusted gateway serving the bytes.

Private stores add an out-of-band secret salt: urn:dig:chia:STORE:ROOT/path?salt=HEX.

Content Security Policy

Allow the loader to run the wasm engine and reach the DIG ladder:

Content-Security-Policy:
  script-src 'self' 'wasm-unsafe-eval';
  connect-src https://dig.local https://localhost:9778 https://rpc.dig.net;
  img-src 'self' blob: data:;

Full fidelity — the Service Worker tier (<script>, stylesheets, fonts)

The one-tag loader above resolves images, media, CSS url(...), and links. It cannot resolve <script>, <link rel=stylesheet>, or fonts — the browser fetches those itself at parse time, before an in-page resolver runs. For those, adopt Tier 2: a same-origin Service Worker that intercepts the browser's own subresource fetches and serves decrypted, merkle-verified bytes the browser then executes/applies natively.

A Service Worker must be same-origin, so Tier 2 is adopt-by-self-hosting:

  1. Copy the shipped SW to your origin root: cp node_modules/@dignetwork/dig-web-resolver/dist/dig-sw.js ./public/dig-sw.js

  2. Register it once, early, on your page:

    import { registerDigSW } from "@dignetwork/dig-web-resolver";
    await registerDigSW(); // registers /dig-sw.js at scope "/", HTTPS/localhost only
  3. Reference dig content on the surfaces the DOM loader can't fix, via the /__dig/ path (encodeURIComponent the URN):

    <script src="/__dig/urn%3Adig%3Achia%3ASTORE%3AROOT%2Fapp.js"></script>
    <link rel="stylesheet" href="/__dig/urn%3Adig%3Achia%3ASTORE%3AROOT%2Fapp.css" />

The SW resolves each through the same engine, fail-closed: a verified success is served under its real content type; any failure (tamper, unreachable, rootless-over-rpc) is a NON-2xx branded page with nosniff, so untrusted bytes NEVER execute.

Security boundary. SW-served <script> runs in your origin. This is correct for a dedicated dig origin (the whole origin is the store). On a mixed page it is your own trust decision — inherent in the fact that you self-host + register the SW. First-load note: the very first uncontrolled page load's parse-time subresources aren't intercepted until the guarded one-time reload takes control; steady state is full fidelity. See SPEC.md §10.

What it resolves

<img src|srcset>, <source> (picture/video/audio), <video|audio src|poster>, <link rel=icon|preload|stylesheet href>, author-set CSS url(...) (a style attribute or a <style> element), and <a href> (intercepted — the verified content opens in an isolated, opaque-origin sandbox, never the host page). It never touches forms, fetch/XHR, or computed styles.

Coexistence with the DIG browser extension

The loader claims window.__digWebResolver once (frozen, first-to-claim-wins). If the DIG browser extension is present it claims the page first and your embed defers cleanly — there is never a double-resolve. Embedding the tag is always safe.

License

GPL-2.0-only (inherited from the @dignetwork/dig-urn-resolver read-crypto).

See SPEC.md for the normative embed contract.