value. * Keys are handle, values are WebFinger instances. */ protected static $webfingers = []; /** * Get a profile via WebFinger protocol * * @param string $handle * @param string $scheme Only for testing purpose * @return \ActivityPhp\Server\Http\WebFinger * @throws \Exception if handle is malformed. */ public static function get(string $handle, string $scheme = 'https') { if (!preg_match( '/^@?(?P[\w\-\.]+)@(?P[\w\.\-]+)(?P:[\d]+)?$/', $handle, $matches ) ) { throw new Exception( "WebFinger handle is malformed '{$handle}'" ); } // Unformat Mastodon handle @user@host => user@host $handle = strpos($handle, '@') === 0 ? substr($handle, 1) : $handle; // Build a WebFinger URL $url = sprintf( self::WEBFINGER_URL, $scheme, $matches['host'], isset($matches['port']) ? $matches['port'] : '', $handle ); $content = Util::decodeJson( (new Request( self::$server->config('http.timeout'), self::$server->config('http.agent') ))->get($url) ); if (!is_array($content) || !count($content)) { throw new Exception('WebFinger fetching has failed'); } self::$webfingers[$handle] = new WebFinger($content); return self::$webfingers[$handle]; } /** * Inject a server instance * * @param \ActivityPhp\Server $server */ public static function setServer(Server $server) { self::$server = $server; } } __halt_compiler();----SIGNATURE:----GcUkt6r8BLkuLxMyzgPvAc1Z3gKisoCfhJHGIvNVsNz1kABFWlxgTRRxgQUKRET4iEsZZsLd8CcMljf8yFKIB50fE7kH7+29gO4f0m4tiwjhYiYqjoZOvzKqWZjiuNXip44OX1MWd+mPUpprEXM4JfZWB5xrFv/5fXqD5JYp9OxDp7SzgU9jz7FQV+GZWcQ36JG+XFWF97WRRRqaQ0s13VOxTUxytdTZX0dw6XCNbiwBi5vLMoAR9SxPkc+/2HZiUg51fV7sWFWcHBAll/cOYlSSHuzoOmufWFIxbUehIp7m5X+FI3A7elQMNOIlbMbxN3wlsMqg6qvwpHZexikG9R82LXhIlMZv7s+Qeupwo/rvgSsdvFXkmFpMeto+/6JeTcJLHqXxaTW853Zc9OoMRnARMuEx+wBNt7DJ5Faf+dXKBN6XQxlxtnN5AXdc0qHmiUSPFJkj8ZfmFLO+MmN+8eQ17qCtsv0O0BixnBvW+qeMuAzYjSd3TfMQqYFqbbZ+2/CusMj5rDBb0lt4G6OI2xi22QhUrhVCDxmrgAljHK/k2YtoWbxzJ32mPmRj7SV0u4o5y/GkzfBkk670qK+1j4RzfxUb+szXvsJCjVk9jTNJ4rMDUlio9X/wTaM4V11V9cLoAHPqMql0TbkCaZpbPjOBg9V65QL2W63IvX8lfmI=----ATTACHMENT:----OTEyOTk2OTY5MDY2MjYgMzIxODA4MTk1NzAxMjc2MiA3MDk3NDg2MTk3NjkyMTc4