Skip to content
TypeWire

@tahanabavi/type-permission

v0.1.0

Framework-less, dependency-free capability permissions: one shared bit map, evaluated identically on client and server, with layered resolution, codecs, a lock file and contract-linkable requirements.

Storage is a codec, never a second mode

The runtime value is always bigint; representations sit at the IO boundary:

ts
P.encode(perms, "base64url"); // JWT claim / cookie — smallest
P.encode(perms, "decimal"); // Postgres numeric/text; Discord-compatible
P.encode(perms, "names"); // ["chat.SEND_MESSAGES", …] — the JSON mode
P.decode(claim, "base64url"); // → bigint, on any runtime

Binary codecs (decimal · hex · base64url · chunks) are lossless — they carry unknown (newer-version) bits through untouched, so a service on an old version never silently revokes what a newer one granted. names / grouped are human-readable and lossy for unknown bits by nature.