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.

Roles, and the escalation guard

ts
const roles = P.defineRoles({
viewer: ["chat.VIEW_CHANNEL"],
moderator: ["chat.VIEW_CHANNEL", "chat.MANAGE_MESSAGES"],
});

P.canGrant(actorPerms, roles.moderator); // false unless the actor holds every bit

canGrant closes the classic hole where a moderator mints an ADMINISTRATOR role and assigns it to themselves.