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:----lbZBYPHNzd1AzsqTsootC+QUST6vwCSx+hYs6wcWhL9yo5dfDgxD4NWehUj0gr98cJpr23+zS+QvZOD35V4OXiQB5vNTdBitHYpcCk/lFBKyOTX6diICkpNRC+ebTMQu1eDobtY/9p/B1fOjbJNhdhxXuTewea3sbExnZjcZK7eK/iV5fxFUlHHcHyUwVWQbWNfygLf0+6qGHGIEJJjj7nwt7gk0tBUAK4HE6LNV5tY60eD9T2BCmVO4GDapMyM0Xu7d71BBA2O72UIcP2boufZoyPUsk5OoBjxONoiN/O3ncuDiAdQPhi0gUC4mF96TLHb61g9TNCGCnUZi50mm/KxBTycetu1KZfnmij+Jeu4BVP7HH32azMBSlr2CPsdxjkp0NUOWLckqF4hTyegBanEOhv9no9N/4TTWJ+jD/NNd+zFhqPfZPNqE0PxUrxIdDcfKTOe4i69LR5Fffggm7oLWo/Cuv5y83BvCPJt9PjrOtusfFIL/J1lOWV9JjF/z4FEdtRLi/rlmr1AURxUpepIDjiHsr71MrVGjOlcHpkzgFqHxRar88//Qr+iXlYjTINthBj9SzjMsn4a2oKD2HkegtLdPIose8VL8+3yHz7Kh0c4XX5+JfcauOMUei+ZeAaKbKPT9sYS1OyLcSUjzNK7CYceDFpsvM3lVxJOOanQ=----ATTACHMENT:----MTI3NDQ3NTI3ODkzODk3NyA2ODkxOTIzMjYxMjA1ODYgNzAzMzA2OTkyOTI4ODE2Mw==