4. fleetmesh-auth Wire Protocol Specification#
This document specifies the HTTP interface mounted under /api/fauth/*, the request and response payloads exchanged on those endpoints, and the portable cross-site pass format.
The authoritative machine-readable artifacts for this specification are:
Test vectors:
core/vectors/web-auth.jsonJSON Schema definitions:
schema/schemas/identity/fleetmesh-auth.schema.jsonProtocol constants: the
web_authsection ofschema/schema/constants.json
In the event of any discrepancy between this prose specification and the test vectors, the test vectors are authoritative.
The reference implementation is fleetmesh_auth, built on fleetmesh_core.identity.web_auth and fleetmesh_core.identity.auth_wire. Independent implementations (such as the Rust node or third-party providers in other languages) require only the test vectors, the JSON schemas, and this specification.
4.1. Conventions#
Every JSON response is an object containing a boolean
okfield.Timestamps are integer Unix seconds (UTC).
Hexadecimal encodings are lowercase.
<hex64>denotes 32 bytes (64 hex characters);<hex128>denotes 64 bytes (128 hex characters).Nostr events are NIP-01 objects
{id, pubkey, created_at, kind, tags, content, sig}signed with BIP-340 Schnorr signatures.
4.2. 1. Routes#
Method |
Path |
Purpose |
Response |
|---|---|---|---|
|
|
Issue a single-use authentication challenge |
§3 |
|
|
Verify credentials and establish a session |
§4 |
|
|
Inspect an active session token |
§5 |
|
|
Revoke an active session token |
§5 |
|
|
Create an account via a provider and establish a session |
§4.5 |
|
|
Query handle availability for registration |
§4.6 |
|
|
List registered authentication providers |
|
|
|
Retrieve sign-in widget configuration |
|
|
|
Retrieve the sign-in widget script |
|
Any |
Other |
Unrecognized authentication endpoint |
|
The reference standalone server additionally exposes GET /healthz ({ok:true, service: "fleetmesh-auth"}) on the main listener and, when FLEETMESH_AUTH_ADMIN_ADDR is configured, GET /healthz, GET /readyz (200 or 503, {ok, ready}), and GET /metrics (Prometheus text exposition format) on the administrative listener. Operational endpoints are outside the client wire protocol.
4.2.1. HTTP Status Codes#
200: Request succeeded (ok: true).401: Authentication, authorization, or session verification failed.400: Malformed or unreadable request body (invalid_json,invalid_content_length,payload_too_large), or form/selection validation errors on registration endpoints (§4.5, §4.6).404: Unrecognized endpoint.
Clients MUST branch on the JSON ok and error fields rather than relying solely on the HTTP status code.
4.2.2. Session Token Extraction#
Endpoints that accept a session token (/api/fauth/session, /api/fauth/logout, and protected host application routes) extract the token in the following precedence order:
HTTP headers:
X-Fleetmesh-Auth,Authorization(stripping a leadingBearerprefix),X-Admin-Token,X-Session-Token,X-FleetMesh-Key.Query parameter:
token=.JSON request body fields:
token,session_token,api_key.
Session tokens begin with the prefix fmauth_ followed by 24 random bytes encoded as base64url, and remain valid for session.ttl_sec = 604800 seconds (7 days).
4.3. 2. Constants#
Defined under web_auth in schema/schema/constants.json (and pinned by webauth.constants in the test vectors):
Name |
Value |
|---|---|
Challenge scheme minted |
|
Challenge schemes accepted |
|
Challenge ID |
24 random bytes encoded as 48 lowercase hex characters |
Challenge TTL |
|
Accepted |
|
|
|
Ticket prefix minted |
|
Ticket prefixes accepted |
|
Ticket |
|
Ticket content |
|
Ticket TTL |
|
Ticket future skew |
|
Session token prefix |
|
Session TTL |
|
4.4. 3. Challenge#
GET /api/fauth/challenge[?domain=] or POST /api/fauth/challenge with optional JSON body {"domain": ...} (defaulting to the node’s configured domain) issues a single-use challenge:
{
"ok": true,
"challenge_id": "<hex48>",
"challenge": "<hex48>",
"challenge_text": "fleetmesh-auth-v1:<hex48>:https://node.example",
"auth_message": "fleetmesh-auth-v1:<hex48>:https://node.example",
"auth_message_sha256": "<hex64>",
"domain": "node.example",
"instance_url": "https://node.example",
"expires_at": 1700000600
}
challenge_id and challenge contain identical values; challenge_text is a legacy alias for auth_message. Both pairs are retained for backward compatibility.
The canonical challenge message is <scheme>:<challenge>:<origin_url>, where origin_url is the node’s https://host origin with no trailing slash (webauth.challenge_message). In a direct challenge login, the client signs sha256(message) as the 32-byte BIP-340 message digest.
Challenges are stored with their expires_at timestamp and consumed upon first verification attempt. Replay or submission after expiration fails with challenge_invalid_or_expired.
4.4.1. Challenge Scheme Verification#
The node mints challenges using fleetmesh-auth-v1 exclusively. When verifying a direct challenge signature, the verifier computes the digest under each accepted scheme for the given challenge and origin (webauth.challenge_message returns digests), checks the minted scheme first, and accepts the first valid signature. The verified result records the matched scheme (scheme in webauth.verify). Signatures over unrecognized scheme strings are rejected with signature_invalid.
4.5. 4. Login#
POST /api/fauth/login (or /api/fauth/verify) accepts a JSON object carrying a credential. Optional fields accepted on any login payload are provider (or provider_id), required_role, app_preset (or preset, defaulting to standard), identity_event (a NIP-01 kind 0 event signed by the same key), home_instance_url, and home_node_did.
4.5.1. 4.1 Payload Normalization (auth.normalize_payload)#
Before routing to providers, the engine normalizes incoming request payloads as follows:
If
auth_methodis absent andmethodis present,methodis copied toauth_methodusing the alias mappingnip07_ext→nip07_extension,schnorr_key→private_key,did_challenge→did, andservice_provider→service_login.Short field names are copied to their canonical names when the canonical field is absent:
signature→signature_hex,challenge→challenge_id, andpubkey→pubkey_hex.
Existing fields are never removed or overwritten; synthesized fields are appended in the order listed above.
4.5.2. 4.2 Provider Routing#
Providers are selected and evaluated in the following order:
Explicit
provider: Only the named provider is evaluated. An unregistered name fails withunknown_provider; a disabled provider fails withprovider_not_enabled.Cryptographic key, DID, or passkey payload: Any key/DID/passkey method or any presence of
bunker_uri,secret_key,private_key,signature(_hex),auth_event,credential_id, orpasskey_credential_idroutes tosovereign_key.Prefixed token: A token present in
portable_ticket,ticket,token, orapi_keyroutes to the provider(s) claiming its prefix (fmpass_routes tosovereign_key; plugin prefixes route to their declaring plugin).method == portable_ticket: Routes tosovereign_key.Operator token:
operator_tokenmethod or field routes tolocal_operator, followed by other account providers.API key or bearer token:
methodset toapi_keyortokenroutes to every provider supporting that method.Default fallback: Every provider supporting
service_loginis evaluated in registration order (key providers first, external plugins in load order,local_operatorlast).
The engine returns the first successful result (ok: true). When a provider returns ok: false, its error code is retained as evaluation continues; if all candidate providers fail, the engine returns the last refusal code (authentication_failed if no code was supplied, or no_provider_for_this_login if no provider matched routing). Unhandled provider exceptions produce provider_error. If authentication succeeds but the resulting auth_method is disallowed by the active preset, the engine refuses with method_not_enabled.
4.5.3. 4.3 Login Payloads by Method#
4.5.3.1. Direct Challenge Signature (NIP-07 Extension, DID, or Key)#
{"method": "nip07_ext", "pubkey": "<hex64>", "challenge": "<hex48>", "signature": "<hex128>"}
{"method": "did", "did": "did:nostr:<hex64>", "challenge": "<hex48>", "signature": "<hex128>"}
{"pubkey_hex": "<hex64>", "challenge_id": "<hex48>", "signature_hex": "<hex128>"}
signature MUST be a valid BIP-340 signature over sha256(<scheme>:<challenge>:<origin_url>) under an accepted scheme. Verification produces method: "challenge_signature" and principal auth_method set to nip07_extension (or did / private_key when requested).
Refusal codes: credentials_malformed (non-hex64 pubkey, missing challenge, or non-hex128 signature), identity_malformed (unparseable DID), challenge_invalid_or_expired, and signature_invalid.
4.5.3.2. Signed Auth Event (NIP-98 or NIP-42)#
{"auth_event": {"kind": 27235, "pubkey": "<hex64>", "created_at": 1700000000,
"tags": [["u", "https://node.example/api/fauth/login"], ["method", "POST"],
["challenge", "<hex48>"]],
"content": "<anything; the vector uses the auth_message>", "id": "...", "sig": "..."}}
Verification checks are applied in strict order:
Valid BIP-340 event signature (
auth_event_signature_invalid).Event
kindin{27235, 22242}(auth_event_wrong_kind).|now - created_at| <= max(challenge ttl, 120)(auth_event_timestamp_skew).If a NIP-40
expirationtag is present, it has not elapsed (auth_event_expired).A non-empty
challengetag is present (auth_event_challenge_mismatch).Challenge exists, has not expired, and is consumed (
challenge_invalid_or_expired).Event
idhas not previously been seen (auth_event_replayed; seen IDs are retained for 600 s).
Verification produces method: "auth_event" and principal auth_method set to nip07_extension or did.
4.5.3.3. NIP-46 Bunker#
{"bunker_uri": "bunker://<hex64>?relay=wss://...", "challenge_id": "<hex48>", "signature_hex": "<hex128>"}
The bunker:// or nostrconnect:// URI identifies the signing key; authentication requires a valid challenge signature produced by the remote signer. Missing signatures fail with bunker_requires_challenge_signature; unparseable URIs fail with bunker_uri_malformed. The resulting principal sets auth_method to nip46_bunker and populates bunker_relay.
4.5.3.4. Portable Ticket (§6)#
{"portable_ticket": "fmpass_<base64url>"}
Both the verified method and principal auth_method are portable_ticket.
4.5.3.5. Passkey (WebAuthn)#
Passkey assertions carry credential_id, challenge_id, client_data_json (base64url-encoded JSON whose challenge matches the issued challenge ID as UTF-8 or raw bytes), and authenticator_data (base64url-encoded, at least 37 bytes, with the user-presence UP flag set). Authentication (webauthn.get) additionally requires passkey_signature; registration (webauthn.create) carries attestation_object and public_key_spki. Refusal codes are the passkey_*, *_authenticator_data, and invalid_webauthn_type entries in §7.
4.5.3.6. Operator Token (local_operator)#
{"method": "operator_token", "operator_token": "<the node's configured token>", "username": "operator"}
password and token are also accepted as token fields. Refusal codes: operator_token_not_configured, missing_operator_token, and invalid_operator_credentials. Successful verification grants roles including node_operator.
4.5.3.7. Account Provider Plugin (service_login)#
Account plugins accept the fields declared in their login_form (typically username, password, and optionally service_url) or provider-issued API keys in api_key or token (§9).
4.5.3.8. Prohibited Secret Key Transmission#
Submitting a raw secret key (secret_key or private_key) in any request body is unconditionally rejected with private_key_not_accepted. Signing MUST occur exclusively on the client.
4.5.4. 4.4 Login Response#
{
"ok": true,
"session_token": "fmauth_<base64url>",
"token": "fmauth_<base64url>",
"expires_at": 1700604800,
"principal": { ...authPrincipal (§8) }
}
token duplicates session_token for backward compatibility with older clients. If required_role is specified (in the request body or by the route) and the authenticated principal does not satisfy it, the response is:
{"ok": false, "error": "insufficient_role", "detail": "The principal lacks the required role",
"required_role": "admin", "roles": ["viewer", "creator", "broadcaster"]}
4.5.5. 4.5 Account Registration#
POST /api/fauth/register creates a new account through a provider reporting providerDescribe.supports_registration: true (§9) and establishes a session for the resulting principal. The request body carries provider, the provider’s register_form fields, and an optional app_preset:
{"provider": "acme", "username": "ann", "password": "...", "email": "ann@example.org", "app_preset": "standard"}
provider MAY be omitted if exactly one registered provider supports registration. On success, the response matches the login response format (§4.4), with principal.auth_method set to service_login unless overridden by the provider.
Refusal codes:
HTTP
400:handle_taken,invalid_handle,weak_password,invalid_email,provider_required(multiple providers support registration and none was named),unknown_provider,registration_unsupported(the specified provider—or every registered provider—does not implement registration).HTTP
401:provider_not_enabled,method_not_enabled(none of the provider’s methods is enabled),insufficient_role(whenrequired_roleis unsatisfied), andprovider_error.
4.5.6. 4.6 Handle Availability Check#
GET /api/fauth/register/check?provider=<id>&handle=<h>[&preset=<p>] queries a provider whose providerDescribe.supports_handle_check (§9) is true to determine whether handle is available for registration. The success response (authHandleCheck) MUST contain strictly these keys:
{"ok": true, "available": false, "reason": "handle_taken"}
reason is null when available is true, and otherwise handle_taken or invalid_handle. Before querying the provider, the server trims whitespace, removes at most one leading @, and immediately returns invalid_handle for empty strings, values longer than 64 characters, or characters outside [A-Za-z0-9._-].
Refusal responses use authError (§7):
HTTP
400:provider_required,unknown_provider,handle_check_unsupported, andregistration_unsupported.HTTP
401:provider_not_enabledandprovider_error.
No additional account attributes are disclosed. Because this endpoint is unauthenticated and indicates handle existence by design, deployments MUST apply edge rate limiting equivalent to /api/fauth/register.
4.6. 5. Session Inspection and Logout#
GET /api/fauth/session[?required_role=] validates the session token extracted per §1:
{"ok": true, "principal": { ...authPrincipal }}
Refusal codes: missing_session_token (no token supplied), expired_session_token (known token past expires_at; the expired record is deleted), invalid_session_token (unknown or revoked token), and insufficient_role (including required_role and roles). Tokens issued natively by a co-hosted application’s own session store are resolved via the engine’s UserDirectory and returned in the same format.
POST /api/fauth/logout revokes the supplied session token and returns {"ok": true} unconditionally, regardless of whether the token existed. It returns missing_session_token only when no token is provided. Subsequent requests presenting a revoked token fail with invalid_session_token.
4.6.1. Multi-Replica Deployment Requirement#
Single-use challenges (§3), replay-tracking records, and sessions (§5) are stored in the engine’s AuthStore. Under the default SQLite backend, this state is local to a single process: load-balancing across multiple SQLite-backed replicas causes challenge verification to fail with challenge_invalid_or_expired and limits session validity to the issuing replica. Any deployment operating multiple replicas behind a single hostname MUST configure all replicas to share a PostgreSQL store (--store-url postgres://... or FLEETMESH_AUTH_STORE_URL), ensuring database-wide, exactly-once challenge consumption and event replay protection.
4.7. 6. Portable Ticket (fmpass_)#
A portable ticket is a self-contained, user-signed NIP-98 event wrapped in a base64url envelope, enabling a user authenticated on one site to sign in to another node without a pre-existing account on the target node. Its exact byte representation is pinned by webauth.ticket_mint, webauth.ticket_decode, and the ticket, wildcard_ticket, and legacy_ticket sections of core/vectors/web-auth.json.
4.7.1. Minting Procedure (encode_portable_ticket)#
Inputs: secret key
sk(hex64, lowercase),home_instance_url(origin URL of the minting site, trailing slash stripped; may be empty),home_node_did(may be empty),target_url(target origin URL, trailing slash stripped; empty string becomes*),ttl_sec,now, a 12-bytenonceencoded as 24 lowercase hex characters, and an optionalidentity_event(signed kind0event from the same key).Key and expiration:
pk = pubkey(sk);ttl = clamp(ttl_sec or 300, 30, 3600);expires_at = now + ttl.Tags (in exact order):
["u", target_url],["method", "POST"],["expiration", str(expires_at)],["home", home_instance_url],["nonce", nonce_hex].Auth event: Construct a NIP-01 event with
kind = 27235,created_at = now, the tags from step 3, andcontent = "fleetmesh-cross-site-login:<pk>:<expires_at>", then sign withsk. Thenoncetag guarantees distinct event IDs when two tickets are minted by the same key within the same second, enabling replay protection by event ID.Bundle construction (keys in exact order):
{"version": 1, "home_instance_url": "...", "home_node_did": "...", "target_url": "...", "expires_at": 1700003600, "identity_event": null, "auth_event": { ...step 4 }}
JSON serialization: Serialize as compact UTF-8 JSON with
,and:separators, no extraneous whitespace, preserved key insertion order, and non-ASCII characters escaped as\uXXXX(matching Pythonjson.dumpsdefaults).Encoding: Base64url-encode (RFC 4648 §5) with trailing
=padding removed.Prefixing: Prepend
fmpass_. The minting result object is{portable_ticket, bundle, expires_at, target_url, pubkey, did}wheredid = did:nostr:<pk>.
4.7.2. Decoding (webauth.ticket_decode)#
Strip the accepted prefix (fmpass_), restore base64url padding, decode to UTF-8, and parse JSON. Any decoding failure or non-object JSON value fails with ticket_malformed. Login payloads MAY alternatively supply the decoded bundle object directly in portable_ticket.
4.7.3. Verification Procedure#
Ticket verification executes the following checks in strict order:
auth_eventis present and has a valid BIP-340 signature; otherwiseticket_signature_invalid.auth_event.kind == 27235; otherwiseticket_wrong_kind.expirationtag is present and strictly greater thannow; otherwiseticket_expired.auth_event.created_at <= now + 120; otherwiseticket_future_timestamp.utag equals""or*(matching any origin), or equals the verifying node’sorigin_url(trailing slash stripped); otherwiseticket_host_mismatch.If
identity_eventis present (in the bundle, or falling back to the request body), it MUST be a JSON object (identity_event_malformed), validly signed by the samepubkey(ticket_identity_mismatch), and of the expected event kind when enforced by the node (identity_event_wrong_kind).auth_event.idhas not previously been redeemed; otherwiseticket_replayed. Seen event IDs are retained until the ticket’sexpirationtimestamp.
Successful verification yields: {pubkey, did, method: "portable_ticket", home_instance_url, home_node_did, identity_event, auth_event_id, scheme: ""}.
4.7.4. Compatibility and Minting Responsibility#
For legacy compatibility, the reference decoder also accepts unprefixed base64url strings; clients MUST NOT rely on this behavior and MUST emit the fmpass_ prefix.
The server engine never mints portable tickets during login because tickets require the user’s private signing key. Tickets are minted client-side in the browser sign-in panel (via a user key or NIP-07 extension) or programmatically via FederatedWebAuth.create_portable_ticket / webauth.ticket_mint.
4.8. 7. Refusals and Error Codes#
Every error response uses the following structure:
{"ok": false, "error": "<snake_code>", "detail": "<one English sentence>"}
The error field is the normative programmatic contract: a stable snake_case identifier matching ^[a-z][a-z0-9_]*$ drawn from the registry below (ERRORS in fleetmesh_core.identity.web_auth, pinned by the errors map in the test vectors). The detail field is a human-readable diagnostic message and is not part of the programmatic contract; its wording may change across releases. Certain refusals include supplementary fields such as required_role, roles, or path. Implementations MAY define additional error codes but MUST NOT rename the standard codes listed below.
Code |
Meaning |
|---|---|
|
Challenge is unknown, already consumed, or past its TTL |
|
Direct login missing a hex64 pubkey, challenge, or hex128 signature |
|
BIP-340 signature fails verification under all accepted schemes |
|
Ticket does not decode from |
|
Ticket |
|
Ticket |
|
Ticket lacks an |
|
Ticket |
|
Ticket |
|
Ticket |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Public key or DID cannot be parsed |
|
|
|
Node is not configured with a challenge store |
|
Node does not accept portable tickets |
|
No operator token is configured on the node |
|
Operator login omitted the token |
|
Submitted operator token does not match |
|
|
|
Provider raised an unhandled exception or encountered an internal failure |
|
Bunker URI submitted without a challenge signature |
|
Request included a raw secret key |
|
Provider is disabled for the active preset or node |
|
Resulting |
|
Authenticated principal lacks the |
|
No registered provider matched the login payload |
|
All evaluated providers refused without supplying a specific error code |
|
No session token found in headers, query string, or body |
|
Session has passed |
|
Session token is unknown or has been revoked |
|
|
|
DID submitted without a challenge signature |
|
Missing |
|
|
|
|
|
|
|
|
|
|
|
|
|
Decoded |
|
User-presence ( |
|
|
|
Provider (or all providers) does not implement |
|
Registration or handle check omitted |
|
Registration: requested handle is already registered ( |
|
Registration or handle check: handle fails syntax validation ( |
|
Registration: password does not satisfy provider policy ( |
|
Registration: email address is malformed ( |
|
Handle check: provider does not implement |
|
Unrecognized |
|
Unrecognized route on the reference server ( |
|
Request body is not a valid JSON object ( |
|
|
|
Request body exceeds the configured size limit ( |
4.9. 8. Principal and Roles#
An authPrincipal object, as derived by auth.principal (principal_dict in fleetmesh_core.identity.auth_wire), has the following structure:
{
"principal_id": "did:nostr:<hex64>",
"did": "did:nostr:<hex64>",
"pubkey": "<hex64>", "pubkey_hex": "<hex64>",
"username": "nostr:ab5d2e79cfd6", "handle": "nostr:ab5d2e79cfd6", "display_name": "nostr:ab5d2e79cfd6",
"auth_method": "nip07_extension",
"provider_id": "sovereign_key", "provider": "sovereign_key",
"roles": ["viewer", "creator", "broadcaster"],
"scopes": ["*"],
"session_token": "fmauth_...", "admin_token": "",
"portable_ticket": "", "bunker_relay": "",
"issued_at": 1700000000, "expires_at": 1700604800,
"metadata": {"signature_verified": true, "user_id": "", "identity_id": ""}
}
4.9.1. Normalization Rules#
pubkey/pubkey_hexandprovider/provider_idare synchronized alias pairs.A 64-character hex
pubkeyis lowercased.usernamefalls back tohandle, then toprincipal_id;display_namefalls back tohandle.auth_methoddefaults toservice_login.scopesare deduplicated while preserving insertion order, defaulting to["read", "content", "streams"].portable_ticketfalls back tometadata.portable_ticket.admin_tokenis populated withsession_tokenwhenrolescontainsadmin,moderator, ornode_operator; otherwise it is"".
4.9.2. Role Closure (auth.expand_roles)#
Canonical role ordering: viewer, creator, broadcaster, moderator, admin, node_operator. Each role implies itself in addition to the roles listed below:
Role |
Implied Roles |
|---|---|
|
— |
|
|
|
|
|
|
|
|
|
|
Input roles are trimmed and lowercased. Unrecognized custom roles are preserved in sorted order after the canonical roles. An empty role set expands to ["viewer"]. A required_role check (has_required_role) succeeds when the required role appears in the expanded closure (an omitted required_role defaults to viewer). Note that admin and node_operator mutually imply one another, whereas moderator implies neither.
4.10. 9. Provider Plugin Interface (API Version 1)#
Each provider verifies one category of credential. The engine includes sovereign_key and local_operator; external providers are loaded as plugins (in Python, subclasses of fleetmesh_auth.AuthProviderPlugin discovered via the fleetmesh_auth.providers entry point or FLEETMESH_AUTH_PLUGINS; see docs/PLUGINS.md). Implementations in other languages (such as the Rust node) MUST expose the equivalent interface.
4.10.1. Provider Metadata (providerDescribe)#
Public metadata returned by GET /api/fauth/providers and embedded in config.providers_detail:
{
"provider_id": "acme", // ^[a-z][a-z0-9_]{0,63}$, stable
"display_name": "Acme",
"description": "Sign in with your Acme account",
"supported_methods": ["service_login", "api_key"], // §4 authMethod values
"token_prefixes": ["fmk_"], // tokens it issues; routes token/api_key/ticket to it
"login_form": {"title": "...", "submit": "...", "hint": "...",
"fields": [{"name": "username", "label": "Username", "type": "text", "autocomplete": "username"}]},
"register_form": null, // same shape as login_form, for providers that create accounts
"supports_registration": false, // true when the provider implements register (§4.5)
"supports_handle_check": false, // true when the provider implements check_handle (§4.6)
"api_version": 1
}
login_form is null when the provider does not require an interactive credential form. Declaring service_login in supported_methods registers the provider as an account provider eligible for login requests that omit provider.
4.10.2. Provider Behavior#
claims_token(token) -> bool: Returnstrueiftokenbegins with any prefix intoken_prefixes, andfalseotherwise.authenticate(payload, context) -> result: Evaluates the normalized payload (§4.1).contextsuppliesnow(the engine clock),web_auth(challenge, ticket, and replay verification),hostanddirectory(the optional co-hosted application and its user store),domain,app_preset,allow_any_sovereign_key, andpasskey_store. Returns{"ok": true, "principal": <principal fields>}or{"ok": false, "error": "<code>", "detail": "<sentence>"}(detailis optional; the engine supplies a default message for known codes). Providers MUST NOT raise exceptions for invalid credentials; returningok: falseallows the engine to proceed to the next candidate provider. RaisingAuthRefused(code)is equivalent to returning the corresponding refusal dictionary; any other exception is caught and reported asprovider_error.register(payload, context) -> result(optional, §4.5): Returns the same result structure asauthenticate. The default implementation refuses withregistration_unsupported.check_handle(handle) -> result(optional, §4.6): Returns strictly{"ok": true, "available": bool, "reason": null | "handle_taken" | "invalid_handle"}, or{"ok": false, "error": "<code>"}if the check cannot be completed. Invoked only whensupports_handle_checkistrue, after the engine has trimmed and validated the handle syntax (§4.6).Configuration (
from_settings): Reads environment variables prefixed withFLEETMESH_AUTH_<PROVIDER_ID>_<NAME>.Determinism: Providers MUST use
context.nowand the engine-provided token source rather than the system wall clock or independent randomness so that protocol exchanges remain reproducible against conformance vectors.
Python providers are verified with fleetmesh_auth.plugin_testing.check_provider; implementations in other languages are validated against the logins section of core/vectors/web-auth.json.
4.11. 10. Sign-In Panel Configuration#
GET /api/fauth/config?preset=standard returns {ok: true, config}, where config (authWidgetConfig) contains preset branding (app_id, app_title, app_subtitle, mode as gate or modal, brand_*, accent_*, logo_variant), required_role, method and provider allow/deny lists, providers, providers_detail (§9), and login_options. Each entry in login_options describes an interactive option:
{"option_id": "bunker", "method_id": "bunker_nip07", "label": "Bunker / NIP-07",
"button_label": "Bunker / NIP-07", "description": "...", "icon_id": "bunker",
"tier": "expert", "provider_id": "sovereign_key", "enabled": true,
"sub_methods": {"nip07_extension": true, "nip46_bunker": true}}
4.11.1. Presets#
Built-in presets are standard, admin, and ops (with alias meshnode-ops). Host applications can register or override presets programmatically using fleetmesh_auth.register_widget_preset(name, overrides, base="standard") and remove them with unregister_widget_preset(name). Registered presets take precedence over built-in presets, allowing a host to customize admin.
Supported override fields in authWidgetConfig are app_id, app_title, app_subtitle, mode, brand_name, brand_badge, accent_primary, accent_secondary, logo_variant, required_role, enabled_methods, disabled_methods, primary_methods, enabled_providers, disabled_providers, primary_actions, more_options_label, and signup_provider. Unrecognized keys are logged and ignored, and app_id defaults to the preset name.
Standalone servers accept equivalent preset definitions via the environment variable FLEETMESH_AUTH_PRESETS_JSON='{"acme": {"base": "ops", "app_title": "Acme"}}' (mapping {name: {base?, ...overrides}}), loaded on package import. Unrecognized preset= query values resolve by substring fallback: names containing admin resolve to admin, names containing ops resolve to ops, and all others resolve to standard.
4.11.2. Method Catalog#
Canonical catalog method_id values are: service_provider (any service_login plugin), bunker_nip07, private_key, did, api_key, passkey, portable_ticket, and operator_token. A plugin’s login option is included only when that plugin is registered.
4.12. 11. Conformance#
core/vectors/web-auth.json pins every wire representation defined in this specification using deterministic fixtures: fixed keys (a1*32 for the user, b2*32 for an alternate key, c3*32 for the node), now = 1700000000, challenge ID 00112233...4556677, nonce 0badcafe..., session token fmauth_vvv..., and zeroed BIP-340 auxiliary randomness for reproducible signatures.
To regenerate the vector file:
cd mesh-py/core && PYTHONPATH=.:../auth:../../schema python3 scripts/gen-web-auth-vectors.py
4.12.1. Conformance Operations#
Defined in schema/schema/conformance.json, implemented in fleetmesh_core.conformance.conformance_ops, and executed against candidate implementations by fleetmesh.org/scripts/conform.py:
Operation |
Specification Coverage |
|---|---|
|
§2 constants and §7 error-code registry |
|
§3 challenge response for a fixed challenge ID and clock |
|
Challenge message, SHA-256 digest, and digests across accepted schemes |
|
§6 minting steps 1–8 from |
|
§6 decoding across accepted prefixes, or |
|
§4.3/§6 verification given issued challenges and seen event IDs; yields verified result or |
|
§4.1 payload normalization |
|
§8 role closure |
|
§8 principal serialization |
4.12.2. Vector Sections and Verification Suites#
constants,errors,challenge,challenge_signature,auth_event,ticket,wildcard_ticket,legacy_ticket,principal,expand_roles,normalize_payload, andrefusals: verified via the conformance operations above (core/tests/test_web_auth_vectors.py,conform.py).logins(17 request payloads with full expected responses),session,ticket_replay, andchallenge_replay: verified end-to-end through the HTTP route handlers (tests/test_conformance_vectors.py) with injected clock and token sources (FleetmeshAuthEngine(clock=, token_source=)) andreset_replay_state()invoked between test cases.All wire payloads in the vector file are validated against
schema/schemas/identity/fleetmesh-auth.schema.jsonviaschema/scripts/validate-schemas.py.
An implementation is conformant when conform.py passes every web-auth/* test case and its HTTP layer reproduces every logins, session, and *_replay response byte-for-byte under the fixed fixture inputs.