Fix some postman issues

This commit is contained in:
Diogo Cordeiro
2018-08-05 23:56:05 +01:00
parent 47b1f2219c
commit b9c76c2901
5 changed files with 54 additions and 8 deletions

View File

@@ -63,15 +63,22 @@ class Activitypub_postman
public function __construct($from, $to = [])
{
$this->actor = $from;
$this->to = $to;
$this->to[]= common_local_url('apActorFollowers', ['id' => $from->getID()]);
$discovery = new Activitypub_explorer();
$this->to = array_merge(
$to,
$discovery->lookup(common_local_url(
'apActorFollowers',
['id' => $from->getID()]
))
);
unset($discovery);
$this->actor_uri = ActivityPubPlugin::actor_uri($this->actor);
$actor_private_key = new Activitypub_rsa();
$actor_private_key = $actor_private_key->get_private_key($this->actor);
$context = new Context([
'keys' => [$this->actor_uri."#public-key" => $actor_private_key],
'keys' => [$this->actor_uri.'#public-key' => $actor_private_key],
'algorithm' => 'rsa-sha256',
'headers' => ['(request-target)', 'date', 'content-type', 'accept', 'user-agent'],
]);