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:----XvSgfREwJpTcKFtoBMGmFc/a9FeULw2ZLeHLIHQLeDkTy/gA5CUqQSDqX+pPAsfA/VXsRPjPMjfAMOwx03Q8lSN8A4hX14QmPF6sfhur/zEoerHkj+A/eec9WMVIqH35PbF1lwNitJmAL+FP1juk11HYS2vrCqPUOUUzO8BUikXAI71iNfDJ2wzUEFkUNTd4QMMab4I5sC0HPejSlx0JycTTeeMgCR4h4ZBOxqNb1QWnnhmhTlUUJQ7Aihlmz96EGwY3rZP0jCNAd37+Z6A7vlv/rtPJCBi+aDDQx6z1IQDtPRH8eO5NSdmsnSt4nDp+4rhSa+4DAt/q7b4cURwor1ciHOe1g2OamE9VCadjZc2DOBcgH+w1KQ8bQ5SNLBq7xGcbcIpiU2VEC61T96bNrnD0f79W6X4RCuP5CWWlSd9M2VChfbQ8mEJ6tA21t/m44LYIj2SIgH6E9xFkUGoe9pjNByMbeR6i7miZESA6EBs6t/VuNtMeo3hFDtLlS8zH0kpuk9suH4roxSfmpgvLhfUWpl2k10x6p0Owvsvvdu+P1zHXQs0lVRuIE3YHd3sq7yS50kdUarMudCAHrEPHAadh+/Grs927zppRvwORxM9+qjL7lneGUzuPHY5kgEHsEo1PeKqx0jAgxRruUu63DTbmBgSTm7kkl5N5fcohKFU=----ATTACHMENT:----NDUyMTk5Nzk1MDE0NTc0MiA3NzEwMDcxNDIxNjI3NDM5IDQ0ODU0MzY3NjQ2OTk1ODU=