Service credentials
A service, such as a partner's system or a worker, signs in with a key. Each service has an owner, a status, and any number of keys. Each key expires, can be revoked on its own, and can overlap with the next, so you can rotate a key without downtime. A key is shown once when it is issued, and Jadpo keeps only a verifier of it.
You declare only the service's entity:
// domains/identity/entities/service.jadpoentity Service { id: Uuid owner_id: User.id { on_delete: OnDelete.restricted } name: Text { unique: true } status: ServiceStatus}
Jadpo stores the keys, as it stores browser sessions, and generates three
operations on the entity to issue, list and revoke them:
Service.issue_key(service_id, expires_at), Service.keys(service_id) and
Service.revoke_key(key_id).
- The operations belong to the entity the principal's
service:names, onceauthentication { }declaresservice_key:. - Only an action calls them (
type.auth_sessions_context), as it callssessions.start. AGETroute can also runkeysitself (Listing from aGETroute). Service.issue_key(service_id, expires_at)takes the service'sidand anInstant, keeps the new key in the action's transaction and gives it once as aServiceKey, text anOutputcan send; the response that carries it is never kept for an idempotent repeat, and aServiceKeycan't be stored in an entity.Service.keys(service_id)lists the service's keys that haven't expired, oldest first, asIssuedKeys, which code readsid,started_atandends_atfrom, never the key itself. AGETroute runs it too, and anOutputcan send the list (Listing from aGETroute).Service.revoke_key(key_id)deletes one by itsid; anidno key has revokes nothing.- Keys live in the
jadpo_service_keyssystem table, in the store the service entity lives in (System tables). Jadpo looks a key up with its service's record,active:and all, in one statement, so a disabled service is refused (service_disabled) on its next request. - A service key signs in only a service. A route that selects
current_principal.userrefuses it with 403not_permitted, and one that selectscurrent_principal.servicerefuses a user the same way.
Markdown for agents: /docs/service-credentials.md.Built from Jadpo main at a707efb.