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

@docstack/abe

v0.1.1

Published

CP-ABE (AC17) primitives for DocStack cryptographic access scopes: rabe compiled to WASM, policy normalization, CEK wrap/unwrap (ADR-0045)

Downloads

199

Readme

npm Docs License

@docstack/abe

The cryptography behind DocStack access scopes.

CP-ABE, the AC17 scheme, from rabe compiled to WASM, with the policy normaliser and the authority helpers that mint keys and seal scope content keys. @docstack/client depends on it and loads it lazily, only when a stack declares scopes; application code on a device never imports it.

An access scope is a named set of content whose encrypted fields seal under one 32-byte content key, and that key is sealed under an attribute policy such as ("role:manager" and "dept:sales") or "clearance:secret". A device whose attribute key satisfies the policy opens the scope; one whose key does not holds the same ciphertext and reads null. Denial is decryption failure, not a check, so it binds the device owner too.

Two halves, one module

Authority half: runs where the application controls it, its server, an admin ceremony, a script. Master keys never belong on end-user devices.

import { setup, keygen, wrapCek } from '@docstack/abe';

const { pk, msk } = await setup();                    // once; keep msk secret, pk may be public
const aliceKey = await keygen(msk, ['role:hr', 'dept:people']);
const sealed = await wrapCek(pk, '"role:hr" or "clearance:exec"', contentKey);   // 32 bytes in, opaque blob out

In practice ClientStack.buildAccessScope({ scopeId, policyString, pk }) from @docstack/client calls wrapCek for you and returns a complete ~AccessScope document: a fresh content key sealed under the policy, its key id, and a per-scope canary. Ship that document in an application patch and every device holds it.

Client half: the one call the engine makes.

import { decryptCek } from '@docstack/abe';

const cek = await decryptCek(attributeKey, sealed);   // Uint8Array, or null when the policy is not satisfied

Policies

import { normalizePolicy, parsePolicy, policyAttributes } from '@docstack/abe';

normalizePolicy('"a" and "b" and "c" and "d"');   // '(("a" and "b") and ("c" and "d"))'
policyAttributes('("role:hr" or "clearance:exec")'); // ['role:hr', 'clearance:exec']

Formulas are monotone: and, or, parentheses, "kind:value" literals. No negation, no code. The scheme's converter needs balanced parentheses and panics on long unbalanced and chains, so every sealing call normalises the formula first; normalizePolicy throws on not.

Keys and blobs are opaque

Every key and ciphertext is a string. rabe serialises 64-bit limbs that do not survive a JavaScript JSON round-trip, so store and transport these blobs verbatim and never parse them.

Status

Experimental cryptography, unaudited. rabe's BN254 backend carries roughly a 100-bit modern security margin; an audit gates any production claim. The reasoning, the alternatives measured and the residual risks are in ADR-0045 and the threat model.

Building from source

The WASM under src/wasm is vendored and regenerated by npm run build:wasm, which needs the Rust toolchain with the wasm32-unknown-unknown target and wasm-bindgen-cli matching the version in rust/Cargo.lock. npm run build compiles the TypeScript and copies the vendored artifacts into lib/; npm test runs a smoke test through the WASM.

Documentation

License

CC-BY-SA-4.0 · © Onyx AC, LLC. rabe is licensed under the MIT license.