getPeer()->isExternal()) { return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Only external peers can authenticate using this method'); } $session = $request->getSession(); if(!$session->flagExists(SessionFlags::AUTHENTICATION_REQUIRED)) { return $rpcRequest->produceResponse(false); } SessionManager::updateFlow($session, [SessionFlags::AUTHENTICATION_REQUIRED]); } catch(Exception $e) { throw new StandardRpcException('An error occurred while authenticating the peer', StandardError::INTERNAL_SERVER_ERROR, $e); } return $rpcRequest->produceResponse(true); } }