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

@akku-work/consent-sdk-auth

v0.1.0-beta.1

Published

Akku Consent - zero-dependency SDK for authenticated web applications. Identity travels only inside a host-signed subject token.

Readme

@akku-work/consent-sdk-auth

Consent and preference management for an authenticated web application. Zero runtime dependencies.

This is the authenticated plane. Use it when the person whose consent you are recording is signed in to your app and you can prove who they are. If you need a cookie banner for anonymous visitors, use @akku-work/consent-sdk instead — the two are separate packages with separate release cadences, and they are not interchangeable.

This package is headless: it decides, it does not draw. It resolves each published purpose to a legal basis, a validity window and an outcome, and leaves rendering to you. For ready-made React components, add @akku-work/consent-sdk-react.

Install

npm install @akku-work/consent-sdk-auth

Usage

import { ConsentManager } from "@akku-work/consent-sdk-auth";

const consent = new ConsentManager({
  apiHost: "https://consent.nova.example",
  siteKey: "sk_live_9f2c…",
  applicationId: "nova-bank-web",
  getSubjectToken: () => session.fetchConsentToken(),
});

const states = await consent.getPurposeStates();
for (const state of states) {
  // "disclose" | "ask" | "silent" | "re-ask" | "re-confirm"
  console.log(state.key, state.outcome, state.granted);
}

// Only the purposes that still need a surface, in the order they were published.
const toAsk = await consent.purposesToAsk();

There is no userId parameter

Identity travels only inside the host-signed subject token returned by getSubjectToken(). The API has no option to pass a subject identifier directly, and this is not an oversight.

A user id handed over from the browser is a claim, not a credential — anyone with devtools open can pass a different one. The backend derives the authenticated subject itself by verifying the token's signature, exp, aud and iss; a body-supplied user id on this plane is rejected outright rather than silently preferred. If you find yourself wanting to pass one, the token wiring is what needs fixing.

getSubjectToken may be sync or async and is called fresh before every request, so refresh and rotation stay entirely yours.

The five outcomes

getPurposeStates() is the whole point of this package. Each purpose resolves to one outcome, and rendering from outcome rather than from granted is what keeps two opposite mistakes from creeping in — needlessly re-prompting someone who already answered, and treating a stale consent as current.

| Outcome | Meaning | | ------------ | -------------------------------------------------------------- | | disclose | Disclosed, never prompted — a necessary or legal_obligation basis. | | ask | Nothing on file. Ask. | | silent | Decided, still fresh, under the current policy. Say nothing. | | re-ask | Decided but past its validity window. Ask again as a NEW decision. | | re-confirm | Decided under a policy version since superseded. Ask again as a re-confirmation. |

"Granted but lapsed" and "granted under a replaced policy" are both granted: false with an outcome that says why. Collapsing them loses the distinction that matters.

API

| Member | Purpose | | --------------------------------- | ---------------------------------------------------- | | getPurposeStates(now?) | Every published purpose joined with its outcome. | | purposesToAsk(keys?) | Only the purposes that still need a surface. | | hasConsent(key) | Is this purpose granted right now? | | getPurposes() | The published purpose list, unmodified. | | getConsentState() | The raw decision map. | | getPreferences() | Preference-centre state. | | grantConsent(id) | Grant one purpose. | | updateConsent(decisions) | Record a per-purpose decision map. | | recordDecisions(decisions) | Record decisions taken from a surface. | | savePreferences(decisions) | Persist a preference-centre submission. | | withdrawConsent(id?) | Withdraw one purpose, or all of them. | | onChange(listener) | Subscribe; returns an unsubscribe function. | | request<T>(path, init?) | Authenticated call against the Akku API. |

resolvePurposeStates, basisOf and purposesNeedingDecision are also exported as pure functions, for deciding against purposes and a stored record you already hold.

Optional UI helpers

import { … } from "@akku-work/consent-sdk-auth/ui";

A separate entry point on purpose. An app that never imports it pays zero bundle cost — index.ts never reaches into it.

Licence

Proprietary. See LICENSE — publication on npm grants no licence to use this software.