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

@procteye/proctor-js

v2.1.0

Published

Framework-agnostic browser proctoring SDK. Runs gaze/head-pose/object/audio anomaly detection in the candidate's browser, reports violations + heartbeats to the Procteye backend, and lets the server own the integrity verdict.

Readme

@procteye/proctor-js

Framework-agnostic browser proctoring SDK. A third party embeds it in their web app to run gaze / head-pose / object / audio anomaly detection directly in the candidate's browser.

It is an anti-cheat integrity layer: it assumes the candidate is adversarial and the environment is tamperable. The SDK detects, reports, and heartbeats to the Procteye backend — the server computes the authoritative verdict. Everything the SDK emits locally (the risk score in particular) is advisory only.

  • Zero framework dependency (no React). Works from ESM, CJS, or a plain <script>.
  • Tauri-free — the desktop-lockdown coupling has been fully removed.
  • Per-user 3σ behavioral baseline, cumulative 0–100 risk score, warn@30 / remove@70.
  • Offline-resilient violation delivery (localStorage queue + exponential backoff).
  • Anti-tamper heartbeat with a monotonic sequence.

Install

Not yet published. This package has not been pushed to the npm registry, so npm install @procteye/proctor-js and the jsDelivr URL below will not resolve until a release is published. Until then, consume it via a git or workspace dependency (npm install github:the-genie/procteye-packages#dev or a local file: reference), or npm run build and copy dist/ directly.

npm install @procteye/proctor-js

MediaPipe (@mediapipe/tasks-vision, pinned to 0.10.35) is a regular dependency and is installed automatically. The WASM runtime + models are fetched at runtime from jsDelivr / Google storage by default; both are overridable for self-hosting (see below).

Or load the prebuilt CDN bundle (exposes window.Procteye) once published:

<script src="https://cdn.jsdelivr.net/npm/@procteye/proctor-js/dist/proctor.min.js"></script>

Requires a secure context (HTTPS or localhost) — getUserMedia is unavailable otherwise.


Quickstart (<10 lines)

import Procteye from "@procteye/proctor-js";

const session = await Procteye.init({ sessionId, clientSecret }); // pe_cs_v2_live_...
if (!(await session.preflight()).cameraOk) throw new Error("camera required");
await session.requireConsent({ granted: candidateAccepted }); // explicit UI decision
await session.calibrate(); // headless 8-point gaze calibration
session.on("violation", (v) => console.log(v.type, v.severity));
session.on("flag", (f) => {
  if (f.level === "remove") endExam();
});
await session.start(); // detection + heartbeat begin
// ... later ...
const completion = await session.complete();
if (completion.status !== "complete") {
  // Do not treat the local session as fully delivered. Preserve the result
  // for the host application's retry/recovery flow.
  console.warn(
    completion.pendingEvidenceCount,
    completion.pendingViolationCount,
  );
}

Public API

Procteye.init(options) → Promise<ProctorSession>

| option | required | default | notes | | -------------- | -------- | -------------------------- | --------------------------------------------------------------------------------------------------------- | | sessionId | yes | — | issued by procteye-backend | | clientSecret | yes | — | pe_cs_v2_{live\|test}_<rawToken> (legacy pe_cs_{live\|test}_<rawToken> still accepted during rollout) | | apiBaseUrl | no | https://api.procteye.com | Procteye API base URL (the browser signal routes under /external/v1) | | assetBaseUrl | no | pinned jsDelivr WASM | MediaPipe WASM runtime base | | modelBaseUrl | no | Google model storage | MediaPipe model base |

init parses the secret eagerly and throws on a malformed clientSecret. The canonical form is pe_cs_v2_{mode}_<rawToken>; the legacy pe_cs_{mode}_<rawToken> form (no v2) remains accepted during rollout. The pe_cs_v2_{mode}_ (or legacy pe_cs_{mode}_) prefix is stripped; the remaining raw token is used as a scoped, append-only Bearer token, and the mode (test | live) is retained.

ProctorSession

const caps = await session.preflight(); // { cameraOk, permissionsOk, fps, modelsLoaded }
const consent = await session.requireConsent({ granted: candidateAccepted }); // required before start
await session.calibrate(); // headless 8-point; or pass { points } / { overlay:false }
await session.start(); // begins detection + heartbeat
await session.complete(); // stops capture and reports complete/pending/failed delivery state

session.calibration; // CalibrationController for custom calibration flows
session.isDegraded; // true if any detector/camera failed
session.test?.trigger("multiple_faces"); // test mode only — enqueues a source:"simulated" violation

Behavioral baselines settle automatically after start(): 60s for the gaze/behavioral detector and 15s for audio. No violations are reported during a baseline window. The audio baseline accepts only quiet frames; one 15-second retry is attempted and the audio detector emits a degraded event if it still cannot establish one. Consent is per-session: start() rejects until requireConsent({ granted: true }) resolves, and a declined record never authorizes capture.

Events

session.on("violation", (v) => {}); // { type, confidence, severity, ts }
session.on("risk", (r) => {}); // { score, delta } — LOCAL/advisory only
session.on("flag", (f) => {}); // { level: "warn"|"remove", threshold: 30|70, score }
session.on("degraded", (d) => {}); // { detector, reason } — model/camera failure
session.on("ended", (e) => {}); // { reason }

on(...) returns an unsubscribe function.

Named exports

ProctorSession, mountBadge, setLogger, noopLogger, consoleLogger, listDevices, isMediaSupported, runCalibrationOverlay, CalibrationController, STANDARD_8_POINTS, VERSION.

Trust badge

import { mountBadge } from "@procteye/proctor-js";
const unmount = mountBadge(document.getElementById("footer")!); // "Proctored by Procteye"

Anti-tamper model — why the server owns the verdict

The candidate controls the browser, so nothing the client says can be trusted on its own. The SDK's job is to make tampering observable, not to adjudicate:

  • Heartbeat. Every 10s the SDK POSTs to /external/v1/sessions/{sessionId}/heartbeat:
    {
      "seq": 42,
      "framesProcessed": 4021,
      "detectorsAlive": 4,
      "cameraOn": true
    }
    • seq is monotonic — a gap on the server means the client was suspended, backgrounded, or killed.
    • detectorsAlive (0–4) + cameraOn let the server catch a client that quietly disabled detectors or the camera.
  • Graceful degradation, never silent. If a MediaPipe model or the camera fails, the SDK emits a degraded event, sets session.isDegraded, and lowers detectorsAlive in the heartbeat. It will never run fewer detectors and keep reporting all-clear.
  • Offline resilience. Violations that fail to send are queued to localStorage and retried with exponential backoff (flushed on online and on complete()), so a candidate can't wipe evidence by dropping the network. Evidence clips are persisted separately in IndexedDB before their violation acknowledgement and are retained until the evidence endpoint returns a non-empty evidence_url.
  • Bounded delivery. Each telemetry request has a 15-second deadline. A timeout remains retryable; complete() returns pending or failed when durable delivery is incomplete rather than waiting indefinitely. Teardown cancels in-flight requests and does not schedule new retries.

The server correlates violations, heartbeat gaps, and evidence clips to compute the authoritative integrity verdict. The local 0–100 risk score is advisory UI only.

Transport contract

| purpose | request | | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | Violation | POST {apiBaseUrl}/external/v1/sessions/{sessionId}/violations — JSON { violation_type, confidence, severity, evidence, source:"browser" }, Bearer | | Evidence | POST {apiBaseUrl}/external/v1/sessions/{sessionId}/violations/{violationId}/evidence — multipart file (webm), Bearer | | Heartbeat | POST {apiBaseUrl}/external/v1/sessions/{sessionId}/heartbeat — JSON { seq, framesProcessed, detectorsAlive, cameraOn }, Bearer |


Why this SDK does not sign its reports

The Procteye Focus desktop app signs every violation post with a per-session HMAC key, and the server requires that signature. This SDK does not, and deliberately cannot.

The signing key is issued only to the desktop session credential (POST /api/sessions/{id}/signing-key rejects every other credential type). Procteye Focus can hold it safely because its Tauri native process fetches and keeps the key while the webview only asks it to sign — the key never enters the JavaScript heap. This SDK is the JavaScript heap, and it runs on a machine the candidate controls, so any key handed to it is readable from devtools.

That matters more than it might look. A candidate-readable key does not just fail to add security: it produces signatures that verify, which would let a forged or suppressed report carry the same cryptographic weight as a genuine one. An unsigned report that is understood to be unsigned is safer than a signed one that means nothing.

So browser-only sessions are attributable by session credential, not by signature — which is exactly what the BASIC assurance tier means. STANDARD adds a paired mobile observer and HIGH hands off to the Procteye Focus desktop app; both of those clients are native and can hold a key outside the candidate's reach. If your threat model needs cryptographic attribution of individual reports, require one of those tiers.

MediaPipe self-hosting (CSP)

By default the SDK loads the tasks-vision WASM runtime from jsDelivr (pinned to 0.10.35) and the FaceLandmarker / EfficientDet-Lite0 models from Google storage. Under a strict Content-Security-Policy you can host both yourself and point the SDK at them:

await Procteye.init({
  sessionId,
  clientSecret,
  assetBaseUrl: "https://cdn.your-app.com/mediapipe/wasm", // [email protected]/wasm
  modelBaseUrl: "https://cdn.your-app.com/mediapipe/models", // must contain the two model paths
});

modelBaseUrl must expose:

  • /face_landmarker/face_landmarker/float16/1/face_landmarker.task
  • /object_detector/efficientdet_lite0/int8/1/efficientdet_lite0.tflite

Pinned URLs do not verify fetched bytes. The current SDK has no authoritative release manifest mapping every MediaPipe WASM binary and model URL to a SHA-256 digest, so it does not claim binary integrity. A live deployment that requires that control needs a signed, versioned manifest from its asset publisher with exact HTTPS origins, paths, and digests; the SDK must verify each downloaded binary before handing it to MediaPipe.


Test mode

Boot with a pe_cs_v2_test_... secret. This exposes session.test:

const session = await Procteye.init({
  sessionId,
  clientSecret: "pe_cs_v2_test_...",
});
await session.start();
session.test?.trigger("multiple_faces"); // enqueues a REAL violation tagged source:"simulated"

session.test is undefined when booted with a live secret. Simulated violations travel the same transport path as genuine detections but carry source:"simulated" so the backend can exclude them from the verdict.


Logging

The SDK is silent by default in production (NODE_ENV === "production") and logs to console otherwise. Route logs anywhere:

import { setLogger, noopLogger } from "@procteye/proctor-js";
setLogger(noopLogger); // fully silence
setLogger(myTelemetrySink); // your own Logger implementation

Build outputs

| entry | file | | ---------- | ----------------------------------------- | | CommonJS | dist/cjs/index.js | | ESM | dist/esm/index.js | | Types | dist/cjs/index.d.ts | | CDN / IIFE | dist/proctor.min.js (window.Procteye) |

The build also writes dist/proctor.min.js.map for the CDN upload. The npm package leaves it out (files in package.json), so installs stay small.

npm run build       # cjs + esm + type decls + CDN bundle
npm run typecheck   # tsc --noEmit

No CDN upload exists yet: the bundle reaches jsDelivr and unpkg through the npm package (see RELEASING.md).

Development

npm ci
npm run lint && npm run typecheck
timeout 600 npm test

Repository rules: AGENTS.md. Releases: RELEASING.md.

Changelog

2.1.0

  • Telemetry now goes to the Procteye API's browser signal routes: POST {apiBaseUrl}/external/v1/sessions/{sessionId}/heartbeat, /violations and /violations/{violationId}/evidence. The old /api/sessions/... paths were never served by https://api.procteye.com, so earlier versions could not deliver violations or heartbeats there. Upgrade to 2.1.0.
  • apiBaseUrl is documented as the Procteye API base URL (default https://api.procteye.com), not a backend URL.

Links

  • Documentation: https://docs.procteye.com
  • npm: https://www.npmjs.com/package/@procteye/proctor-js

License

MIT © Procteye