ppoppo-token
JWT (RFC 9068, EdDSA) issuance and verification engine for the Ppoppo ecosystem.
A single deep module that hides RFC 8725 mitigations M01–M45, JWKS handling,
algorithm pinning, header/claim/domain checks, and substrate ports (epoch,
session, replay) behind a two-function surface: issue and verify.
Quick start — verifier (most consumers)
[]
= "0.1"
use ;
async
The single verify entry-point funnels every flow through one engine — no
direct jsonwebtoken calls outside the engine, no parallel decode paths,
and no transport-aware branches (M38 invariant: cookie and Bearer-header
are the same surface; consumer middleware extracts the bare token before
calling verify).
What is hidden
The engine owns the algorithm. Consumers never:
- Decode JWT segments or pick an
alg— the engine pinsEdDSA(sealedAlgorithmenum, M51/M52/M54 structurally uncompilable outside the engine). - Manage replay caches, session liveness, or per-account epoch checks —
these are substrate ports (
ReplayDefense,SessionRevocation,EpochRevocation); pass an implementation inVerifyConfig. - Parse JWKS by hand —
Jwks::into_key_setbuilds aKeySet, andKeySetrotates keys without consumer involvement.
Quick start — issuer (PAS only)
use Duration;
use ;
let key = from_ed25519_pem?;
let cfg = access_token;
let req = new;
let token: String = issue?;
Issuance is intentionally synchronous (no I/O) and lives in the same engine — adding a parallel issuance path would fork the algorithm and silently allow header drift between issuers and verifiers.
Shared cache contract (cross-substrate)
When multiple processes verify tokens against a shared session_version
cache, all readers/writers MUST agree on the key shape and TTL:
use ;
let key = sv_cache_key; // → "sv:01HK..."
// TTL contract: 60 seconds. Bounds post-break-glass staleness window.
Format-coupling the cache key through the engine prevents drift between PAS
(writer) and consumers (PCS chat-auth, the pas-external SDK) — no string
duplication on the consumer side.
Stability
0.x: pre-1.0 SemVer. Minor bumps may break the public surface.- The engine surface (
verify,issue,Claims,Algorithm,VerifyConfig,IssueConfig,IssueRequest,KeySet,Jwks,AuthError,IssueError) is the durable contract. - Substrate port traits (
ReplayDefense,SessionRevocation,EpochRevocation) may add methods in 0.x; pin a minor version if you implement them outside this workspace.
License
MIT.