BengarTrust infrastructure

Docs · Getting started

Authentication

API keys for machines, sessions for people, and why they never cross.

Two credentials, deliberately separate

API keyConsole session
Who holds itYour backendA person's browser
ScopeOne projectThe projects they are a member of
Sent asauthorization: Bearer bk_…An HttpOnly cookie plus a CSRF token
Can it approve?NoOnly with the APPROVER role and a passkey
Can it authorize an agent?YesNo

A key cannot sign a person in, and a session cannot authorize an agent. The separation is the point: one is a machine's standing credential, the other is evidence a human is present.

Getting a key

Console → API Keys → name it → Create key. The secret is shown once. Store it where your backend reads secrets; never in a browser bundle, a repository or a client component.

AVAILABLE Create, list and revoke API keys/projects/:id/api-keys

Where: API Keys

Requires: ADMIN

Using it

curl -sX POST https://gateway.example.com/v1/authorize \
  -H "authorization: Bearer $BENGAR_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "agent": "did:key:…", "permit": "…", "action": "purchase",
        "resource": "resource://company/procurement/laptop" }'

@bengar/sdk is server-only. It holds a tenant API key: importing it into a browser bundle ships that key to every visitor.

Revoking

Revocation is immediate and one-way. A revoked key stops being authorized on the next request, not at the end of a cache window.