getParameters()['type'])) { return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Missing required parameter \'type\''); } if(strlen($rpcRequest->getParameters()['type']) == 0) { return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Parameter \'type\' cannot be empty'); } return match (FirstLevelAuthentication::tryFrom($rpcRequest->getParameters()['type'])) { FirstLevelAuthentication::PASSWORD => self::handlePassword($request), default => $rpcRequest->produceError(StandardError::UNSUPPORTED_AUTHENTICATION_TYPE, sprintf('Unsupported authentication type: %s', $rpcRequest->getParameters()['type']) ), }; } /** * Handles the password authentication phase for the peer * * @param ClientRequest $request * @return SerializableInterface */ private static function handlePassword(ClientRequest $request): SerializableInterface { } }