Skip to content

AuditContextOptions

Defined in: src/adapters/context-shared.ts:25

Options for every framework’s auditContext() middleware. The callbacks receive the framework’s own request context (Hono’s c, Express’s req, Elysia’s ctx, Bun’s Request) so they can read whatever the host’s auth already resolved (a session, a decoded JWT, req.user, …).

Type Parameter
Ctx
Property Type Description Defined in
actor? (ctx) => MaybePromise< | AuditActor | null | undefined> Resolve the actor for events recorded in this request (or nothing). src/adapters/context-shared.ts:27
context? (ctx) => MaybePromise< | AuditContext | null | undefined> Extra context keys merged over the captured IP / user agent / request id. src/adapters/context-shared.ts:31
requestIdHeader? string Header carrying the request id. Default: x-request-id, then cf-ray. src/adapters/context-shared.ts:39
tenant? (ctx) => MaybePromise<string | null | undefined> Resolve the tenant for events recorded in this request (or nothing). src/adapters/context-shared.ts:29
trustProxy? boolean Trust proxy headers (x-forwarded-for, cf-connecting-ip, x-real-ip, fly-client-ip) for the client IP. Default true — set false when the app is reachable directly, or clients can spoof their IP. src/adapters/context-shared.ts:37