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:----rmzOdY1HDwk5ctVVDSoCHRiO3Yg3rHqJGWpfbJrhvuanYQ3IFLOPlQbiYOnC+PkxxVDStn5BYCKZO+YmAcAFUiuCUZSW5+ZVBRk0jwERtvhbpZuV3byi3npJh9tB5jN2eRB0dDQoIgdAs0bDhziWiob6GIDZO0yEjvonRzm+PPCXmbSnDfW1eYoxRulkEsgfbjsGNXumW4qEFrEAd/OQrbktxyyvxKjKsyYr0n5dBYnGOA4vVUFFiHFT/BUueJq+8TwsRN02lwe5MezkpNAUEq5pjLqv6ePkA9ULAzvf7HO6bLVE1uOyVslNejr4IP9+gd6DMFL2pw5HKcdTISWxiyyA8c6aEZGOmWxU+C/j8KEaJiOXABpNVaoNuE+ITjlV0AlM2s9ckKfi+Od/EtdhXYxzuOUcUfUHimcw/UC2M6yvotZa+/8OikpzsWL2ubmGcraaV99qDZOLD5Pm0uNpX9r5KzuefX+r0mahxhA46GgnS2dCsODQHxA4vHqLTGkGo6d3OiQe1RQfHHkuFoZLYAsyZCP/fUi5u8svBxI5hfDBi89P4AXEyj4dyAWAWqTYs4DFUIed9JW4NTxZE5AdtDmvjyKn1NZ2i0Jja2+p9LHVgNFjCMfTx5QYJhIlxVIGnJ9CfClflFPUXxyUbw/Ik+1LuT9qAH0pkCP0hvFFdYM=----ATTACHMENT:----MzAyNzc2ODMzNDE4OTM4OSAzNDU1NTIyMjYxOTE4NjM2IDU3OTgyOTcwNzg2NTI3MjY=