API Reference

Kizuna.permissions

Declare every permission an API has, for roles to hold and routes to require.

Alpha

The least settled part of kizuna. Kizuna.permissions may change shape, move out of the contract, or be removed before v2. Pin your version, and expect to rewrite what you build on it.

Kizuna.permissions(catalog) declares every permission that exists, grouped by what it acts on. Roles are built from it, routes name what they require from it, and nothing outside it can be required or held.

permissions.ts
import { Kizuna } from '@ts-kizuna/core';

export const permissions = Kizuna.permissions({
    workspace: ['read', 'update', 'delete'],
    project: ['create', 'read', 'update', 'delete', 'share'],
    invite: ['send', 'cancel', 'accept'],
});
PropertyDescription
permissions.catalogThe catalog as declared.
permissions.namesEvery permission as resource:verb.
permissions.schemaA zod enum of names, for a body that sends a permission.

Pass it to Kizuna.roles to build roles that hold permissions. See Access Control.