Skip to main content

Module broker_token

Module broker_token 

Source
Expand description

Zero-config machine token for a loopback synaps auth-broker (#147 C1).

A loopback broker started without --machine-token-file / SYNAPS_BROKER_TOKEN generates a random token into <base_dir>/auth-broker.token (0600, next to auth.json) and requires it like any other machine token. A client whose broker endpoint is a loopback URL and that has no auth.machine_token / SYNAPS_MACHINE_TOKEN reads the same file, so synaps → local broker keeps working with no extra configuration for the same user/base dir.

Structs§

MachineToken
The machine token a client presents to a broker, with its provenance.

Enums§

BrokerTokenOrigin
How load_or_create_broker_token obtained the token.

Constants§

LOCAL_BROKER_TOKEN_FILE
File name of the auto-generated loopback broker token.

Functions§

is_loopback_endpoint
True when endpoint is an http(s) URL whose host is loopback (localhost, 127.0.0.0/8, ::1).
load_or_create_broker_token
Broker side: read the token at path, or create it when absent.
local_broker_token_path
<base_dir>/auth-broker.token.
read_local_broker_token
Client side: the local broker token, if the file exists and is non-empty.
unauthorized_hint
Actionable text for a broker 401 (client side).