The Discovery context handles local-network server discovery and device pairing. A self-hosted server registers itself, a pairing session is created with a short-lived code, and a client completes the pairing to obtain the server URL. In config/packages/security.yaml, registration requires ROLE_ADMIN and the other /api/discovery/ endpoints require a fully authenticated user; the controller repeats both checks with #[IsGranted].
Register a self-hosted server and emit ServerRegistered (the register route and app:discovery:register)
CreatePairingCodeCommand
CreatePairingCodeHandler
Open a pairing session for a server
CompletePairingCommand
CompletePairingHandler
Complete and validate a pairing session, emitting PairingCompleted
RegisterServerCommand carries the URL, name and version; RegisterServerHandler generates the API key (64 hex characters from random_bytes(32)). The handler rejects a URL that is not a valid http or https URL, and a blank name or version, with InvalidInputException (HTTP 422, console exit INVALID). ServerInstanceResource does not include the API key, so neither the route nor the command returns it.