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:----GnIPYWvYi/UkqeGhYaKJMCOTsQmNxJ1d5MKJ5CvnwQnY4A+rPGMflp7ozg5giOLKxzlMETo6URddNKC/COaOtvRk5UW1wdmSbrAYDdhwg+jmmtxUhk3nyOAjFyIknYFq5EyoxTB3atp/WoStBK4V969JA1q6iV+JWC+Xbr9bEj5H9mcSqI2U92dcGBLZU0ZtfGw53koTZSGVBDceSuxgkmm67vvOsUWztazNfxSSU2xx4BDofO+IUMeyWQXYAWDF7ezB9Behte5oeQTeitBouIxuMjdAD8O573dKtu1sa+1YogXDP77NP0I8ZLnDMVjtuuQ1KAx/ThZQuWCV0ywF1Nki7JqpEuFkdd85wbL8fEzFgQyjwaz+XImWvCSUGsPMtmXmv3To/5vyRnNGKvrzKSk72Fac/ClDscutNSt8WeXofakvkBYgUbE8HpprKJGbMnRsnWZ5ercDNZSWoUvgCAguG9LDdp6BtN41qcy/MbMwZGxlTNU2ZKplNZJ5EnKRhAW/kPOa+IhxQOuX986CVq/OgNqzAgzdWrzMvCFeVtXStsDA2XnsyNjqU8QWC4u2EulZ22mp4a47vNFK0hwX2sW5LQuqFggK17blYRVBGPJ0qI1HrcSnf+YWsNIbRHlUKXkGjmPAEaQ85XlumdL4Kc3ucC4bRkSQdR6iOBbb4DU=----ATTACHMENT:----MTgzOTU5MTE5NTE3OTc2NyA2MjcxMzI2NTkzODAzNzg5IDkwNTA2NTc1NDY5OTI3NjE=