jac-sv-auth

Defines Jac server-side authentication semantics for JWT, roles, and endpoint visibility.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/PMN123/trapdoor --skill jac-sv-auth-pmn123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jac-sv-auth
Source: https://github.com/PMN123/trapdoor/tree/main/.agents/skills/jac-sv-auth
Command: npx skills add https://github.com/PMN123/trapdoor --skill jac-sv-auth-pmn123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the wrong endpoint visibility in Jac silently leaks user data or blocks legitimate callers, because def:pub, def:priv, and def:protect behave differently than their names suggest. This Skill provides the canonical, verified reference for Jac's server-side auth model so you pick the right declaration every time. ## Core Features & Use Cases - Endpoint auth semantics: Canonical rules for def:pub (anonymous, shared guest graph), plain def / def:priv (JWT required, per-user root), and def:protect (same auth as :priv, only a source-visibility tier). - REST auth flow: Exact register/login curl shapes, including the identities-array registration body, token retrieval, and /user/me profile access. - Roles and JWT hardening: Built-in admin/system/user roles, admin API role assignment, and the production footgun of the default JWT signing secret. - Use Case: When building a per-user todo API in Jac, use this Skill to confirm that plain def endpoints isolate each caller's data on their own root, and to avoid writing user-specific data from a def:pub endpoint. ## Quick Start Ask which Jac endpoint visibility to use for an endpoint that reads and writes the current logged-in user's private data.

Frequently Asked Questions about jac-sv-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I require login for a Jac server endpoint?

Use a plain def or def:priv declaration, which both require a JWT and run on the caller's own root. Only def:pub skips authentication, so secure-by-default is the plain declaration.

What is the difference between def:pub, def:priv, and def:protect in Jac?

def:pub allows anonymous callers on a shared guest graph, while def:priv and plain def require a JWT and run per-user. def:protect has identical auth to def:priv; its three-way gradient controls source visibility, not authentication.

How do I register and log in a user via the Jac REST API?

POST to /user/register with an identities array and credential object, then POST to /user/login with a single identity and credential to receive a token. Registration returns no token, so login is a separate required call.

Why does my Jac endpoint return 401 UNAUTHORIZED?

A 401 means the endpoint is not def:pub and no valid Bearer token was sent. Do not fix it by switching to def:pub, since that changes which graph the endpoint runs on, not just who may call it.

Does Jac support user roles and admin permissions?

Yes, Jac has built-in admin, system, and user roles stored on the user and carried in JWT claims. Set roles via the admin API or admin portal; app-domain roles use a role field on a node checked inside authenticated endpoints.

What are the JWT security risks in Jac production deployments?

The default signing secret is publicly known, letting anyone forge tokens for any user. Set a real secret via the scale.jwt config or JWT_SECRET environment variable; note that tokens cannot be revoked before expiry.