Unstable/experimental Go library for creating elephant backoffice web UIs.
Howdah provides a component-based web framework with built-in OIDC
authentication, internationalization (i18n), page rendering, and a menu system.
Components register routes on a PageMux that returns structured *Page
objects instead of writing HTTP responses directly, and a PageRenderer
handles template execution and locale resolution.
go get github.com/ttab/howdah
| Document | What it settles |
|---|---|
| README (this document) | Orientation and the working reference: what the package holds, how to wire an application up, and every option it takes. |
| docs/architecture.md | How howdah is built: the render pipeline, the hook system, the OIDC flow, and where a session lives. Read it before changing howdah itself. |
| docs/cookies.md | The cookie and session contract: sealing, the keyring, key rotation, and every way a session ends. |
package main
import (
"embed"
"log/slog"
"net/http"
"github.com/ttab/howdah"
)
//go:embed templates/*.html
var templates embed.FS
//go:embed locales
var locales embed.FS
//go:embed assets
var assets embed.FS
func main() {
logger := slog.Default()
mux := http.NewServeMux()
app, err := howdah.NewApplication(
logger,
mux,
templates,
locales,
assets,
[]howdah.Component{
// your components here
},
)
if err != nil {
panic(err)
}
defer app.Cleanup()
http.ListenAndServe(":8080", mux)
}NewApplication is the entry point. It takes a logger, an http.ServeMux,
three fs.FS values (templates, locales, assets), and a slice of components.
It wires everything together: loads locale files, creates the PageRenderer,
sets up the PageMux, registers an asset file server at /assets/, and calls
RegisterRoutes on each component.
A component is anything that implements the Component interface:
type Component interface {
RegisterRoutes(mux *PageMux)
}Components register route handlers on the PageMux. They can optionally
implement additional interfaces to hook into other parts of the framework:
| Interface | Purpose |
|---|---|
MenuHook |
Contribute items to the navigation menu |
ComponentObserver |
Observe other registered components |
TeplateFuncSource |
Provide custom template functions |
PageMux wraps http.ServeMux but expects handlers that return a *Page
instead of writing a response:
type PageHandlerFunc func(
ctx context.Context, w http.ResponseWriter, r *http.Request,
) (*Page, error)The mux takes care of rendering the page or handling errors. If a handler
returns an error, it is rendered as an error page. Return ErrSkipRender
to signal that the handler already wrote its own response (e.g. a redirect).
Two protections come with the routes, and neither is configurable:
- A write has to come from this application. A
POST,PUT,PATCHorDELETEis refused with a 403 unlessSec-Fetch-Siteissame-originornone— or, for a client that sends noSec-Fetch-Site, unlessOriginnames the host the request was addressed to. A request with neither header is not a browser request and is let through. This is the half of CSRF thatSameSite=Laxdoes not cover: same-site is the registrable domain, so a sibling application on our own domain can post at us with the session cookie attached. The refusal renders through the error page, so the locale files want aCrossSiteRequestBlockedmessage. - Pages refuse to be framed. Every response carries
Content-Security-Policy: frame-ancestors 'none'. A handler that needs a different policy sets the header itself.
Both apply to routes registered on the PageMux and to nothing else, so a
webhook receiver, an API endpoint or an embeddable widget mounted directly on
the http.ServeMux is unaffected — which is also where a route that is
legitimately posted to from another origin belongs.
A Page describes what to render:
type Page struct {
Status int // HTTP status code (defaults to 200)
Template string // name of the Go template to execute
Title TextLabel // page title (translatable)
Menu []MenuItem // additional menu items for this page
Breadcrumb []Link // breadcrumb trail
Contents any // arbitrary data passed to the template
}The menu is built from contributions by all components that implement
MenuHook. Items are sorted by Weight (lower values appear first). Menu
hooks support two phases:
- Build hooks (
RegisterHook) — return menu items to include. - Alter hooks (
RegisterAlter) — modify the collected menu list after all build hooks have run. This lets components hide, reorder, or annotate items based on request context.
The active menu item is determined automatically by matching the current
request path against each item's HREF.
OIDCAuth contributes a "Log out" item of its own. Pass
howdah.WithoutLogoutMenuItem() to drop it in an application that draws its
own log out control; the /auth/logout route is registered either way.
func (c *MyComponent) MenuHook(hooks *howdah.MenuHooks) {
hooks.RegisterHook(func() []howdah.MenuItem {
return []howdah.MenuItem{
{Title: howdah.TL("Dashboard", "Dashboard"), HREF: "/", Weight: 0},
}
})
}Locale strings are loaded from TOML files in the locales filesystem. Files must
be named locale.<lang>.toml (e.g. locale.en.toml, locale.sv.toml). The
format follows go-i18n:
[Dashboard]
other = "Dashboard"
[Greeting]
other = "Hello, {{.Name}}"The user's language is resolved from a lang cookie, falling back to the
Accept-Language header, with English as the final default. A built-in
/set-language endpoint sets the cookie, and gives it the same attributes as
every other cookie howdah sets (see
docs/cookies.md §2). Its optional redirect parameter must be
an application-relative path — the URL page_url hands templates, with the
mount prefix already stripped — and anything a browser would resolve against
another origin is ignored in favour of the application root.
The following functions are available in all templates:
| Function | Signature | Description |
|---|---|---|
t |
t "MessageID" ["fallback"] |
Translate a message by ID |
tl |
tl .Label |
Translate a TextLabel value |
td |
td "ID" "fallback" .Data |
Translate with template data |
lang |
lang |
Returns the current language code |
ctx |
ctx |
Returns the request context |
page_url |
page_url |
Returns the current request URL |
pathescape |
pathescape "value" |
URL path-escapes a string |
renderBlock |
renderBlock "name" .Data |
Renders a named template block |
TextLabel is used throughout the API for translatable strings. Create them
with the helper functions:
howdah.TL("MessageID", "Fallback text") // i18n message
howdah.TMsg(i18n.Message{ID: "X", Other: "Y"}) // from an i18n.Message
howdah.TLiteral("Not translated") // literal string, no lookupOIDCAuth implements the full OpenID Connect authorization code flow. It
registers routes for login, callback, logout, and handles token refresh
automatically.
The keyring is not optional, whichever store the application runs. Without one the session cookie carries the user's access and refresh token, so howdah has no mode in which it writes those to the browser in the clear; with a store it carries a handle, and sealing that binds it to the cookie it lives in — so two applications sharing a host cannot open each other's sessions — and makes dropping a key a way to end the sessions sealed under it. Every store seals, so the keyring is a positional argument rather than an option, and the constructor returns an error.
keyring, err := howdah.CookieKeyringFromEnv(
howdah.WithCookieKeyLogger(logger))
if err != nil {
return fmt.Errorf("read cookie keyring: %w", err)
}
auth, err := howdah.NewOIDCAuth(provider, verifier, oauth2Config, keyring)
if err != nil {
return fmt.Errorf("set up authentication: %w", err)
}Cookies and session keys has the COOKIE_KEY_*
format, how to generate a key, and how to roll one over.
A session lives for howdah.DefaultMaxSessionAge (12 hours) and refreshing
the access token does not extend it. Concurrent refreshes of one session
collapse onto a single round trip to the provider — per process without a
store, and fleet-wide with one that can coordinate. Both are the store's
answer rather than howdah's: see Where sessions live.
What ends a session, what Keepalive is for, and how refresh behaves are
docs/cookies.md §9.
A session is held by a howdah.TokenStore, and unless an application says
otherwise that store is a howdah.CookieTokenStore: the whole session is
sealed into the cookie and howdah keeps nothing. That is what howdah has
always done, and it is the right answer for a small backoffice tool that
should not need a database to have a login.
It gives up what cannot be had without storing something, and the two rows worth deciding on are revocation and how far a refresh deduplicates:
CookieTokenStore (the default) |
tokenstore/pgstore |
|
|---|---|---|
| Needs a database | No | Yes |
| In the cookie | The whole session, 2453 B measured | A handle, some 90 B |
| Revoked by logging out | No — one browser's cookie is cleared, and a copied value works until the session ages out | Yes — the row is gone |
| Log one person out everywhere | No | DeleteSubject |
| Absolute expiry | A sealed issued_at the process checks |
An expires_at column the database checks |
| Refresh deduplication | Per process | Fleet-wide |
| Safe with refresh token rotation at the provider | No | Yes |
| Retiring a cookie key | Wait out the maximum session age | Wait out the maximum session age |
Per-process deduplication is harmless until the provider rotates refresh tokens, at which point two replicas serving one session inside the refresh margin is an intermittent mid-session logout — which makes turning rotation on fleet-wide a decision to move every application onto a store.
WithTokenStore hands OIDCAuth a store of the application's own instead.
The store owns the session: it seals the handle that goes in the cookie,
enforces the absolute expiry, and decides how far a concurrent refresh
deduplicates. OIDCAuth cannot tell which one it is holding — it writes the
handle a store hands back, and writes a new cookie only when that handle
changed or when the value came in under a retired key.
The interface is Create, Get, Update, Reseal, Delete, Refresh and
DeleteExpired. howdah starts no goroutines of its own, so an application
that wants expired sessions swept calls DeleteExpired on a schedule of its
own.
howdah/tokenstore/pgstore is the store for an application that has a
database. The cookie then holds a sealed handle of about ninety bytes, the
tokens live in a row sealed under the same keyring, and the row id is
sha256 of the handle — so a database dump yields nothing anybody can log in
with, and a sealed payload cannot be moved from one session's row to
another's.
store, err := pgstore.New(pool, keyring, "token")
if err != nil {
return fmt.Errorf("create the session store: %w", err)
}
auth, err := howdah.NewOIDCAuth(provider, verifier, oauth2Conf, keyring,
howdah.WithSessionCookieName("token"), // the same name the store took
howdah.WithTokenStore(store),
)What the row buys: logout is a revocation rather than a cleared cookie,
DeleteSubject logs one person out of every browser at once, the absolute
expiry is a column the server checks, and a refresh is serialised across
the fleet — the several requests of a page load collapse onto one token
endpoint round trip however many replicas they land on, which is what makes
it safe to turn refresh token rotation on at the provider.
| Option | Effect |
|---|---|
WithMaxSessionAge |
The absolute session lifetime. Defaults to DefaultMaxSessionAge. |
WithRefreshLease |
How long a refresher holds the right to refresh: the token endpoint round trip and the write-back. New refuses a lease that does not outlast the token request timeout and the write timeout together, and it is what the next caller waits out if a refresher dies mid-exchange. |
WithTokenRequestTimeout |
Bounds the token endpoint round trip, which runs detached from the request. |
WithRefreshMargin |
How little life an access token may have left for a concurrent refresh's result to be used as-is. |
WithRefreshWait |
How long a caller waits for another caller's refresh before failing with ErrRefreshTimeout. |
WithWriteTimeout |
Bounds the writes that must happen even though the request is gone: recording a refresh, and recording that one failed. |
A service on tern should vendor the migration rather than apply it from
here. Both mage sql:migrate and elephant-platform's setup db migrate
apply exactly the tern files in a service's own ./schema and neither looks
inside a dependency, so a migration applied only through this package never
runs in a hosted deploy — the API serves normally and every login fails on a
missing howdah_session. Declare howdah in schema/vendor.json, run
mage sql:vendor, and commit what it writes; mage sql:vendorCheck fails when
a later migration has not been taken. That needs github.com/ttab/mage
v0.11.2 or later.
pgstore.Migrate(ctx, pool) and pgstore.MigrateConn are still there, for an
application that migrates some other way, and they track their version in
howdah_session_version so howdah's numbering cannot collide with the
application's own. pgstore.Migrations is the embedded fs.FS behind both.
Whichever route, the migrations are the application's to run and never the
service's to run at startup — a migration at startup turns every restart,
scale-up and rollback into a schema change.
One job the application schedules, because howdah starts no goroutines:
DeleteExpired(ctx, batch) sweeps sessions past their expiry. Call it until
it returns 0.
There is deliberately no sweep that re-seals rows under a new cookie key, because it would not shorten the wait before a retired key can be dropped: nothing reaches a cookie in a browser that sends no requests, whichever store you run. A stored session's row is re-sealed when a refresh writes it, and one that never refreshes is one that expires and is swept.
| Option | Effect |
|---|---|
WithBasePath |
Resolve redirects and cookie paths against a mount prefix. See Mounting under a path prefix. |
WithSessionCookieName |
Name the session cookie. Required when applications share a host, and it is also the sealing domain. |
WithMaxSessionAge |
Change the maximum session age from DefaultMaxSessionAge. Configures the store howdah builds for itself, so it cannot be combined with WithTokenStore. |
WithTokenStore |
Keep sessions in a store of your own rather than in the cookie. See Where sessions live. |
WithInsecureCookies |
Drop Secure. For a plain-http local run, and nothing else. |
WithCallbackHosts |
Serve the login on more hosts than the one in RedirectURL. A login on a listed host calls back to that host. Every host must be registered with the provider. |
WithProviderLogout |
Make /auth/logout end the provider's session too, by RP-initiated logout at its end_session_endpoint, coming back to the application's root. Needs an absolute RedirectURL, and the root of every host registered with the provider as a post-logout redirect URI. |
WithOnLogin |
A callback after a successful login, before the session cookie is set. Provision users here rather than on every request. |
| Route | Purpose |
|---|---|
GET /auth/login |
Renders the login page |
POST /auth/login |
Redirects to the OIDC provider |
GET /auth/callback |
Handles the OIDC callback |
GET /auth/logout |
Clears the session and redirects to the application root |
OIDCAuth.Keepalive is an http.HandlerFunc rather than a registered route,
for a periodic XHR that keeps a session alive while somebody reads a page that
never calls RequireAuth. Register it on whichever mux serves the
application's API endpoints — see
docs/cookies.md §9.
A failed login redirects back to GET /auth/login with ?login_failed=1
rather than rendering an error page, and the login page's Page.Contents is a
howdah.LoginPage whose Failed field says so. Templates can show a notice;
one that ignores Contents is unaffected. The reasoning, which is not
cosmetic, is docs/cookies.md §10.
Use OIDCAuth as an Authenticator — or as an OptionalAuthenticator,
which adds the OptionalAuth below. Call RequireAuth at the start of a
handler to ensure the user is logged in:
func (c *MyComponent) handlePage(
ctx context.Context, w http.ResponseWriter, r *http.Request,
) (*Page, error) {
ctx, err := c.auth.RequireAuth(ctx, w, r)
if err != nil {
return nil, err
}
// ctx now carries the OAuth2 token and verified access token
accessToken, ok := howdah.AccessToken(ctx)
// ...
}RequireAuth redirects unauthenticated users to the login page and
refreshes expired tokens automatically. A session cookie it cannot use —
unsealed, sealed under a key that is gone, tampered with, past the
maximum session age, or holding a refresh token the provider has refused — is
cleared on the way out, so the browser stops sending it. A session it merely
could not resolve is a different matter: a store that would not answer
leaves the cookie alone and returns a 503, because the session is very likely
still there and the cookie may be the only handle to it. On success it puts
the session's bearer token on the context, for forwarding to backend services,
and stores the verified access token, retrievable with
howdah.AccessToken(ctx).
A handler that calls a backend service on the reader's behalf sends the session's own access token, so the service authorizes the reader and not the application:
// "Bearer <token>", the whole header value.
authHeader, ok := howdah.AuthorizationHeader(ctx)
if !ok {
return nil, howdah.HTTPErrorf(http.StatusUnauthorized,
howdah.TL("NotLoggedIn", "You have to be logged in"),
"the context carries no session")
}
info, err := authParser.AuthInfoFromHeader(authHeader)howdah.BearerToken(ctx) is the same credential without the Bearer prefix,
for building it into something else — an http.Header for a Connect client's
outgoing headers, say. Both report false for a context with no session, and
howdah.WithBearerToken(ctx, token) builds such a context in an application's
own tests. The token is howdah.Token(ctx)'s AccessToken field under a key
of its own, so code that only forwards the credential is not handed the
refresh token as well.
Moving off twirp.HTTPRequestHeaders. Until v0.5.0 the credential was
reachable only through Twirp's request-header context key, so an application
read it with twirp.HTTPRequestHeaders(ctx) and pulled github.com/twitchtv/twirp
into its own go.mod to do it. Replace that read:
// Before.
headers, ok := twirp.HTTPRequestHeaders(ctx)
if !ok {
return ctx, nil
}
authHeader := headers.Get("Authorization")
// After.
authHeader, ok := howdah.AuthorizationHeader(ctx)
if !ok {
return ctx, nil
}howdah still writes the Twirp header as well, so the old read keeps working
and the two can be changed independently. That write is a shim with an end
date: it goes when the fleet's last Twirp mount does, and with it howdah's
twitchtv/twirp dependency.
OptionalAuth is RequireAuth for a page that anybody may read: it resolves
the session when there is one and leaves the visitor anonymous when there is
not, instead of redirecting to the login page.
func (c *MyComponent) handlePublicPage(
ctx context.Context, w http.ResponseWriter, r *http.Request,
) (*Page, error) {
ctx, err := c.auth.OptionalAuth(ctx, w, r)
if err != nil {
return nil, err
}
// ok is false for a visitor who is not logged in, and the page
// renders for them too.
accessToken, ok := howdah.AccessToken(ctx)
// ...
}A request that carries a usable session comes out of it exactly as it would
out of RequireAuth — resolved through the store, refreshed if the access
token was inside the refresh margin, the session cookie rewritten if the
handle moved or came in under a retiring key, and howdah.Token,
howdah.AccessToken and howdah.BearerToken working on the returned
context. Everything else returns
the context unchanged and a nil error: no cookie, a cookie that cannot be used
(which is cleared, exactly as RequireAuth clears it), an access token this
provider's keys do not verify, or a store that could not answer. That last
one is the one difference in judgement rather than in plumbing: RequireAuth
fails the request with a 503, while a public page renders for a reader who is
not logged in and leaves the cookie alone. So a handler must not read a
page's authorization out of whether OptionalAuth found a session — a
database failover would then read as "not logged in". Anything that must have
a session calls RequireAuth.
OptionalAuthMiddleware is the same thing as http.Handler middleware, for
wrapping a whole mux of public pages so that no handler under it has to ask:
appMux := http.NewServeMux()
app, err := howdah.NewApplication(
logger, appMux, templates, locales, assets, components)
// ...
server := http.Server{
Addr: ":1080",
Handler: auth.OptionalAuthMiddleware(appMux),
}Wrapping the application's whole mux resolves the session for howdah's own
/auth/… routes too, which is harmless — nothing in the login flow reads the
session from the context — and for every asset request the application serves,
which is not free: each one becomes a store read, cheap for the cookie-backed
store and a database round trip for pgstore. A mux holding only the public
pages is the tidier scope for both reasons, and it is the mount point that
says which pages those are.
The error return covers one thing, a failure to build the context around a session that had already resolved, which is a fault in the process rather than anything about the visitor. The middleware logs it and serves the request anonymously.
A component that calls OptionalAuth in a handler of its own takes a
howdah.OptionalAuthenticator rather than a howdah.Authenticator. It is
Authenticator plus OptionalAuth, and *howdah.OIDCAuth satisfies it, so
an application that wraps the authenticator forwards the method to reach it:
func (a *RoleAuth) OptionalAuth(
ctx context.Context, w http.ResponseWriter, r *http.Request,
) (context.Context, error) {
// Resolve the session, and nothing else. The role requirement stays in
// RequireAuth: a reader without the role who is refused here is
// indistinguishable from one who is not logged in, which is not
// something the page can act on.
return a.auth.OptionalAuth(ctx, w, r)
}A wrapper's OptionalAuth resolves identity and settles nothing about
authorization, which is the same warning from the other side: a rule that
matters is enforced in RequireAuth, on a page that requires the session.
Nothing is needed from the component for the middleware route — the handler
just reads howdah.AccessToken(ctx) and finds it there or does not.
The session cookie and the post-login redirect cookie (auth_redir) are
sealed with AES-256-GCM under a keyring that can be rotated without logging
anyone out. state and nonce are left in the clear on purpose.
Every cookie howdah sets carries the same attributes and nothing configures
them per cookie: HttpOnly, SameSite=Lax (not Strict — that would break
every login), Secure unconditionally, a Path inside the mount point, and
no Domain, so every cookie is host-only. What Lax leaves open is covered
on the way in instead, by the cross-site write check in
PageMux and PageHandlers.
howdah.WithInsecureCookies() is the one opt-out, for a plain-http local run:
auth, err := howdah.NewOIDCAuth(provider, verifier, oauth2Config, keyring,
howdah.WithInsecureCookies(), // http://localhost only
)Keys come from the environment, one per variable:
COOKIE_KEY_1=2026-08-01T00:00:00Z_TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IA==
COOKIE_KEY_2=2026-09-15T00:00:00Z_aGlzIHJlYXNvbiwgYnV0IGJ5IHRoaXMgc2luZ3VsYXIgcGE=
The value is an RFC 3339 use after and the standard base64 of exactly 32
bytes. Of the keys whose use after has passed, the one with the latest seals;
every configured key opens. howdah.GenerateCookieKey produces a secret, and
elephant-deploy's tools cookie-keys manages the hosted ones.
docs/cookies.md is the authority on all of this — the envelope format and why the AAD carries the cookie name, what fits in a cookie, the key selection rules and the startup errors that enforce them, what every failure to open a cookie means and which one is worth alerting on, what ends a session, what happens when a login fails, and the rollover runbook.
An application can be mounted under a path prefix on a shared server mux
with http.StripPrefix. Since the application only ever sees stripped
paths, anything that emits URLs for the browser (redirects, cookie paths,
menu items, template links) needs to know the prefix. BasePath carries
it:
base := howdah.NewBasePath("/admin")
auth, err := howdah.NewOIDCAuth(provider, verifier, oauth2Config, keyring,
howdah.WithBasePath(base),
// Required when multiple applications share a host, otherwise
// their sessions overwrite each other — and the cookie name is what
// binds a sealed value to this application, so two applications can
// share a keyring without being able to open each other's sessions.
howdah.WithSessionCookieName("admin_token"),
)
if err != nil {
return fmt.Errorf("set up authentication: %w", err)
}
appMux := http.NewServeMux()
serverMux.Handle("/admin/", http.StripPrefix("/admin", appMux))
app, err := howdah.NewApplication(logger, appMux, templates, locales, assets,
[]howdah.Component{
base, // exposes {{base_path}} to templates
auth,
// ...
},
)With WithBasePath set, the OIDC login/logout redirects, the callback
cookies, and the logout menu item all resolve against the mount point.
Remember that the OAuth2 config's redirect URL must point at the prefixed
callback (https://example.com/admin/auth/callback), and that the
provider must allow it.
In templates, prefix any absolute link or asset URL with {{base_path}}:
<link rel="stylesheet" href="{{base_path}}/assets/css/style.css" />
<a href="{{base_path}}/things/">Things</a>In component code, build links with BasePath.Path:
hooks.RegisterHook(func() []howdah.MenuItem {
return []howdah.MenuItem{
{Title: howdah.TL("Things"), HREF: base.Path("/things/"), Weight: 10},
}
})Applications mounted at the server root use the zero value BasePath(""),
which leaves all paths unchanged — registering it keeps templates portable
between prefixed and root-mounted applications.
Handlers return errors that get rendered as error pages. Use HTTPError types
to control the HTTP status code and user-facing message:
// Wrap an error with a status code and translatable message
howdah.NewHTTPError(http.StatusNotFound, "NotFound", "Page not found", err)
// Format-style with a TextLabel message
howdah.HTTPErrorf(http.StatusBadRequest, howdah.TL("InvalidInput", "Invalid input"),
"parse form: %w", err)
// Use the raw error message as the user-facing text
howdah.LiteralHTTPError(http.StatusForbidden, err)
// Shorthand for 500 Internal Server Error
howdah.InternalHTTPError(err)Untyped errors are automatically wrapped as 500 Internal Server Error.
The docform package provides a framework for building forms that read from
and write to newsdoc.Document structures. It is useful when building UIs
that edit structured document metadata.
A docform.Component handles a specific block type:
type Component interface {
Name() string
TemplateName() string
Target() BlockTarget // TargetMeta or TargetLinks
Matcher() newsdoc.BlockMatcher
Extract(blocks []newsdoc.Block) any
Validate(values url.Values) []FieldError
Apply(original []newsdoc.Block, values url.Values) []newsdoc.Block
}Compose components into a Form:
form := docform.New(titleComponent, authorComponent)
// Extract template data from a document
blocks := form.ExtractAll(doc)
// Validate submitted form values
if errs := form.ValidateAll(formValues); errs != nil {
// handle validation errors
}
// Apply form values back to the document
doc = form.ApplyAll(doc, formValues)Form fields are namespaced by component name. A field title.value in the
HTML form maps to value in the title component's Validate and Apply
methods. ParseValues handles the prefix stripping.
This library is unstable and experimental. The API may change without notice.