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

@bandeira-tech/b3nd-canon

v0.11.0

Published

B3nd Canon — protocol-building toolkit: msg, hash, auth, encrypt

Readme

B3nd Canon

Protocol-building toolkit for B3nd. Message envelopes, content addressing, access control, and encryption -- the pieces a protocol designer composes on top of the core framework.

GitHub

Depends on @bandeira-tech/b3nd-core for types and encoding.

Message Layer

The message primitive is [uri, payload]. When the payload follows the MessageData convention it carries { auth, inputs, outputs } -- a signed envelope that the rig decomposes into individual writes.

import {
  message,
  messageDataHandler,
  messageDataProgram,
} from "@bandeira-tech/b3nd-canon/msg";
import {
  connection,
  DataStoreClient,
  Identity,
  MemoryStore,
  Rig,
} from "@bandeira-tech/b3nd-core";

const client = new DataStoreClient(new MemoryStore());

const rig = new Rig({
  routes: {
    receive: [connection(client, ["*"])],
    read: [connection(client, ["*"])],
  },
  programs: { "hash://sha256": messageDataProgram },
  handlers: { "msgdata:valid": messageDataHandler },
});

const id = await Identity.generate();
const auth = [
  await id.sign({ inputs: [], outputs: [["mutable://open/x", { v: 1 }]] }),
];
const envelope = await message({
  auth,
  inputs: [],
  outputs: [["mutable://open/x", { v: 1 }]],
});
// envelope = ["hash://sha256/{hex}", { auth, inputs, outputs }]

await rig.send([envelope]);
// The handler decomposes the envelope: persists the envelope at hash://,
// writes each output to its destination URI, and nullifies inputs.

Content Addressing

Hash-based URIs using hash://sha256/{hex}. JSON payloads canonicalized per RFC 8785 before hashing.

import {
  computeSha256,
  generateHashUri,
  verifyHashContent,
} from "@bandeira-tech/b3nd-canon/hash";

const hash = await computeSha256({ hello: "world" });
const uri = generateHashUri(hash);
// "hash://sha256/93a23971a914e5eacbf0a8d25154cda309c3c1c72fbb9914d47c60f3cb681588"

const result = await verifyHashContent(uri, { hello: "world" });
// { valid: true, algorithm: "sha256", digest: "93a2..." }

Hash Validator

Write-once enforcement for content-addressed storage:

import { hashValidator } from "@bandeira-tech/b3nd-canon/hash";

const rig = new Rig({
  routes: { ... },
  programs: { "hash://sha256": hashValidator(readFn) },
});

Access Control

Signature-based access control that composes with the rig as programs.

import {
  authValidation,
  createCombinedAccess,
  createPubkeyBasedAccess,
} from "@bandeira-tech/b3nd-canon/auth";

// Pubkey-based: mutable://accounts/{pubkey}/* requires matching signature
const pubkeyAccess = createPubkeyBasedAccess(readFn);

// Combined: pubkey namespace + relative path access lists
const access = createCombinedAccess(readFn);

// Wire into rig as a program
const validate = authValidation(access);

Encryption

Ed25519 signing, X25519 encryption, AES-GCM symmetric, and PBKDF2 key derivation. Shared with b3nd-core (Identity needs it).

import {
  createAuthenticatedMessage,
  decrypt,
  encrypt,
  generateEncryptionKeyPair,
  generateSigningKeyPair,
  sign,
  verify,
} from "@bandeira-tech/b3nd-canon/encrypt";

// Sign a payload
const keys = await generateSigningKeyPair();
const signature = await sign(keys.privateKey, { action: "transfer" });
const valid = await verify(
  keys.publicKeyHex,
  { action: "transfer" },
  signature,
);

// Encrypt (X25519 ECDH + HKDF + AES-GCM, forward secrecy via ephemeral keys)
const encKeys = await generateEncryptionKeyPair();
const encrypted = await encrypt(
  new TextEncoder().encode("secret"),
  encKeys.publicKeyHex,
);
const plaintext = await decrypt(encKeys.privateKeyHex, encrypted);

Libraries

| Library | Description | | -------------- | ----------------------------------------------------------------------- | | b3nd-msg | Message envelopes, MessageData convention, program + handler | | b3nd-hash | Content addressing (hash://sha256), link URIs, write-once validator | | b3nd-auth | Pubkey-based access control, relative path access, signature validation | | b3nd-encrypt | Ed25519, X25519, AES-GCM, PBKDF2, authenticated messages, PKCE |

Subpath Exports

import { ... } from "@bandeira-tech/b3nd-canon";           // everything
import { ... } from "@bandeira-tech/b3nd-canon/msg";       // message layer
import { ... } from "@bandeira-tech/b3nd-canon/hash";      // content addressing
import { ... } from "@bandeira-tech/b3nd-canon/auth";      // access control
import { ... } from "@bandeira-tech/b3nd-canon/encrypt";   // encryption & signing

Development

deno check src/mod.ts       # Type check
deno test libs/              # Run tests

Project Structure

src/           # Entry points and subpath re-exports
libs/          # 4 libraries (see table above)

Related

  • b3nd-core -- framework foundation (types, rig, clients, network)
  • b3nd-sdk -- SDK umbrella that re-exports core + canon

License

MIT