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

@useoneauth/trust

v1.0.0

Published

> Phase 7 — Trust Engine. Continuous, adaptive trust evaluation: signals → risk score → allow / step-up / deny.

Downloads

314

Readme

@useoneauth/trust

Phase 7 — Trust Engine. Continuous, adaptive trust evaluation: signals → risk score → allow / step-up / deny.

Pure TypeScript. A TrustEngine composes pluggable signals (device, location, credential-type, behavior, context-drift), each contributing risk points; the engine sums to a score, maps it to an outcome by thresholds, and lets critical signals (session hijacking / context drift) hard-gate the result. A TrustWatcher runs the engine as a watcher over the event stream — continuous, per-action revaluation rather than an inline proxy.

Implements the runtime-identity principles in ../../context/runtime-identity-principles.md (#1–#6).

Install

// package.json
{ "dependencies": { "@useoneauth/trust": "workspace:*" } }

Usage

import {
  TrustEngine, TrustWatcher,
  DeviceSignal, LocationSignal, CredentialTypeSignal, BehaviorSignal, ContextDriftSignal,
} from "@useoneauth/trust"
import { EventBus, InMemoryEventStore } from "@useoneauth/events"

const events = new EventBus(new InMemoryEventStore())
const engine = new TrustEngine({
  signals: [new DeviceSignal(), new LocationSignal(), new CredentialTypeSignal(), new BehaviorSignal(), new ContextDriftSignal()],
  events,
})

// Session bound to device "d1" but the request comes from "dX" → hijacking.
const decision = await engine.evaluate({
  subjectId: "u1",
  sessionId: "s1",
  device: { deviceId: "dX" },
  expected: { device: { deviceId: "d1" } },
})
// { outcome: "deny", score: 100, level: "low", reason: "score 100 → deny (critical: context_drift)", signals: [...] }

// Run continuously as a watcher over the event stream:
new TrustWatcher(engine, events, {
  events: ["SESSION_CREATED", "TOKEN_ISSUED"],
  toContext: (e) => {
    const p = e.payload as { identityId?: string; sessionId?: string }
    return p.identityId ? { subjectId: p.identityId, ...(p.sessionId ? { sessionId: p.sessionId } : {}) } : null
  },
  onDecision: (d) => {
    if (d.outcome !== "allow") {/* feed policy stepUp obligation / revoke session */}
  },
}).start()

Model

  • Signals — each TrustSignal.evaluate(context) returns { signal, risk, critical?, reason? }. Built-ins: DeviceSignal, LocationSignal, CredentialTypeSignal, BehaviorSignal, and the critical ContextDriftSignal (device/location mismatch vs the bound baseline).
  • Enginescore = Σ risk; base outcome by thresholds (stepUp default 30, deny default 70); any critical signal with risk > 0 hard-gates to at least step_up (or deny if its risk reaches the deny threshold). The final outcome is the most severe of the base and critical outcomes.
  • Outcomesallow / step_up / deny; step_up is consumed by the Phase-6 policy stepUp obligation at the orchestration layer above.
  • Watcher — subscribes to event types, maps each event to a TrustContext, evaluates, and reports via onDecision. Observability-driven, never inline.

Events

TRUST_EVALUATED on every evaluation (subjectId, sessionId, outcome, score, level, signals) via the @useoneauth/events-core EventPublisher — wire the Phase-5 EventBus for a durable, replayable trust audit trail.

Scope

No ML/probabilistic scoring; drift is equality-based (no impossible-travel-by-time geo math); the expected baseline is passed in the context (no baseline store yet); no DB/HTTP/CLI. Trust→policy and trust→revocation wiring is orchestration above the package.

See ARCHITECTURE.md.