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:----NMtUtuSCdMPNqSTuMxIfNih5+jdeXnmtZ2OfQ9zpkKzy+9j2lxArfCUPAFkft5dgr9wpY/cqjT68PXFqqNAy78rMFYASsH4n7YRoKEXb+r7rrG8iW+ohzBh+WA0ezn+FIpVlgz4oUdGp80PjSWXBQ2F2RUkQf08uK1jIhIXoF8AIx+4v71WeY6PZCEgNCAT+YoRZ++ZckmF/KsZNnBW0z3CXxyNjQYPcJiLkrH2p/oDWp8CQJiix/uELPtZZemdbGAAXiuYmddnR2FnZKe3iNQUaUF22tI6qt57olLY0hNpI+Sx59I+BQLRQmUu9Yg3hkv/3Rh+yNaR/4ba29rX8DPgB8BMi0MNxQz4zG9ox18Z3v64rt5MrLNMosO/+z4ZlgdpGpZwXaKATUgneWDTewU8/UhCbhVhgaA/aKy2+lenk61/qsQEbVX5xiAS9o/lOxh+TP7DoG/3BC927D1LUMyFfHtmE7S8bBvnuHzVOTXEsVSIFt3cnMAmy1t/3MDAu6+qVP9Xv9cgYN7Bue2SbOOmMaXrx0AZUaVWK/r75w8cLcpCiCnbPSyKsKj0ltniPdGppNZYn5LnB7Zxys9myrPV5Ss3qmntJN1M6BPNJCcrorZSSjMh89wW6BtW2HU6PQVSc4b6Ut8gLlSPKo+2TAQIFioy/b+tQOvwLy1o2Yn0=----ATTACHMENT:----OTU3ODIyMDkyNzI0MDQxNiAzOTg4MzM4ODA5MDUwODggODExNTA1MTI3MDI3ODM2MA==