Table Schema
-
idunique id for this row -
workspaceIdEvery role is scoped to a workspace, no role sharing between tenants -
keyIdThe key holding this role -
role: stringthe actual name of a role, ie:finance(or more elaborate, see below) This is completely up to the user, the only limitation is a length ≤ 512chars for our own roles, we’ll likely do some schema for roles, likeapi::\{id\}::create_key
- roles by key
- roles by workspace
- keys by role
Unkey internal role schema
* denotes either an id or a wildcard
api::*::create_api) seem overly complicated, because the wildcard will always be present, since it’s impossible to write this role in advance without knowing the api_id that will get generated later, but by sticking with this schema, we stay consistent and can build our types and tooling more easily.
We could go deeper like api::*::keys::*::read_key but I’m not convinced anyone needs this and it just adds complexity for now. It’s trivial to add more roles later, let’s wait it out.
Examples
- A key should be allowed to create new apis, modify them and be able to perform all actions on keys.
- Update access to one api and its keys, read access to all apis and their keys

