1. Authentication (fleetmesh-auth)#
fleetmesh-auth provides identity verification and session management for
FleetMesh web applications, administrative interfaces, and standalone mesh
services. Applications can embed a FleetmeshAuthEngine instance—mounting its
/api/fauth/* routes and sign-in panel directly—or deploy it as a standalone
HTTP service via python3 -m fleetmesh_auth. The package depends only on
fleetmesh-core; PostgreSQL session persistence requires the postgres
extra.
pip install --pre fleetmesh-auth
pip install --pre 'fleetmesh-auth[postgres]'
1.1. Authentication Providers#
Two authentication providers are built in:
sovereign_key(SovereignKeyBunkerProvider)Authenticates cryptographic keys and DIDs by verifying signatures over server-issued challenges. Supported clients include NIP-07 browser extensions, private keys or DIDs entered into the sign-in panel (which signs locally in the browser and transmits only the public key and signature; the server unconditionally rejects raw secret keys with
private_key_not_accepted), and NIP-46 bunkers. Note that NIP-46 bunker authentication requires a challenge signature from the remote signer, and the bundled sign-in panel does not yet implement the NIP-46 handshake protocol; consequently, its bunker tab cannot complete a login end to end. This provider also verifies portable passes (fmpass_…): user-signed NIP-98 (kind27235) tickets minted client-side in the browser and valid for a single sign-in within their configured lifetime (up to one hour).local_operator(LocalOperatorProvider)Authenticates the local node operator using
MESHNODE_OPERATOR_TOKEN,meshctlcontrol credentials, or an authorized operator public key. If no operator token is configured, operator-token authentication is refused; no default credential exists.
Integration with external account systems is implemented through provider plugins (Authentication Provider Plugins (API Version 1)).
1.2. Roles#
By default, a key-based login is assigned the creator role. A key receives
operator privileges only when it matches the co-hosted application’s own
operator or node key, or when the application’s user directory assigns it an
admin or node_operator role. Additional privileged keys (formatted as
64-character hex, npub1…, or did:nostr:…) can be declared via
FLEETMESH_AUTH_OPERATOR_PUBKEYS and FLEETMESH_AUTH_ADMIN_PUBKEYS. The
admin and node_operator roles mutually imply one another. For
single-operator deployments, passing allow_any_sovereign_key=True in Python
code grants operator privileges to every verified sovereign key.
1.3. Configuration#
Variable |
Effect |
|---|---|
|
Authentication methods displayed by the sign-in panel and accepted by
the server ( |
|
Active or excluded authentication providers, identified by
|
|
Public keys granted |
|
External provider plugins loaded from |
|
Provider-specific configuration parameters read by |
|
JSON definitions for custom or overridden sign-in panel presets. |
|
Local operator authentication token and display name. |
List-valued variables accept comma- or whitespace-delimited entries; malformed
entries are logged and skipped. Environment settings are parsed by
fleetmesh_auth.settings.
1.4. Standalone Service#
Running python3 -m fleetmesh_auth (or the fleetmesh-auth entry-point
script) starts a standalone HTTP server exposing the /api/fauth/* routes
and sign-in portal. Configuration precedence is command-line flags, followed by
environment variables, followed by built-in defaults:
Flag |
Variable |
Default |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
empty (uses SQLite at |
|
|
|
|
|
empty (administrative listener disabled) |
|
|
empty (cross-origin access disabled) |
Both the primary and administrative listeners bind to loopback and serve plain
HTTP. Production deployments MUST place a TLS-terminating reverse proxy in
front of the primary listener and restrict the administrative listener
(/healthz, /readyz, /metrics) to internal networks. Binding to a
non-loopback interface is permitted but emits a startup warning. Cross-origin
access requires an explicit allowlist of bare origins; when unconfigured, no
CORS response headers are emitted.
1.5. Persistence#
Active sessions, single-use challenges, redeemed authentication event IDs, and
WebAuthn passkey records are persisted in an AuthStore implementation:
either SqliteAuthStore (default) or PostgresAuthStore (selected
automatically by make_store based on a filesystem path or postgres://
URL). Both backends index sessions by the SHA-256 digest of the session token
and never store plaintext bearer tokens. Multi-replica deployments MUST use the
PostgreSQL backend so that session validation, challenge consumption, and
replay tracking are consistent across all replicas.