containsParameter('peer')) { throw new MissingRpcArgumentException('peer'); } // Parse the peer address $peerAddress = PeerAddress::fromAddress((string)$rpcRequest->getParameter('peer')); // Check if host is making the request & the identifier is not empty try { $identifyAs = null; if ($request->getPeer()->getUsername() === ReservedUsernames::HOST->value && $request->getIdentifyAs() !== null) { $identifyAs = $request->getIdentifyAs(); } } catch (DatabaseOperationException $e) { throw new StandardRpcException('Failed to retrieve peer information', StandardError::INTERNAL_SERVER_ERROR, $e); } // Resolve the peer using the server's peer resolver, this will resolve both internal peers and external peers return $rpcRequest->produceResponse(Socialbox::resolvePeer($peerAddress, $identifyAs)); } }