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:----rKzu0eF9TA05h03VyuWRbbJ7ne2bi5Fulg08gedU/aB7GKFHjffp42Rp4GFOhwaR95Urj5Xqd+iFwP6Zxm+jmIHg3ioFNdTQiNnTL1jGLIu6T6Mul3aPKlAAH1SyA5VW5hvmS8BfyaGgBwFpcMre9AA6PnArLz9zsrAXdSFxRMeCZMBlTHO0rGpnigw3OTVa6pghQuxwCFhYMFPhXsRMU20+aSuh5sVNmwIGinl7WJ32WtOpRGYlMWV01F9yzvymPqbwauoy1jNgn5HVPScnCO7ag/I8cKJ5XDvrZZo4BSDHAjaqfyLlAtyAv2aTi9STHpzL2OHlB6SriV2b1hZJZ+DoYDiwirVw2sH3wL8xWMWzk2y81U7pVJlqSdO+5ueVgcV3fI2d7adwUMCihJiXHDjq2GQMkHksigvoAErY+EuPw4jZxIi11LfXmi0C+LWFo1lUgtVL20JdEgrDXbaRgpMb3yucwvxOKR/2oXPkasW2SblnFOvGaKpf8Nts+EGz3rTxW4K6064QY3Bx6MYMjsRYNT7JeS9DKuxScD7gXAsx2E0nySH9sbgeihsqhWymdytvWbnEcpidmxeIr7KsHIqD2p7n6pk7hRIxoE0cPdTwBYnl1m9YVsD2qpDI4COBF3qjDM4fHji2uPjqs0x/fEVdEIeU1nEeQho3A3irJKw=----ATTACHMENT:----MTg0ODM3MzA1ODU3NTU2MiA3MDM1MTM0NzQ1NTUwNzg3IDQ1Njc3ODk3NjYwNjUyMTc=