Principal

link-principal is who acts, or may, as one type: <kind>:<id>, such as machine:<its id>, person:slack:T0ACME/U0ALICE or chat:slack:C0TEAM, as the account service's API names it. An access token's subject (link-api, whose generated types are these), a spec's [access] and a message's Link-From all name a principal with it, so they can't disagree; link-api's test holds its grammar to the API's.

Its kinds

PrincipalKind is what comes before the first :, one of KINDS: machine, person, agent, service, api-key, chat, webhook and guest, written in kebab case. An API key and a guest always have an end (PrincipalKind::expires).

Its id

After the kind, an id of 1 to ID_MAX, 128, bytes: ASCII letters, digits and ID_PUNCTUATION, ._:/-. It's opaque: a : or / in it is its own, and Principal::id gives it back whole.

Made only by parsing

A Principal is made only by parsing, so every one is well formed; what isn't one, or isn't a kind, is NotOne, saying why.