auth.ts
Install with bun add @addonium/helpers. Zero runtime dependencies - works under Bun, Node 18+, and browsers.
auth.ts
RequestShape
interface RequestShape.
authForRequest( manifest: Pick<Manifest, "type" | "auth">, token?: string, ): RequestShape
Build headers/query for one request given the manifest auth block + token.
grantHint(manifest: Pick<Manifest, "auth">): string | null
Human-readable grant hint (informational only, never enforced).
accessRequirements( manifest: Pick<Manifest, "type" | "auth">, ): AuthRequirement[]
Author-defined access conditions (§6.2 requirements), normalized to
objects. Display-only: hosts surface these at install time (§13) and
never enforce them — whatever the author demands (Discord membership,
supporter role, purchase, ...) stays between author and user (§6.3).