Skip to main content

Module api_auth

Module api_auth 

Source
Expand description

API authentication, per-listener authorization floors, origin policy, and token-file lifecycle. Authentication and browser-origin policy for the native JSON-RPC listeners.

A node serves two listeners. The internal listener is the operator’s control surface and gates every route behind the Bearer token. The external listener is the surface peers dial to perform the HTTP handshake: its nodeDid and answerOffer methods are public, while its status and registry reads stay gated. The requirement for one request is the pure function required(listener, body) = floor(listener) ⊔ class(body) over the join-semilattice rings_rpc::method::AuthorizationClass; this module owns the listener floor and that function, and the endpoint layer only applies its verdict.

Structs§

ApiSecurity
Immutable authentication and browser-origin policy shared by both listeners of one node.
LoadedApiToken
An API authentication token loaded from its owner-only file.

Enums§

ApiListener
The two JSON-RPC listeners a native node serves, distinguished by their authorization floor.
ApiSecurityError
Errors raised while configuring API authentication or managing its token file.

Functions§

load_api_token
Resolve and load the configured API token without creating a missing file.
load_api_token_file
Load and validate a token from an explicit file path.
load_or_create_api_token
Resolve and load the configured API token, creating a random owner-only token if absent.